Skip to content

Instantly share code, notes, and snippets.

@qrush
Created November 27, 2008 02:48
Show Gist options
  • Save qrush/29672 to your computer and use it in GitHub Desktop.
Save qrush/29672 to your computer and use it in GitHub Desktop.
Given /I am on the new make page/ do
visits new_make_url
end
Then /a new make called "(\w+)" should be created/ do |name|
Make.exists?(:name => name).should be_true
end
def create
@make = Make.new(params[:make])
if @make.save
flash[:notice] = "Successfully created make."
redirect_to @make
else
render :action => 'new'
end
end
Scenario: Register new make # features/manage_cars.feature:5
Given I am an admin # features/step_definitions/shared_steps.rb:1
And I am on the new make page # features/step_definitions/car_steps.rb:1
When I attach the file at "tesla.jpg" to "logo" # features/step_definitions/webrat_steps.rb:81
And I fill in "name" with "Tesla" # features/step_definitions/webrat_steps.rb:14
And I press "Submit" # features/step_definitions/webrat_steps.rb:6
Then a new make called "Tesla" should be created # features/step_definitions/car_steps.rb:14
expected true, got false (Spec::Expectations::ExpectationNotMetError)
./features/step_definitions/car_steps.rb:15:in `Then /a new make called "(\w+)" should be created/'
features/manage_cars.feature:11:in `Then a new make called "Tesla" should be created'
<form action="/makes" class="form smallform" enctype="multipart/form-data" id="new_make" method="post"><div style="margin:0;padding:0"><input name="authenticity_token" type="hidden" value="932617c3fc83c05f3d700bfd6ffdd79961fef034" /></div>
<div class='bigbox'>
<label for="make_name">Name</label>
<input id="make_name" name="make[name]" size="30" type="text" />
<label for="make_logo">Logo</label>
<input id="make_logo" name="make[logo]" size="30" type="file" />
<div class='bottom'>
<input id="make_submit" name="commit" type="submit" value="Submit" />
</div>
</div>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment