Skip to content

Instantly share code, notes, and snippets.

@bmonkman
Created August 22, 2009 21:03
Show Gist options
  • Save bmonkman/172983 to your computer and use it in GitHub Desktop.
Save bmonkman/172983 to your computer and use it in GitHub Desktop.
routes:
map.connect 'drivers/:id/new_token', :method => "get", :controller => "drivers", :action => "new_token"
map.resources :drivers
drivers_controller_test:
should "send out an email when a token is requested for a driver" do
setup do
@driver = Factory(:driver_user, :company=>@dispatcher.company)
end
assert_routing "/drivers/1/new_token", :method=>"get", :controller => "drivers", :action => "new_token", :id => "1"
assert @driver.client_download_token.blank?
assert_difference 'ActionMailer::Base.deliveries.size', +1 do
get :new_token, :id=>@driver.to_param # <--- Line 58 where the error occurs
end
@driver.reload
assert_false @driver.client_download_token_used?
assert !@driver.client_download_token.blank?
end
error:
test: A signed in dispatcher should send out an email when a token is requested for a driver. (DriversControllerTest):
ActionController::RoutingError: No route matches {:action=>"new_token", :controller=>"drivers", :id=>"988635557"}
/test/functional/drivers_controller_test.rb:58:in `__bind_1250974777_78000'
c:/ruby/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:351:in `call'
c:/ruby/lib/ruby/gems/1.8/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:351:in `test: A signed in dispatcher should send out an email when a token is requested for a driver. '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment