title: Adding Controller Macros in Rspec
body: <p>Im trying to define some controller macros for Rspec. Im using rails 3 and have my macros defined in spec/support/macros/controller_macros.rb, that file looks like this:</p>
  
  <pre><code>module ControllerMacros
      def self.login_admin
          #code
      end
  end
  </code></pre>
  
  <p>in my spec helper I have:</p>
  
  <pre><code>config.include(ControllerMacros, :type =&gt; :controller)
  </code></pre>
  
  <p>So in my controller spec i just call login_admin in my admin tests but when ever i use the method i get</p>
  
  <pre><code>undefined local variable or method `login_admin' for #&lt;Class:0xb6de4854&gt; (NameError)
  </code></pre>
  
  <p>At first I assumed that controller_macros.rb wasn't being included but when I added a "puts" to the file but that showed the file was at least being executed.</p>
  
  <p>I can't see anything wrong with my setup and copying the login_admin method into the describe block works fine so im not sure whats wrong with it.</p>