使用rake 0.9.2、rspec、expectations、mocks 2.6.0、rspec-core 2.6.4、rspec-rails 2.6.1
当我执行rake rails或rspec spec path/ to /spec时,我得到了正常的输出,直到我期望看到测试实际执行,然后就没有了。我必须杀死进程kill-9 %1来终止任务。
我的gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.4'
gem 'rake', '0.9.2'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'warden'
gem 'devise', "= 1.2.1"
gem 'devise_invitable'
gem 'mysql'
gem 'will_paginate', "~> 3.0.pre2"
gem 'acts-as-taggable-on'
gem 'acts_as_list'
gem 'activemerchant'
gem 'braintree'
gem 'bartt-ssl_requirement', :require => 'ssl_requirement'
gem "paperclip"
gem 'jeditable-rails'
gem 'rdiscount'
gem "nifty-generators", :group => :development
gem "exception_notification", :git => "git://github.com/rails/exception_notification", :require => 'exception_notifier'
# Deploy with Capistrano
gem 'capistrano'
gem 'capistrano-ext'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :development, :test do
gem 'webrat', ">=0.7.2"
gem "rspec-rails"
gem "ZenTest"
#gem "autotest"
#gem "autotest-rails"
gem "cucumber", :git => "git://github.com/cucumber/cucumber.git"
gem "database_cleaner", :git => 'git://github.com/bmabey/database_cleaner.git'
gem "cucumber-rails", ">= 0.3.2", :git => "git://github.com/cucumber/cucumber-rails.git"
gem 'factory_girl_rails'
gem "capybara"
#gem "capybara-envjs"
gem "launchy"
gem "spork"
#gem "ruby-debug"
gem "cancan"
endshell的输出:
bill$ rake spec
/Users/bill/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.0/lib/bundler.rb:197: warning: Insecure world writable dir /opt in PATH, mode 040777
/Users/bill/.rvm/rubies/ruby-1.9.2-head/bin/ruby -S bundle exec rspec ./spec/controllers/products_controller_spec.rb ./spec/controllers/roles_controller_spec.rb ./spec/controllers/users_controller_spec.rb ./spec/models/product_spec.rb ./spec/models/role_spec.rb ./spec/models/user_spec.rb
/Users/bill/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.0/lib/bundler.rb:197: warning: Insecure world writable dir /opt in PATH, mode 040777
/Users/bill/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.0/lib/bundler.rb:197: warning: Insecure world writable dir /opt in PATH, mode 040777直到我杀了他才能做进一步的事。使用--trace运行不会提供任何附加信息。我确信我一定是在做一些非常愚蠢的事情。这似乎是从最近我在rake版本中遇到的问题开始的,因此升级到rake 0.9.2,尽管我没有任何直接关联的具体证据。感谢您对如何更好地调试这方面的任何建议。
发布于 2011-06-17 03:43:01
呃,原来是其中一个夹具文件的问题。我不使用它们,通常是工厂和存根,而且有一个规范不完整,所以看起来rspec只是挂在上面。我通过缩小命令范围来测试不同的组,比如'rake spec:model‘,它是有效的,然后是'rake spec:controller’,它挂起了。进入生成的规格,并注意到加载灯具的线条,删除它们,瞧。永不沉闷…;-)
发布于 2015-03-10 02:52:14
更新:我从this question找到了这个问题的永久解决方案。我将下面这行代码添加到我的config/environments/test.rb中。
config.active_record.maintain_test_schema = false我遇到了完全相同的问题。一时兴起,我决定运行rake db:test:prepare,它似乎为我解决了这个问题,至少是暂时的。在运行之后,我可以再次运行rake而不会出现任何问题,但是如果我再次运行它,我会遇到与以前相同的问题。我现在似乎被困在了这个循环中。This article在这个问题上提供了一些帮助,但我仍然不知道如何永久解决这个问题。
发布于 2016-03-06 03:40:07
对我来说,它是在我更新模式后修复的:
bundle exec rake db:migrate然后运行以下命令:
bundle exec rake db:schema:load如果schema.rb文件已更新,请手动检查该文件。
https://stackoverflow.com/questions/6333532
复制相似问题