[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>: 
dsl/behaviour/rails_example.rb:41:in `method_missing'

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  

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

def protect_against_forgery?


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