[rspec-users] Rspec: `should': uninitialized constant RSpec::Expectations (NameError)

David Chelimsky dchelimsky at gmail.com
Sun Dec 5 23:29:28 EST 2010


On Sun, Dec 5, 2010 at 6:19 PM, DK <structuralartistry at gmail.com> wrote:
> Hi all, anyone have an idea why I am getting an error trying to 'rake
> spec':
>
> 'kernel.rb:27:in `should': uninitialized constant RSpec::Expectations
> (NameError)'.

Looking through the code I can see why this might be happening, but
I'm at a loss as to why it's happening to you and not to everybody.

I _think_ you can work around it for now by requiring "rspec/matchers"
in your spec_helper file. I'd recommend doing so immediately after
require "rspec/core". Please report back as to whether this works.

While you do that, I'll try to reproduce the error here and resolve it
in a definitive way.

Cheers,
David



> Can't seem to find a useful reference online to solve. This project I
> was working on a few months ago and got put aside, meanwhile I rebuilt
> my mac. So something is off but not sure what.
>
> Using rvm, Rails 3.0.3, Ruby 1.9.2, my gemfile.lock installs fine and
> shows the following for rspec. I actually deleted my rvm gemset and re-
> installed the bundle just in case but same error.
>
> Gemfile.lock
>    rspec (2.2.0)
>      rspec-core (~> 2.2)
>      rspec-expectations (~> 2.2)
>      rspec-mocks (~> 2.2)
>    rspec-core (2.2.1)
>    rspec-expectations (2.2.0)
>      diff-lcs (~> 1.1.2)
>    rspec-mocks (2.2.0)
>    rspec-rails (2.2.1)
>      actionpack (~> 3.0)
>      activesupport (~> 3.0)
>      railties (~> 3.0)
>      rspec (~> 2.2.0)
>
>
> Gemfile:
>
>  group :development, :test do
>    gem 'ruby-debug19'
>    gem 'cucumber-rails'
>    gem 'cucumber', '>=0.8.5'
>    gem 'capybara'
>    gem 'rspec-rails'
>    gem 'factory_girl_rails'
>    gem 'webrat', '>=0.4.3'
>    gem 'heroku'
>    gem 'database_cleaner'
>  end
>
> Thanks,
>
> David
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list