restful_authentication の rspec で NoMethodError
前のプロジェクトで使ってた restful_authentication を vender/plugins にコピペして
user sessions を作成後 rake rspec を実行したらエラー???
こんな感じ。
>rake spec ................................................................................ ..........................FFF.............FF...........F........................ ................................................................................ ........................................FFF........ 1) NoMethodError in 'UsersController named routing should route users_path() to /us ers' undefined method `formatted_users_path' for #<Spec::Rails::Example::ControllerEx ampleGroup::Subclass_6::Subclass_3:0x389dc78> ./spec/controllers/users_controller_spec.rb:140: … 291 examples, 9 failures rake aborted!
どうやら Rails2.3 から formatted_* ってパス指定ができなくなったのが原因っぽい。
Rails has dropped the formatted_* routes in favor of passing in a :format ption, so we need to update the generated tests/specs for Restful Authentication to use this new format.
No more formatted_* routes in edge rails
patch 出してくれてる人がいるみたい。
https://rails.lighthouseapp.com/projects/8994/tickets/1359
それに formatted_* 修正版を github に up してくれてるっぽい。
http://github.com/dscataglini/restful-authentication
github で試してみよ。
ruby script/plugin install git://github.com/dscataglini/restful-authentication.git ruby script/generate authenticated user sessions
おし! NoMethodError は消えた! でも、あと3つ、あれ? (^^;)
>rake spec ................................................................................ ................................................................................ ................................................................................ ........................................FFF........ 1) 'AccessControlTestController requesting json; I am not logged in and Login not r equired succeeds' FAILED expected "{\"success\": \"json\"}", got "{\"success\":\"json\"}" ./spec/controllers/access_control_spec.rb:67: 2) 'AccessControlTestController requesting json; I am logged in and Login is requir ed succeeds' FAILED expected "{\"success\": \"json\"}", got "{\"success\":\"json\"}" ./spec/controllers/access_control_spec.rb:67: 3) 'AccessControlTestController requesting json; I am logged in and Login not requi red succeeds' FAILED expected "{\"success\": \"json\"}", got "{\"success\":\"json\"}" ./spec/controllers/access_control_spec.rb:67: Finished in 6.812 seconds 291 examples, 3 failures rake aborted!
[確認環境]