[rspec-users] Access controller object in controller macro
jko170 at gmail.com
Wed Apr 18 08:34:36 UTC 2012
On Apr 17, 2012, at 1:30 PM, Nasir Jamal wrote:
> We have just upgraded our Rails 2.3.11 app to Rails 3.0.0 and Rspec 1.3.2 to 2.6. We are having two problems with rspec currently and any help would be great.
> 1) We have some controller macros where we have been using the controller object, session hash, response, etc. in different methods for e.g.
> module ControllerMacros
> def imaginary_method_with_example_calls
> # in actual code different methods call one of the below, this is just an example of things not working
> session[:user_id] = user.id
> But now after upgrading to Rspec 2.6 they do not work and calling controller just returns nil and hence undefined method 'skip_before_filter' for NilClass error. I did google but found nothing regarding this.
> 2) Changing 'request.request_uri' to 'request.full_path' raises the following error when running rspec
> undefined method `full_path' for #<ActionController::TestRequest:0x1bfa46f8>
> Any help / suggestion would be really helpful.
> Kind regards,
> rspec-users mailing list
> rspec-users at rubyforge.org
I assume your app directory looks like this?
And you are running the specs from the *app_root*?
How are you including this module?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users