Module: Sapphire::DSL::Scenarios
- Included in:
- Sapphire
- Defined in:
- lib/sapphire/DSL/Scenarios/Is.rb,
lib/sapphire/DSL/Scenarios/dsl.rb,
lib/sapphire/DSL/Scenarios/Broken.rb,
lib/sapphire/DSL/Scenarios/runner.rb,
lib/sapphire/DSL/Scenarios/Pending.rb,
lib/sapphire/DSL/Scenarios/scenario.rb
Defined Under Namespace
Classes: Broken, Pending, Runner, Scenario
Instance Method Summary
collapse
Instance Method Details
#And(text, &block) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/sapphire/DSL/Scenarios/dsl.rb', line 20
def And(text, &block)
if(Runner.instance.last_scenario.last_given == nil && Runner.instance.last_scenario.last_background != nil)
Runner.instance.last_scenario.last_background.add_and("And ", text, &block)
return
end
if(Runner.instance.last_scenario.last_given.finally != nil)
Runner.instance.last_scenario.last_given.finally.add_and("And ", text, &block)
return
end
if(Runner.instance.last_scenario.last_given.last_when == nil)
Runner.instance.last_scenario.last_given.add_and("And ", text, &block)
return
end
if(Runner.instance.last_scenario.last_given.last_when.last_then == nil)
Runner.instance.last_scenario.last_given.last_when.add_and("And ", text, &block)
return
end
if (Runner.instance.last_scenario.last_given.last_when.last_then != nil)
Runner.instance.last_scenario.last_given.last_when.last_then.add_and("And ", text, &block)
end
end
|
#Background(text, &block) ⇒ Object
4
5
6
|
# File 'lib/sapphire/DSL/Scenarios/dsl.rb', line 4
def Background(text, &block)
Runner.instance.last_scenario.add_background(Background.new(Runner.instance.last_scenario, "Assuming that ", text, &block))
end
|
#Broken(text) ⇒ Object
4
5
6
|
# File 'lib/sapphire/DSL/Scenarios/Broken.rb', line 4
def Broken(text)
Broken.new text
end
|
#Finally(text, &block) ⇒ Object
47
48
49
|
# File 'lib/sapphire/DSL/Scenarios/dsl.rb', line 47
def Finally(text, &block)
Runner.instance.last_scenario.last_given.add_finally(Finally.new(Runner.instance.last_scenario.last_given, text, &block))
end
|
#Given(text, &block) ⇒ Object
8
9
10
|
# File 'lib/sapphire/DSL/Scenarios/dsl.rb', line 8
def Given(text, &block)
Runner.instance.last_scenario.add_given(Given.new(Runner.instance.last_scenario, "Given ", text, &block))
end
|
4
5
6
|
# File 'lib/sapphire/DSL/Scenarios/Is.rb', line 4
def Is(item)
item
end
|
#Pending(text) ⇒ Object
4
5
6
|
# File 'lib/sapphire/DSL/Scenarios/Pending.rb', line 4
def Pending(text)
Pending.new text
end
|
#Scenario(text, &block) ⇒ Object
#Then(text, &block) ⇒ Object
16
17
18
|
# File 'lib/sapphire/DSL/Scenarios/dsl.rb', line 16
def Then(text, &block)
Runner.instance.last_scenario.last_given.last_when.add_then("Then ", text, &block)
end
|
#When(text, &block) ⇒ Object
12
13
14
|
# File 'lib/sapphire/DSL/Scenarios/dsl.rb', line 12
def When(text, &block)
Runner.instance.last_scenario.last_given.add_when("When ", text, &block)
end
|