Skip to content

Commit

Permalink
Added clause for our project forms, ideally I'd live to move this mod…
Browse files Browse the repository at this point in the history
…ule out of the env file.
  • Loading branch information
baphled committed Jul 14, 2010
1 parent 3052092 commit 26ad18c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions features/support/env.rb
Expand Up @@ -58,15 +58,20 @@
# DatabaseCleaner.strategy = :truncation

module FormHelpers
def fill_form(form_name, opts = {})
values = {}
case form_name
when /feature/
values = {:title => 'Logging in', :in_order => 'to create the best app', :as_a => 'user', :i_want => 'the best project ever'}
when /project/
values = {:title => 'A project', :aim => 'An aim', :description => 'A description'}
else
raise "Can't find the form #{form_name}.\n" +
"Now, go and add a mapping in #{__FILE__}"
end

def fill_feature_form(opts = {})
values = {
:title => 'Logging in',
:in_order => 'to create the best app',
:as_a => 'user',
:i_want => 'the best project ever'}
parmas = values.merge(opts)
parmas.each { |param, value| When %{we fill in the feature #{param} with '#{value}'} }
parmas.each { |param, value| When %{we fill in the #{form_name} #{param} with '#{value}'} }
end
end

Expand Down

0 comments on commit 26ad18c

Please sign in to comment.