wardencommunity / rails_warden

A thin rails plugin on top of Warden for Authentication
MIT License
163 stars 31 forks source link

Warden helpers becomes undefined when used with cucumber and rspec-rails #1

Closed wildchild closed 13 years ago

wildchild commented 15 years ago

I am not sure that this is exactly warden issue (sorry for rhyming), but users should know about this problem so I opening this one. I am using cucumber + rspec-rails and by default I have the following in cucumber environment:

config.gem "rspec-rails", :lib => "spec/rails", :version => ">= 1.2.7"

That can result in: undefined local variable or method `warden' for #ActionView::Base:0x24de7f0 (ActionView::TemplateError)

All works fine if gem config changed to:

config.gem "rspec-rails", :lib => false, :version => ">= 1.2.7"
hassox commented 15 years ago

Thanx for brining this one to my attention. Unfortunately my Rails fu hack skills are not yet strong. Here's the code that currently includes the view helper methods.

http://github.com/hassox/rails_warden/blob/460f1ef2245e816b9ffde26d67610e7513b209af/lib/rails_warden.rb#L35

I'd love to know a better way to do this if there is a more railsy accepted way I'll go with it.

Cheers

wildchild commented 15 years ago

Doh! I forgot to mention that I just empirically removed Rails.configuration.after_initialize block and everything seems good.

http://gist.github.com/181443