I am trying to define some controller macros for rspec. Im using rails 3 and my macros are defined in spec / support / macros / controller_macros.rb, this file looks like this:
module ControllerMacros
def self.login_admin
end
end
in my spec helper i have:
config.include(ControllerMacros, :type => :controller)
So, in my controller specification, I just call login_admin in my admin tests, but when I ever use a method, I get
undefined local variable or method `login_admin' for #<Class:0xb6de4854> (NameError)
At first I assumed that controller_macros.rb was not included, but when I added "puts" to the file, but showed that the file was at least executed.
I donβt see anything wrong with my setup and copying the login_admin method to the description block works fine, so I'm not sure what is wrong with it.