title: Testing a module with RSpec 3
body: <p>I was struggling with testing module's <code>def self.method</code>. I found a great thread <a href="https://stackoverflow.com/questions/1542945/testing-modules-in-rspec#answer-19487957">here with a very helpful answer</a>. My code is:</p>
  
  <pre><code>module MyModule
    def self.method
      groups = Posts.group :name
    end
  end
  
  describe Class.new { include MyModule } do
    its (:method) { should be_a(ActiveRecord::Relation) }
  end
  </code></pre>
  
  <p>The problem is, that the question is about <strong>including a module</strong>, and <strong>not extending</strong> it. As the author of the answer mentioned, he <strong>tested it with RSpec 2</strong>. I tested it with <strong>RSpec 3.0.0</strong> and the only thing that worked was when the method was an instance's method. Otherwise I'm getting the following error:</p>
  
  <pre><code>undefined method `method' for #&lt;#&lt;Class:0x0000000..&gt;:0x00000006..&gt;
  </code></pre>
  
  <p>How can I test the <code>MyModule.method</code>?</p>