Module: RSpec::Proverbs::ExampleGroup

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

Instance Method Summary collapse

Instance Method Details

#And(message, options = {}, &block) ⇒ Object



30
31
32
# File 'lib/proverbs/rspec/example_group.rb', line 30

def And(message, options = {}, &block)
  action :and, message, options, &block
end

#But(message, options = {}, &block) ⇒ Object



34
35
36
# File 'lib/proverbs/rspec/example_group.rb', line 34

def But(message, options = {}, &block)
  action :but, message, options, &block
end

#Given(message, options = {}, &block) ⇒ Object



18
19
20
# File 'lib/proverbs/rspec/example_group.rb', line 18

def Given(message, options = {}, &block)
  action :given, message, options, &block
end

#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.



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

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

#Then(message, options = {}, &block) ⇒ Object



26
27
28
# File 'lib/proverbs/rspec/example_group.rb', line 26

def Then(message, options = {}, &block)
  action :then, message, options, &block
end

#When(message, options = {}, &block) ⇒ Object



22
23
24
# File 'lib/proverbs/rspec/example_group.rb', line 22

def When(message, options = {}, &block)
  action :when, message, options, &block
end