Library class not found when running RSpec
<p>I am working on a gem (not rails stuff just Ruby) and so far the code is working great but I am having the following error when running "rspec" from the gem root folder:</p>

<pre><code>$ rspec
spec/logfile_spec.rb:3:in `&lt;top (required)&gt;': uninitialized constant LogFile (NameError)
...
</code></pre>

<p>This is how my gem is organised:</p>

<pre><code>$ ls -R lib
logmsg    logmsg.rb

lib/logmsg:
logfile.rb version.rb yaml

lib/logmsg/yaml:
logmsg.yml
</code></pre>

<p>And my specs:</p>

<pre><code>$ ls -R spec/
logfile_spec.rb logmsg_spec.rb  spec_helper.rb
</code></pre>

<p>Here are the contents of some files:</p>

<h2>- spec/spec_helper.rb</h2>

<pre><code>require 'logmsg'

RSpec.configure do |config|
    ...
end
</code></pre>

<h2>- spec/logmsg_spec.rb (this one works fine when I test it separately)</h2>

<pre><code>require 'spec_helper'

describe Logmsg do
  it 'has a version number' do
    expect(Logmsg::VERSION).not_to be nil
  end
end
</code></pre>

<h2>- spec/logfile_spec.rb (this is the one giving me some headaches)</h2>

<pre><code>require 'spec_helper'

describe LogFile do
  subject { Logmsg::LogFile.new('test') }

  its(:name)            { should_not be nil }
  its(:datetime_format) { should_not be nil }
  its(:format)          { should_not be nil }
  its(:path)            { should_not be nil }

  context "registered" do
    its(:registered) { should be true }
  end

  context 'not registered' do
    its(:registered) { should be false }
  end
end
</code></pre>

<h2>- lib/logmsg.rb</h2>

<pre><code>require 'psych'
require 'logmsg/version'
require 'logmsg/logfile'

module Logmsg

  class LogMsg
    ...
  end
end
</code></pre>

<h2>- lib/logmsg/logfile.rb (this is the one that it had the class not being found)</h2>

<pre><code>require 'logger'

module Logmsg

  class LogFile
    ...
  end
end
</code></pre>

<p>Your help is much appreciated! Thanks!</p>