Search code examples
rubywatircentos6

Ruby Require not working/uninitialized constant


I have had a suite of Ruby tests using Cucumber and Watir running on an osx machine for years. However, now I need them to run on Centos 6.6.

I think (hope) I've installed everything correctly. However, when I try to run my tests, I get this error on Centos which I just can't figure out.

bash-4.1$ bundle exec cucumber -p local_sun features/clones/registering/registration_step_one_successful.feature GRID=true
Using the local_sun profile...
uninitialized constant Common::Utils::Hydra::Hydra::HttpRequests (NameError)
./lib/common/utils/hydra.rb:12
./lib/chimera-automation.rb:3:in `require'
./lib/chimera-automation.rb:3:in `require_files'
./lib/chimera-automation.rb:3:in `each'
./lib/chimera-automation.rb:3:in `require_files'
./lib/chimera-automation.rb:2:in `each'
./lib/chimera-automation.rb:2:in `require_files'
./features/support/env.rb:54
/var/lib/jenkins/qa-automation-ruby-client-delivery/features/clones/support/env.rb:2:in `require'
/var/lib/jenkins/qa-automation-ruby-client-delivery/features/clones/support/env.rb:2
/var/lib/jenkins/qa-automation-ruby-client-delivery/features/clones/support/env.rb:2:in `each'
/var/lib/jenkins/qa-automation-ruby-client-delivery/features/clones/support/env.rb:2
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/gems/cucumber-1.2.5/bin/../lib/cucumber/rb_support/rb_language.rb:137:in `load'
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/gems/cucumber-1.2.5/bin/../lib/cucumber/rb_support/rb_language.rb:137:in `load_code_file'
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/gems/cucumber-1.2.5/bin/../lib/cucumber/runtime/support_code.rb:180:in `load_file'
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/gems/cucumber-1.2.5/bin/../lib/cucumber/runtime/support_code.rb:83:in `load_files!'
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/gems/cucumber-1.2.5/bin/../lib/cucumber/runtime/support_code.rb:82:in `each'
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/gems/cucumber-1.2.5/bin/../lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/gems/cucumber-1.2.5/bin/../lib/cucumber/runtime.rb:182:in `load_step_definitions'
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/gems/cucumber-1.2.5/bin/../lib/cucumber/runtime.rb:41:in `run!'
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/gems/cucumber-1.2.5/bin/../lib/cucumber/cli/main.rb:43:in `execute!'
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/gems/cucumber-1.2.5/bin/../lib/cucumber/cli/main.rb:20:in `execute'
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/gems/cucumber-1.2.5/bin/cucumber:14
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/bin/cucumber:23:in `load'
/var/lib/jenkins/.rvm/gems/ruby-1.8.7-head/bin/cucumber:23

I have the same setup on my Mac and it works. It looks like it is perhaps not loading the files correctly when I try to require them?


Solution

  • Figured it out, turns out that I needed to add a ./ before a file I was requiring. Strange that Centos needed this and OSX does not.