how to get vendor/gems/cucumber-0.4.2 to use vendor/gems/treetop-1.4.2 ?

I've frozen all the gems used for testing my rails app into vendor/gems but some of the dependent gems are loaded from

Do I need to specify each gem in cucumber's dependency tree in the environment initializer?

   config/environments/<env>.rb

Right now I only use config.gem to specify these:

   cucumber, webrat, rspec, and rspec-rails

Here are all the others cucumber depends on:

$ RAILS_ENV=test rake gems

  ...

  - [F] cucumber >= 0.4.2      - [F] term-ansicolor = 1.0.4      - [F] treetop = 1.4.2         - [F] polyglot >= 0.2.5      - [F] polyglot = 0.2.9      - [F] builder = 2.1.2      - [F] diff-lcs = 1.1.2

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

So treetop is there but running:

   $ rake features --trace

results in this error:

   undefined method `has_terminal?' for #<Cucumber::Parser::I18n::EnglishParser> (NoMethodError)

Presumably because cucumber is using an older gem version of treetop in my system gem directory instead of vendor/gems/treetop-1.4.2.

Part of the trace:

(eval):23:in `_nt_feature' /Library/Ruby/Gems/1.8/gems/treetop-1.2.5/lib/treetop/runtime/compiled_parser.rb:18:in `send' /Library/Ruby/Gems/1.8/gems/treetop-1.2.5/lib/treetop/runtime/compiled_parser.rb:18:in `parse' /Users/stephen/dev/test/rites/vendor/gems/cucumber-0.4.2/bin/../lib/cucumber/parser/treetop_ext.rb:28:in `parse_or_fail'

I'm guessing you've run into an issue where Cucumber is calling "require 'treetop'" before the Rails stack is initialized (and thus before vendor/gems is loaded as a gem source). Adding treetop to your config.gem stuff may not help, but a full stack trace from both conditions (with config.gem 'treetop' and without) will be helpful.

--Matt Jones

Stephen Bannasch wrote:

I've frozen all the gems used for testing my rails app into vendor/gems

[...]

Don't do that. Only deployment gems should go in there. Testing gems should just be specified in config/environments/test.rb , as recommended (I think) in the RSpec and Cucumber docs.

Best,