Class/Module Index [+]

Quicksearch

RSpec::Core::SharedExampleGroup

Public Instance Methods

share_as(name, &block) click to toggle source

@deprecated

# File lib/rspec/core/shared_example_group.rb, line 40
def share_as(name, &block)
  RSpec.deprecate("Rspec::Core::SharedExampleGroup#share_as",
                  "RSpec::SharedContext or shared_examples")
  Registry.add_const(name, &block)
end
share_examples_for(*args, &block) click to toggle source
Alias for: shared_examples
shared_context(*args, &block) click to toggle source
Alias for: shared_examples
shared_examples(*args, &block) click to toggle source

@overload shared_examples(name, &block) @overload shared_examples(name, tags, &block)

Wraps the `block` in a module which can then be included in example groups using `include_examples`, `include_context`, or `it_behaves_like`.

@param [String] name to match when looking up this shared group @param block to be eval'd in a nested example group generated by `it_behaves_like`

@example

shared_examples "auditable" do
  it "stores an audit record on save!" do
    lambda { auditable.save! }.should change(Audit, :count).by(1)
  end
end

class Account do
  it_behaves_like "auditable" do
    def auditable; Account.new; end
  end
end

@see ExampleGroup.it_behaves_like @see ExampleGroup.include_examples @see ExampleGroup.include_context

# File lib/rspec/core/shared_example_group.rb, line 31
def shared_examples *args, &block
  Registry.add_group(*args, &block)
end
shared_examples_for(*args, &block) click to toggle source
Alias for: shared_examples

[Validate]

Generated with the Darkfish Rdoc Generator 2.