Hello,
I'm getting an error while testing my AWDWR2 application :
1) Error: test_login(LoginControllerTest): TypeError: can't convert Hash into String /home/foudil/src/ror/depot/vendor/rails/actionpack/lib/ action_controller/assertions/response_assertions.rb:115:in `=~' /home/foudil/src/ror/depot/vendor/rails/actionpack/lib/ action_controller/assertions/response_assertions.rb:115:in `assert_redirected_to' /home/foudil/src/ror/depot/vendor/rails/actionpack/lib/ action_controller/assertions/response_assertions.rb:114:in `collect' /home/foudil/src/ror/depot/vendor/rails/actionpack/lib/ action_controller/assertions/response_assertions.rb:114:in `assert_redirected_to' /home/foudil/src/ror/depot/vendor/rails/actionpack/lib/ action_controller/assertions.rb:54:in `clean_backtrace' /home/foudil/src/ror/depot/vendor/rails/actionpack/lib/ action_controller/assertions/response_assertions.rb:54:in `assert_redirected_to' ./test/functional/login_controller_test.rb:25:in `test_login' /home/foudil/src/ror/depot/vendor/rails/activerecord/lib/../../ activesupport/lib/active_support/testing/default.rb:7:in `run'
in test/functional/login_controller_test.rb:
#... def test_login dave = users(:dave) post :login, :name => dave.name, :password => 'secret' assert_redirected_to :action => "index" assert_equal dave.id, session[:user_id] end #...
in response_assertions.rb:
#... 112 rescue ActionController::RoutingError # routing failed us, so match the strings only. 113 msg = build_message(message, "expected a redirect to <?
, found one to <?>", options, @response.redirect_url)
114 url_regexp = %r{^(\w+://.*?(/|$|\?))(.*)$} 115 eurl, epath, url, path = [options, @response.redirect_url].collect do |url| 116 u, p = (url_regexp =~ url) ? [$1, $3] : [nil, url] 117 [u, (p.first == '/') ? p : '/' + p] 118 end.flatten #...
The problem seems to be that the "option" variable is a hash, in my case : {:action => :login} and thus, it can not be matched against a regex
Is this a bug, or am I misusing something ?
Ruby version 1.8.6 Rails version 2.0.2