[rspec-devel] [ rspec-Bugs-14388 ] protect_against_forgery? helper method not being picked up by rspec_on_rails

noreply at rubyforge.org noreply at rubyforge.org
Tue Oct 23 03:10:19 EDT 2007


Bugs item #14388, was opened at 2007-10-02 12:46
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=14388&group_id=797

Category: None
Group: None
>Status: Closed
Resolution: None
Priority: 3
Submitted By: Jens-Christian Fischer (jcfischer)
Assigned to: Nobody (None)
Summary: protect_against_forgery? helper method not being picked up by rspec_on_rails

Initial Comment:
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

----------------------------------------------------------------------

>Comment By: Brian Takita (btakita)
Date: 2007-10-23 00:10

Message:
Thank you. I applied this in revision 2769.

----------------------------------------------------------------------

Comment By: Brian Takita (btakita)
Date: 2007-10-22 17:45

Message:
There is a fundamental issue with Helper Specs. Ideally,
helper specs should call the view object that has been
properly constructed.

Perhaps we can utilize method_missing to delegate to the
view object?

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=14388&group_id=797


More information about the rspec-devel mailing list