Project

General

Profile

plugin-local Gemfile breaks rake test

Added by Harry Garrood almost 12 years ago

I would like to use factory_girl in the tests for a plugin I'm developing. When I create a Gemfile in the plugin directory and run tests with `bundle exec rake`, I get this:

rake aborted!
undefined method `active_record' for #<Rails::Application::Configuration:0x000000023ba770>
/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/railtie/configuration.rb:85:in `method_missing'
/home/harry/code/redmine/config/application.rb:26:in `<class:Application>'
/home/harry/code/redmine/config/application.rb:13:in `<module:RedmineApp>'
/home/harry/code/redmine/config/application.rb:12:in `<top (required)>'
/home/harry/code/redmine/Rakefile:5:in `require'
/home/harry/code/redmine/Rakefile:5:in `<top (required)>'
/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `load'
/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:583:in `raw_load_rakefile'
/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:89:in `block in load_rakefile'
/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:88:in `load_rakefile'
/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:72:in `block in run'
/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/home/harry/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/home/harry/.rbenv/versions/1.9.3-p327/bin/rake:32:in `<main>'

but all tests pass when I remove it. (repo is at https://github.com/hdgarrood/redmine_release_notes on the 'refactoring' branch)
Any ideas? At the moment I'm just adding it to #{Rails.root}/Gemfile.local...


Replies (1)

RE: plugin-local Gemfile breaks rake test - Added by Harry Garrood almost 12 years ago

if Dir.getwd == File.dirname(__FILE__)
  Dir.chdir('../..')
end

in the plugin Gemfile seems to fix it. edit no it doesn't... I'm now just listing gems in a file called GEMS, which I append to Gemfile.local.

    (1-1/1)