Module: Scenario::RSpecExtensions::ObjectExtensions

Defined in:
lib/scenario/rspec.rb

Overview

Global methods.

Instance Method Summary collapse

Instance Method Details

#define(method_name, &block) ⇒ Object

Syntax sugar for defining a scenario method inside a ‘describe_scenario` block.



42
43
44
# File 'lib/scenario/rspec.rb', line 42

def define( method_name, &block )
  self.send( :define_method, method_name, &block )
end

#describe_scenario(name, base = nil, &block) ⇒ Object

Set up a new scenario and add to the collection of scenarios.



34
35
36
37
38
# File 'lib/scenario/rspec.rb', line 34

def describe_scenario( name, base=nil, &block )
  modul = base ? base.dup : Module.new
  modul.module_exec( &block ) if block_given?
  Scenario::Scenarios.register( name, modul )
end