Module: Uninhibited::Feature
- Defined in:
- lib/uninhibited/feature.rb
Overview
TODO:
complete
Features
Instance Method Summary collapse
-
#And(desc = nil, options = {}, &block) ⇒ Object
Defines a new And example.
-
#Background(*args, &example_group_block) ⇒ Object
Defines a new Background group.
-
#But(desc = nil, options = {}, &block) ⇒ Object
Defines a new But example.
-
#Given(desc = nil, options = {}, &block) ⇒ Object
Defines a new Given example.
-
#Scenario(*args, &example_group_block) ⇒ Object
Defines a new Scenario group.
-
#skip_examples_after(example_group, example) ⇒ Object
private
Skip examples after the example provided.
-
#Then(desc = nil, options = {}, &block) ⇒ Object
Defines a new Then example.
-
#When(desc = nil, options = {}, &block) ⇒ Object
Defines a new When example.
Instance Method Details
#And(desc = nil, options = {}, &block) ⇒ Object
Defines a new And example
And "I am on the home page" do
visit root_path
end
115 116 117 |
# File 'lib/uninhibited/feature.rb', line 115 def And(desc=nil, ={}, &block) example("And #{desc}", , &block) end |
#Background(*args, &example_group_block) ⇒ Object
Defines a new Background group
Feature "Something" do
Background do
Given "I..."
end
Scenario "success" do
When "I..."
end
Scenario "failure" do
When "I..."
end
end
This will be printed like so:
Feature: User signs in
Background:
Given I...
Scenario: success
When I...
Scenario: failure
When I...
takes.
59 60 61 62 63 64 65 |
# File 'lib/uninhibited/feature.rb', line 59 def Background(*args, &example_group_block) describe("Background:", *args) do [:background] = true instance_eval(&example_group_block) if block_given? end end |
#But(desc = nil, options = {}, &block) ⇒ Object
Defines a new But example
But "I am on the home page" do
visit root_path
end
128 129 130 |
# File 'lib/uninhibited/feature.rb', line 128 def But(desc=nil, ={}, &block) example("But #{desc}", , &block) end |
#Given(desc = nil, options = {}, &block) ⇒ Object
Defines a new Given example
Given "I am on the home page" do
visit root_path
end
76 77 78 |
# File 'lib/uninhibited/feature.rb', line 76 def Given(desc=nil, ={}, &block) example("Given #{desc}", , &block) end |
#Scenario(*args, &example_group_block) ⇒ Object
26 27 28 29 30 |
# File 'lib/uninhibited/feature.rb', line 26 def Scenario(*args, &example_group_block) describe("Scenario:", *args) do instance_eval(&example_group_block) if block_given? end end |
#skip_examples_after(example_group, example) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Skip examples after the example provided.
138 139 140 141 142 143 144 |
# File 'lib/uninhibited/feature.rb', line 138 def skip_examples_after(example_group, example) examples = example_group.descendant_filtered_examples.flatten examples[examples.index(example)..-1].each do |e| e.[:pending] = true e.[:skipped] = true end end |
#Then(desc = nil, options = {}, &block) ⇒ Object
Defines a new Then example
Then "I see a welcome message" do
page.should have_content("Welcome!")
end
102 103 104 |
# File 'lib/uninhibited/feature.rb', line 102 def Then(desc=nil, ={}, &block) example("Then #{desc}", , &block) end |
#When(desc = nil, options = {}, &block) ⇒ Object
Defines a new When example
When "I click Home" do
click_link "Home"
end
89 90 91 |
# File 'lib/uninhibited/feature.rb', line 89 def When(desc=nil, ={}, &block) example("When #{desc}", , &block) end |