2
我有一個Rails項目並使用RSpec進行測試。最近,我在spec_helper.rb
添加了這個:TypeError:類的超類不匹配任務
config.before(:suite) do
Rails.application.load_tasks
end
如果我bundle exec rspec
在本地運行測試,一切都很好。但是,當我試圖做同樣的事情上特拉維斯CI,命令與崩潰:
TypeError: superclass mismatch for class Task
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:9:in `<module:Rails>'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:8:in `<module:Sprockets>'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:7:in `<top (required)>'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `require'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `block in require'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `require'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.1/lib/sprockets/railtie.rb:163:in `block in <class:Railtie>'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/railtie.rb:237:in `instance_exec'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/railtie.rb:237:in `block in run_tasks_blocks'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/railtie.rb:245:in `each'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/railtie.rb:245:in `each_registered_block'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/railtie.rb:237:in `run_tasks_blocks'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/application.rb:451:in `block in run_tasks_blocks'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/engine/railties.rb:13:in `each'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/engine/railties.rb:13:in `each'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/application.rb:451:in `run_tasks_blocks'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/engine.rb:453:in `load_tasks'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/railtie.rb:194:in `public_send'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/railtie.rb:194:in `method_missing'
from (irb):25
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/commands/console.rb:110:in `start'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/commands/console.rb:9:in `start'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:68:in `console'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/travis/build/my_application/vendor/bundle/ruby/2.3.0/gems/railties-4.2.9/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
,如果我調試特拉維斯建立和手動啓動bundle exec rails c
,做一個Rails.application.load_tasks
同樣的事情發生。
這裏可能是什麼問題?任何線索將不勝感激!
這真的很有幫助!管理追查問題到一個初始化,修補了一些行爲。非常感謝! – linkyndy
很高興幫助:) – nicooga