title: Extending modules and testing class (or instance?) methods in Ruby
body: <p>New to Ruby and thank you in advance!
  I have 2 files in the same directory. Where.rb = </p>
  
  <pre><code>module Where
    def self.where(hash = {})
      self.select do |fixture| #iterate over fixtures indexes |fixture| 
        hash.all?  do |key, value| #return true as long as hash exists
          value === fixture[key]
        end
      end
    end
  end
  </code></pre>
  
  <p>and test.rb = </p>
  
  <pre><code>require 'minitest/autorun'
  require './where.rb'
  
  class WhereTest &lt; Minitest::Test
    extend Where
    def setup
      @boris   = {:name =&gt; 'Boris The Blade', :quote =&gt; "Heavy is good. Heavy is reliable. If it doesn't work you can always hit them.", :title =&gt; 'Snatch', :rank =&gt; 4}
      @charles = {:name =&gt; 'Charles De Mar', :quote =&gt; 'Go that way, really fast. If something gets in your way, turn.', :title =&gt; 'Better Off Dead', :rank =&gt; 3}
      @wolf    = {:name =&gt; 'The Wolf', :quote =&gt; 'I think fast, I talk fast and I need you guys to act fast if you wanna get out of this', :title =&gt; 'Pulp Fiction', :rank =&gt; 4}
      @glen    = {:name =&gt; 'Glengarry Glen Ross', :quote =&gt; "Put. That coffee. Down. Coffee is for closers only.",  :title =&gt; "Blake", :rank =&gt; 5}
  
      @fixtures = [@boris, @charles, @wolf, @glen]
    end
  
    def test_where_with_exact_match
      assert_equal [@wolf], @fixtures.where(:name =&gt; 'The Wolf')
    end
  
    def test_where_with_partial_match
      assert_equal [@charles, @glen], @fixtures.where(:title =&gt; /^B.*/)
    end
  
    def test_where_with_mutliple_exact_results
      assert_equal [@boris, @wolf], @fixtures.where(:rank =&gt; 4)
    end
  
    def test_with_with_multiple_criteria
      assert_equal [@wolf], @fixtures.where(:rank =&gt; 4, :quote =&gt; /get/)
    end
  
    def test_with_chain_calls
      assert_equal [@charles], @fixtures.where(:quote =&gt; /if/i).where(:rank =&gt; 3)
    end
  end
  
  puts WhereTest
  </code></pre>
  
  <p>all my tests say NoMethodError: undefined method `where' for # Array:0x000000027d6a20.</p>
  
  <p>I'm not sure what the error means. I created a module with a class method that should be usable. The module's method should be available to WhereTest class with <code>extend Where</code> </p>