Skip to content

Commit

Permalink
Moved form based step to the rightful place.
Browse files Browse the repository at this point in the history
  • Loading branch information
baphled committed Jul 16, 2010
1 parent 76b9412 commit dba3f4f
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions features/step_definitions/form_steps.rb
Expand Up @@ -2,19 +2,6 @@
visit "/#{model}/new"
end

When /^fill in the project form$/ do
When %{we fill in the project title with 'A project'}
When %{we fill in the project aim with 'An aim'}
When %{we fill in the project description with 'A description'}
end

When /^fill in the feature form$/ do
When %{we fill in the feature title with 'Logging in'}
When %{we fill in the feature in_order with 'to create the best app'}
When %{we fill in the feature as_a with 'user'}
When %{we fill in the feature i_want with 'the best project ever'}
end

When /^I fill in the ([^\"]*) form$/ do |model|
fill_form model
end
Expand All @@ -23,15 +10,12 @@
fill_form model.singularize, opt => ''
end

When /^fill in the story form$/ do
When %{we fill in the story scenario with 'this is our stories scenario'}
end

When /^fill in the step form$/ do
When %{we fill in the step title with 'Given we have a new step'}
When /^I update the ([^\"]*) form$/ do |model|
end

When /^I update the ([^\"]*) form$/ do |model|
# @TODO Refactor all scenarios that use this step to make use of the web_steps instead
When /^we fill in the (.*) (.*) with '(.*)'$/ do |controller, attr, value|
fill_in "#{controller}_#{attr}", :with => "#{value}"
end

When /^I fill in the ([^\"]*) form ([^\"]*) with "([^\"]*)"$/ do |model, property, value|
Expand All @@ -42,6 +26,19 @@
fill_in_form_with_duplicate_data model
end

# @TODO Refactor to work with other form actions
When /^"([^\"]*)" the "([^\"]*)" form$/ do |form_action, item|
case form_action
when /update/
# Do nothing
when /fill in/
When %{I fill in the #{item} form"}
else
raise "Can't find form action\"#{form_action}\".\n" +
"Now, go and add a mapping in #{__FILE__}"
end
end

Then /^the ([^\"]*) information should not be saved$/ do |model|
response.should have_selector :form
end

0 comments on commit dba3f4f

Please sign in to comment.