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
|
# File 'lib/what_the/given_when_then_helper.rb', line 5
def self.included(base)
class << base
def Context(*args, &block)
args.unshift("[context #{args.shift}]")
describe(*args, &block)
end
def Given(*args, &block)
args.unshift("given #{args.shift}")
describe(*args, &block)
end
def When(*args, &block)
args.unshift("when #{args.shift}")
describe(*args, &block)
end
end
RSpec::Core::ExampleGroup.class_eval do
def self.Then(*args, &block)
it(*(["then #{args.shift}"] << args), &block)
end
def self.And_(*args, &block)
it(*(["and #{args.shift}"] << args), &block)
end
end
end
|