Method: RSpec::TestSpec::ExampleGroup#include_steps

Defined in:
lib/test_spec/rspec/example_group.rb

#include_steps(*args) ⇒ Object

In Rspec, example group bodies are delimited by ‘describe’ and ‘context’ methods. These encapsulate examples, which are delimited by ‘it’ methods. Example groups are evaluated in the context of an ExampleGroup instance. Individual examples are evaluated in the context of an instance of the ExampleGroup to which they belong.



9
10
11
12
13
14
15
16
17
# File 'lib/test_spec/rspec/example_group.rb', line 9

def include_steps(*args)
  name = args.shift

  shared_block = ::RSpec.world.shared_example_steps[name]
  shared_block || raise(ArgumentError,
    "Could not find shared steps #{name.inspect}")

  instance_exec(*args, &shared_block)
end