views:

828

answers:

1

I've got a Rails app making use of Cucumber and RSpec. We are storing the gems under vendor/gems and trying to get the app building (running tests) in a CI server.

When I try to run our tests I'm getting the following error:

Missing these required gems:
  cucumber  >= 0.3.11
  rspec-rails  >= 1.2.6

When I run RAILS_ENV=test rake gems I get the following:

 - [F] activerecord-oracle-adapter
    - [R] activerecord >= 1.15.5.7843
 - [F] thoughtbot-factory_girl = 1.2.0
 - [F] cucumber >= 0.3.11
    - [ ] term-ansicolor >= 1.0.3
    - [ ] treetop >= 1.2.6
    - [ ] diff-lcs >= 1.1.2
    - [I] builder >= 2.1.2
 - [F] webrat >= 0.4.4
    - [I] nokogiri >= 1.2.0
 - [F] rspec >= 1.2.6
 - [F] rspec-rails >= 1.2.6
    - [F] rspec >= 1.2.7
    - [ ] rack >= 0.4.0
 - [F] thoughtbot-shoulda >= 2.10.2

I = Installed
F = Frozen
R = Framework (loaded before rails starts)

Do the blank empty [ ]'s mean the gem is missing?

config/environments/test.rb contains the following:

config.gem "cucumber",           :lib => false,          :version => ">=0.3.11" unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/cucumber'))
config.gem "webrat",             :lib => false,          :version => ">=0.4.4"  unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/webrat'))
config.gem "rspec",              :lib => false,          :version => ">=1.2.6"  unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/rspec'))
config.gem "rspec-rails",        :lib => "spec/rails",   :version => ">=1.2.6"  unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
config.gem "thoughtbot-shoulda", :lib => false,          :version => ">=2.10.2" unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/shoulda'))

So everything looks in order, but it still refuses to run.

Am I missing something obvious?

+3  A: 

It looks like you have cucumber, rspec, and rspec-rails frozen (unpacked) in your vendor/gems directory but you are missing dependencies for cucumber and rspec-rails. As the comment on the question says, [] indicates that is missing.

I would start over:

rm -rf vendor/gems/cucumber
rm -rf vendor/gems/rspec-rails
rm -rf vendor/gems/rspec

Then install the gems locally:

gem install rspec rspec-rails cucumber

At this point you should be able to test the app successfully.

Finally, unpack then into your vendor/gems dir if desired:

RAILS_ENV=test rake gems:unpack:dependencies GEM=rspec-rails
RAILS_ENV=test rake gems:unpack:dependencies GEM=cucumber

or alternatively:

RAILS_ENV=test rake gems:unpack:dependencies

to just unpack everything for the test environment into vendor/gems. This would unpack the nokogiri gem you currently have installed locally but not frozen into the app.

Thomas Brice