Module: RSpec::Proverbs::ExampleGroup
- Defined in:
- lib/proverbs/rspec/example_group.rb
Instance Method Summary collapse
- #And(message, options = {}, &block) ⇒ Object
- #But(message, options = {}, &block) ⇒ Object
- #Given(message, options = {}, &block) ⇒ Object
-
#include_steps(*args) ⇒ Object
In Rspec, example group bodies are delimited by ‘describe’ and ‘context’ methods.
- #Then(message, options = {}, &block) ⇒ Object
- #When(message, options = {}, &block) ⇒ Object
Instance Method Details
#And(message, options = {}, &block) ⇒ Object
30 31 32 |
# File 'lib/proverbs/rspec/example_group.rb', line 30 def And(, = {}, &block) action :and, , , &block end |
#But(message, options = {}, &block) ⇒ Object
34 35 36 |
# File 'lib/proverbs/rspec/example_group.rb', line 34 def But(, = {}, &block) action :but, , , &block end |
#Given(message, options = {}, &block) ⇒ Object
18 19 20 |
# File 'lib/proverbs/rspec/example_group.rb', line 18 def Given(, = {}, &block) action :given, , , &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(, = {}, &block) action :then, , , &block end |
#When(message, options = {}, &block) ⇒ Object
22 23 24 |
# File 'lib/proverbs/rspec/example_group.rb', line 22 def When(, = {}, &block) action :when, , , &block end |