не может преобразовать nil в String (TypeError) при запуске Rspec 2.8 - PullRequest
0 голосов
/ 17 января 2012

При попытке запустить rspec 2.8 на некоторых машинах возникает следующая ошибка (тогда как на других она работает отлично).

$ rspec spec
/var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/cucumber-rails-0.4.1/lib/cucumber/rails3.rb:3:in `dirname': can't convert nil into String (TypeError)
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/cucumber-rails-0.4.1/lib/cucumber/rails3.rb:3
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/cucumber-rails-0.4.1/lib/cucumber/rails.rb:5
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/bundler-1.1.rc.7/lib/bundler/runtime.rb:74:in `require'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/bundler-1.1.rc.7/lib/bundler/runtime.rb:74:in `require'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/bundler-1.1.rc.7/lib/bundler/runtime.rb:55:in `each'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/bundler-1.1.rc.7/lib/bundler/runtime.rb:55:in `require'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/bundler-1.1.rc.7/lib/bundler.rb:118:in `require'
    from /var/lib/jenkins/jobs/monaqasat_master/workspace/config/application.rb:10
    from /var/lib/jenkins/.rvm/rubies/ree-1.8.7-2011.12/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /var/lib/jenkins/.rvm/rubies/ree-1.8.7-2011.12/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /var/lib/jenkins/jobs/monaqasat_master/workspace/config/environment.rb:2
    from /var/lib/jenkins/.rvm/rubies/ree-1.8.7-2011.12/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /var/lib/jenkins/.rvm/rubies/ree-1.8.7-2011.12/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /var/lib/jenkins/jobs/monaqasat_master/workspace/spec/spec_helper.rb:6
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/spork-0.9.0.rc9/lib/spork.rb:24:in `prefork'
    from /var/lib/jenkins/jobs/monaqasat_master/workspace/spec/spec_helper.rb:4
    from /var/lib/jenkins/.rvm/rubies/ree-1.8.7-2011.12/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /var/lib/jenkins/.rvm/rubies/ree-1.8.7-2011.12/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /var/lib/jenkins/jobs/monaqasat_master/workspace/spec/helpers/tenders_helper_spec.rb:1
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `autorun'
    from /var/lib/jenkins/.rvm/gems/ree-1.8.7-2011.12@monaqasat3/bin/rspec:19

Чтобы поместить вещи в контекст, вот наш Gemfile.

group :test, :development do
  gem 'capybara', '~> 0.4.1.2'
  gem 'cucumber-rails'
  gem 'database_cleaner', '0.6.5'
  gem 'email_spec', '~> 1.2.1'
  gem 'parallel_tests', '~> 0.6.7'
  gem 'rspec-rails', '~> 2.8.1'
  gem 'ruby-debug', '0.10.3'
  gem 'shoulda', '3.0.0.beta2'
  gem 'thin', '1.2.7'
  gem 'spork', '~> 0.9.0.rc9'
  gem 'timecop'
end

Другая интересная часть заключается в том, что огурец действительно отлично работает при вызове.

Любая помощь будет принята с благодарностью.

1 Ответ

5 голосов
/ 23 января 2012

Это ошибка.Подробности можно найти в обсуждении группы Google под названием dirname: невозможно преобразовать ноль в строковую проблему .

Это можно исправить, обновив огурцы-рельсы до последней версии.Просто отредактируйте свой Gemfile, чтобы показать это:

gem 'cucumber-rails', '>= 1.1.1'
...