Jump to content

The ultimate community for Ruby on Rails developers.


Photo

controller_macros.rb undefined local variable or method `login_user'

devise rspec pundit

  • Please log in to reply
1 reply to this topic

#1 NerdcoreSteve

NerdcoreSteve

    Signalman

  • Members
  • 25 posts

Posted 16 June 2014 - 05:39 PM

I'm trying to use the controller_macros.rb as described on this page https://github.com/p...s-3-(and-rspec) for testing pundit policies with devise users. However when I run rspec I get "undefined local variable or method `login_user'"

 

I'm pretty sure the reason this isn't working as advertised is because I'm using rails 4 and the instructions are for rails 3.



#2 NerdcoreSteve

NerdcoreSteve

    Signalman

  • Members
  • 25 posts

Posted 16 June 2014 - 06:51 PM

It works if I put the following line in thing_policy_spec.rb:

include ControllerMacros

But I thought the following line in spec_helper should have made in unnecessary:

config.include ControllerMacros, :type => :controller






Also tagged with one or more of these keywords: devise, rspec, pundit

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users