title: How to include unit tests in a ruby module?
body: <p>I'm trying to include the unit tests for a module in the same source file as the module itself, following the <a href="http://www252.pair.com/comdog/mastering_perl/Chapters/18.modulinos.html" rel="nofollow noreferrer">Perl modulino</a> model.</p>
  
  <pre><code>#! /usr/bin/env ruby
  
  require 'test/unit'
  
  module Modulino
      def modulino_function
          return 0
      end
  end
  
  class ModulinoTest &lt; Test::Unit::TestCase
      include Modulino
      def test_modulino_function
          assert_equal(0, modulino_function)
      end
  end
  </code></pre>
  
  <p>Now, I can run the unit-tests executing this source file.</p>
  
  <p><strong>But</strong>, they are also run when I require/load them from another script. How can this be avoided ? </p>
  
  <p>Is there a more idiomatic way to achieve this with Ruby, unless this practice is discouraged ?</p>