Permalink
Browse files

Tasks with arguments: Can now cope with single or double quotes

  • Loading branch information...
1 parent c9c760d commit 946919ce558286f3692004423c7ec7f3948797bc @antonymarcano antonymarcano committed Jul 2, 2011
View
@@ -25,9 +25,13 @@ GEM
term-ansicolor (>= 1.0.5)
diff-lcs (1.1.2)
ffi (1.0.9)
+ ffi (1.0.9-java)
gherkin (2.3.10)
json (>= 1.4.6)
+ gherkin (2.3.10-java)
+ json (>= 1.4.6)
json (1.4.6)
+ json (1.4.6-java)
mime-types (1.16)
rake (0.8.7)
relish (0.3.0)
@@ -47,6 +51,7 @@ GEM
term-ansicolor (1.0.5)
PLATFORMS
+ java
ruby
DEPENDENCIES
@@ -8,23 +8,32 @@ Feature: Define a Task with arguments
Given you are a Step Free Cuker
And you were able to create a new Cuke Salad project
And you were able to create a role: called 'NewCustomer'
- And you were able to create a task: called 'do something'
Scenario Outline: A task can accept arguments
+ Given you were able to create a task, called 'do some task' containing
+ """
+ in_order_to 'do some task', with: :detail do
+ raise "Expected 'information' in the detail
+ got '#{the :detail}'" unless the( :detail ) == 'information'
+ end
+ """
When you attempt to run a scenario: called 'something' containing
"""
Given I am a New Customer
- <the_step>
+ When I attempt to <task_with_argument>
"""
Then you should see it has 'passed'
Examples:
- | the_step |
- | When I attempt to do something: with 'information' |
- | When I attempt to do something, with 'information' |
+ | task_with_argument |
+ | do some task: with 'information' |
+ | do some task, with 'information' |
+ | do some task: with "information" |
+ | do some task, with "information" |
Scenario: A task accepts tables
- When you attempt to run a scenario, called 'something' containing
+ Given you were able to create a task: called 'do something'
+ When you attempt to run a scenario, called 'something' containing
"""
Given I am a New Customer
When I attempt to do something, with
@@ -1,12 +1,12 @@
in_order_to 'create a task', called: :name_of_task, containing: :code do
- file_name = the( :name_of_task ).gsub(" ", "_")
-
- default_content =
- "in_order_to '#{the :name_of_task}' do
- #nothing
- end"
- content = the :code
- content = default_content if content.nil?
+ file_name = the( :name_of_task ).gsub(" ", "_")
+
+ default_content =
+ "in_order_to '#{the :name_of_task}' do
+ #nothing
+ end"
+ content = the :code
+ content = default_content if content.nil?
- write_file "features/lib/tasks/#{file_name}.rb", content
+ write_file "features/lib/tasks/#{file_name}.rb", content
end
@@ -21,7 +21,7 @@ def set_last value
end
def names_and_values_in details
- specifics_pattern = /('[^']+')/
+ specifics_pattern = /('[^']+'|"[^"]+")/
details.split(specifics_pattern)
end
@@ -30,7 +30,7 @@ def symbolized name
end
def the_value_from_the item
- item.gsub(/(^'|'$)/, '') unless item.nil?
+ item.gsub(/((?:^'|'$)|(?:^"|"$))/, '') unless item.nil?
end
end
end
@@ -12,6 +12,12 @@ module CukeSalad
something.understand_the "specific 'information'"
something.value_of(:specific).should == "information"
end
+
+ it "has an item of specific information" do
+ something = NeedingSpecifics.new
+ something.understand_the 'specific "information"'
+ something.value_of(:specific).should == "information"
+ end
it "has items of specific information" do
something = NeedingSpecifics.new

0 comments on commit 946919c

Please sign in to comment.