Hi,
I'm learning the integration test framework of rails, it's definitely great! But when I tried to use xml_http_request's alias xhr, test broken ...
If I wrote
xml_http_request :post, "/store/add_to_cart", :id => ruby_book.id
everything's ok, tests passed succesfully. After I change this line to
xhr :post, "/store/add_to_cart", :id => ruby_book.id
I get exceptions like this:
Loaded suite test/integration/user_stories_test Started E Finished in 1.203 seconds.
1) Error: test_buying_a_product(UserStoriesTest): ArgumentError: wrong number of arguments (4 for 3) /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/integration.rb:508:in `post' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/integration.rb:508:in `send' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/integration.rb:508:in `post' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/test_process.rb:391:in `send' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/test_process.rb:391:in `xhr' test/integration/user_stories_test.rb:22:in `test_buying_a_product' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/ action_controller/integration.rb:463:in `run'
1 tests, 2 assertions, 0 failures, 1 errors
I don't know why, xhr is just an alias of xml_http_request in the source, isn't?
Thanks, Jan