Module: RSpec::Core::SharedExampleGroup
- Included in:
- ExampleGroup, ExampleGroup
- Defined in:
- lib/rspec/core/shared_example_group.rb,
lib/rspec/core/shared_example_group/collection.rb
Defined Under Namespace
Modules: TopLevelDSL
Classes: Collection
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
Class Method Details
+ (Object) registry
77
78
79
|
# File 'lib/rspec/core/shared_example_group.rb', line 77
def self.registry
@registry ||= Registry.new
end
|
Instance Method Details
- (Object) share_as(name)
44
45
46
47
48
|
# File 'lib/rspec/core/shared_example_group.rb', line 44
def share_as(name, &block)
RSpec.deprecate("Rspec::Core::SharedExampleGroup#share_as",
:replacement => "RSpec::SharedContext or shared_examples")
SharedExampleGroup.registry.add_const(self, name, &block)
end
|
- (Object) share_examples_for(*args)
38
39
40
41
|
# File 'lib/rspec/core/shared_example_group.rb', line 38
def share_examples_for(*args, &block)
RSpec.deprecate("`share_examples_for`", :replacement => "`shared_examples` or `shared_examples_for`")
shared_examples(*args, &block)
end
|
- (Object) shared_example_groups
50
51
52
|
# File 'lib/rspec/core/shared_example_group.rb', line 50
def shared_example_groups
SharedExampleGroup.registry.shared_example_groups_for('main', *ancestors[0..-1])
end
|
- (Object) shared_examples(name, &block)
- (Object) shared_examples(name, tags, &block)
Also known as:
shared_context, shared_examples_for
Wraps the block
in a module which can then be included in example
groups using include_examples
, include_context
, or
it_behaves_like
.
31
32
33
|
# File 'lib/rspec/core/shared_example_group.rb', line 31
def shared_examples(*args, &block)
SharedExampleGroup.registry.add_group(self, *args, &block)
end
|