Displaying 2 results from an estimated 2 matches for "store_controller_test".
Did you mean:
storage_controller_test
2005 Dec 23
6
Agile book - test error
Hi all,
I get an error when testing the "store_controller_test.rb"
The troublesome line is in the test below:
def test_add_to_cart
get :add_to_cart, :id => @version_control_book.id <<<
cart = session[:cart]
assert_equal @version_control_book.price, cart.total_price
assert_redirected_to :action => ''display_cart...
2006 Oct 13
6
If I stub do I have to mock as well?
...nstance.stubs(:successful?).returns(true)
post :checkout
assert_response :redirect
assert_equal "Checkout was successful.", flash[:notice]
end
I expected that the stub would help my test pass but instead it failed
and the failure included the following:
test/functional/store_controller_test.rb:103:in `test_post_checkout'']:
#<Mocha::Mock: 28754118>.successful?() - expected calls: 0, actual calls: 1
I was confused by this and it seemed to indicate that I need to tell
Order that a call to #successful? was expected. Do I have to create a
mock in order to stub? How do I...