Skip to content

Commit

Permalink
Merge branch 'some_step_tweaks' of https://github.com/JonRowe/CukeSalad
Browse files Browse the repository at this point in the history
… into some_step_tweaks
  • Loading branch information
antonymarcano committed Sep 11, 2011
2 parents e847546 + 9ef0f44 commit 4a6272a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
8 changes: 8 additions & 0 deletions features/defining_roles/define_a_role.feature
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ Feature: Define the Role
Given I am a New Customer Given I am a New Customer
""" """
Then you should see it has 'passed' Then you should see it has 'passed'

Scenario: Roles which grammatically required an 'an'
Given you did create a role: called 'UnregisteredCustomer'
When you attempt to run a scenario: containing
"""
Given I am an Unregistered Customer
"""
Then you should see it has 'passed'
28 changes: 28 additions & 0 deletions features/defining_tasks/define_a_task.feature
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -52,3 +52,31 @@ Feature: Define a Task
| And I should do something | | And I should do something |
| Then you should do something | | Then you should do something |
| And you should do something | | And you should do something |

Scenario Outline: Once you've created the task, you see the step pass
Given you were able to create a task: called 'do something for 123Company'
When you attempt to run a scenario: containing
"""
Given I am a New Customer
<step using the task>
"""
Then you should see it has 'passed'

Examples:
| step using the task |
| Given I was able to do something for 123Company |
| And I was able to do something for 123Company |
| But I did do something for 123Company |
| Given you were able to do something for 123Company |
| And you were able to do something for 123Company |
| But you did do something for 123Company |
| When I attempt to do something for 123Company |
| And I attempt to do something for 123Company |
| And I did do something for 123Company |
| When you attempt to do something for 123Company |
| And you attempt to do something for 123Company |
| And you did do something for 123Company |
| Then I should do something for 123Company |
| And I should do something for 123Company |
| Then you should do something for 123Company |
| And you should do something for 123Company |
4 changes: 2 additions & 2 deletions lib/cukesalad/cucumber_steps.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ def in_order_to(do_something, *with_attributes, &actions)
puts "CukeSalad says: Hello!!" puts "CukeSalad says: Hello!!"
end end


Given /^(?:I am|you are) a ([a-zA-Z ]+)$/ do |role| Given /^(?:I am|you are) a(?:n)? ([a-zA-Z ]+)$/ do |role|
@actor = CukeSalad::Actor.new(role) @actor = CukeSalad::Actor.new(role)
end end


When /^(?:I|you) (?:attempt to|was able to|were able to|did)? ([A-Z a-z_-]*)(?:[:|,] (.*))?:?$/ do | this_task, details, *and_more | When /^(?:I|you) (?:attempt to|was able to|were able to|did)? ([A-Z a-z\d_-]*)(?:[:|,] (.*))?:?$/ do | this_task, details, *and_more |
info = understand_the details unless details.nil? info = understand_the details unless details.nil?
info[info.keys.last] = and_more[0] unless and_more.empty? info[info.keys.last] = and_more[0] unless and_more.empty?
@actor.perform this_task, info unless info.nil? @actor.perform this_task, info unless info.nil?
Expand Down

0 comments on commit 4a6272a

Please sign in to comment.