0

I have a file that I'd like to run under a command-prompt. I can do so directly, and can also do so from irb, but when I try to run the exact same file through Cucumber it does not find rake in the gemfile.

My Cuke starts sort of like this:

Scenario: The aliens have landed
    Given everything is set up right
    ...

The matching step definition invokes a command prompt and executes the file.

Given /^everything is set up right$/ do
  system('C:\svn\browser\apps\xyzstuff\lib\proof_of_concept.bat')
end

Here are the contents of proof_of_concept.bat

set curr_dir=%cd%
chdir /D C:\svn\browser\spec\integration\xyz\forms
bundle exec rake spec:integration:xyz:forms:single_order_flow MY_ENV=vdev
chdir /D %curr_dir%

This is what I see in the console when I run that Cuke:

C:\svn\browser\spec\integration\xyz\forms>bundle exec rake spec:integration:xyz:forms:single_order_flow MY_ENV=vdev
C:/bundler-ruby/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:143:in `gem': rake is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
        from C:/bundler-ruby/lib/ruby/gems/1.8/bin/rake:18

The present-working-directory is, I think, the same in every case as it is controlled by the batch file. Why is bundler not finding rake in this case, yet it does find it when this same file is executed either directly or via irb?

kaleidic
  • 3,070
  • 1
  • 21
  • 22

1 Answers1

0

I got beyond this problem by adding gem 'rake', '0.8.7' to C:\svn\browser\Gemfile

Having done so, I no longer get the problem described above. I do, however, now have the problem described in this SO question.

Community
  • 1
  • 1
kaleidic
  • 3,070
  • 1
  • 21
  • 22