title: Testing a Class inside of a Module with RSpec
body: <p>So, I have a module in my ruby code which looks something like this:</p>
  
  <pre><code>module MathStuff
    class Integer
      def least_factor
        # implementation code
      end
    end
  end
  </code></pre>
  
  <p>and I have some RSpec tests in which I would like to test that my <code>Integer#least_factor</code> method works as expected. we'll say that the tests are in the same file for simplicity. The tests look something like this:</p>
  
  <pre><code>describe MathStuff do
    describe '#least_factor' do
      it 'returns the least prime factor' do
        expect(50.least_factor).to eq 2
      end
    end
  end
  </code></pre>
  
  <p>Unfortunately, when I run the tests, I get an error like this:</p>
  
  <pre><code>NoMethodError:
      undefined method `least_factor' for 50:Fixnum
  </code></pre>
  
  <p>Please let me know if you know how to include the <code>MathStuff::Integer</code> class for testing.</p>
  
  <p>Note: just for clarification, I am actually trying to open up the Ruby Integer class here and add methods to it.</p>