small medium large xlarge

Generic-user-small
30 Nov 2015, 19:06
Patrick Karjala (4 posts)

This chapter wraps up without really telling you to test anything, but I decided to, and it throws 4 errors as follows:

  1) Error:
UserStoriesTest#test_buying_a_product:
ArgumentError: wrong number of arguments (1 for 0)
    app/mailers/order_notifier.rb:10:in `received'
    app/controllers/orders_controller.rb:43:in `block in create'
    app/controllers/orders_controller.rb:37:in `create'
    test/integration/user_stories_test.rb:31:in `block in <class:UserStoriesTest>'


  2) Error:
OrdersControllerTest#test_should_create_order:
ArgumentError: wrong number of arguments (1 for 0)
    app/mailers/order_notifier.rb:10:in `received'
    app/controllers/orders_controller.rb:43:in `block in create'
    app/controllers/orders_controller.rb:37:in `create'
    test/controllers/orders_controller_test.rb:32:in `block (2 levels) in <class:OrdersControllerTest>'
    test/controllers/orders_controller_test.rb:31:in `block in <class:OrdersControllerTest>'


  3) Error:
OrderNotifierTest#test_received:
ArgumentError: wrong number of arguments (1 for 0)
    app/mailers/order_notifier.rb:10:in `received'
    test/mailers/order_notifier_test.rb:6:in `block in <class:OrderNotifierTest>'


  4) Error:
OrderNotifierTest#test_shipped:
ArgumentError: wrong number of arguments (1 for 0)
    app/mailers/order_notifier.rb:22:in `shipped'
    test/mailers/order_notifier_test.rb:14:in `block in <class:OrderNotifierTest>'

I’m not sure what’s causing the “wrong number of arguments” problems listed in the test errors. It traces to the app/mailers/order_notifier.rb file.

After some checking, I was able to find the problem; I hadn’t added (order) as the parameter for the received and shipped methods in the file. Once added this fixed the above errors (though it introduced some others that I’m now working through).

Hopefully this is helpful to others.

You must be logged in to comment