 <p>I suspect that:</p> <ol> <li>in irb, when you <code>require 'cowboy'</code>, that tells rubygems to set up the load paths automatically to point to the currently installed gem dir.</li> <li>when you run <code>test/test_cowboy.rb</code> it doesn't <code>require 'cowboy'</code>. This makes sense because during development, you don't want to load the installed version of the gem, which could be different from the code in your working dir.</li> </ol> <p>I think you should create a <code>test/test_helper.rb</code> file that sets up the load path:</p> <pre><code>$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) </code></pre> <p>You may need to add other dirs if the compiled shared object file (<code>.so</code> or <code>.bundle</code>) isn't placed in <code>lib</code>.</p> <p>Then in each test file (e.g. <code>test/test_cowboy.rb</code>), require <code>test/test_helper.rb</code>:</p> <pre><code>require File.expand_path('../test_helper.rb', __FILE__) </code></pre> <p>You'll need to adjust that relative path if you have subdirs. E.g. if you have a file <code>test/shoes/spur.rb</code>, you'd use:</p> <pre><code>require File.expand_path('../../test_helper.rb', __FILE__) </code></pre>