4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/spectie/story_example_group_methods.rb', line 4
def self.included(mod)
mod.class_eval do
extend Spec::Example::ExampleGroupMethods
include Spec::Example::ExampleMethods
class << self
def scenario_methods; [:Given, :When, :Then, :And] end
def Scenario(description, options={}, backtrace=nil, &implementation)
example(description, options, backtrace) do
instance_eval &implementation
end
end
def xScenario(description, options={}, &implementation)
xexample description, options, &implementation
end
end
scenario_methods.each do |scenario_method|
method = <<-METHOD
def #{scenario_method}(statement, *args, &block)
send statement, *args, &block
end
METHOD
class_eval method, __FILE__, __LINE__
end
end
end
|