[rspec-users] Rails 2.0 & rspec edge - not protected_against_forgery?

Jens-Christian Fischer jcfischer.lists at gmail.com
Tue Oct 2 07:13:19 EDT 2007


The new forgery protection is throwing of rspec:

NoMethodError in 'ApplicationHelper login-logout when logged in  
should show the name of the current user'
undefined method `protect_against_forgery?' for #<#<Class:0x3219118>: 
0x34e1f94>
/Users/jcf/dev/work/sim/vendor/plugins/rspec_on_rails/lib/spec/rails/ 
dsl/behaviour/rails_example.rb:41:in `method_missing'
/Users/jcf/dev/work/sim/app/helpers/application_helper.rb:8:in  
`login_logout'
./spec/helpers/application_helper_spec.rb:28:

I have looked into patching rspec to include the  
"protect_against_forgery?" helper, but it's included dynamically via  
a "helper_method :protect_against_forgery?" call in  
request_forgery_protection.rb

I have forged the forgery_protection by adding this to my spec_helper.rb

def protect_against_forgery?

end

Probably not the most elegant solution, but for now it works

cu jc


--
Jens-Christian Fischer - InVisible GmbH
Tel: +41 79 691 05 48
http://www.invisible.ch, http://blog.invisible.ch



More information about the rspec-users mailing list