尝试通过 RSpec / Guard 为新站点设置开发环境。一切似乎都在工作并且测试通过了,但随后出现了一个看似与测试本身无关的错误。迄今为止,针对 Stack 上类似问题的其他解决方案已被证明是不成功的。
09:04:47 - INFO - Guard uses TerminalNotifier to send notifications.
09:04:47 - INFO - Guard uses TerminalTitle to send notifications.
09:04:47 - INFO - Guard::RSpec is running
09:04:47 - INFO - Guard is now watching at '/Users/Dan/Sites/mailapp'
09:04:51 - INFO - Running: spec/models/user_spec.rb
..........................
Finished in 0.92598 seconds
26 examples, 0 failures
Randomized with seed 33813
/Users/Dan/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/test/unit.rb:49:in `process_args': invalid option: -f (OptionParser::InvalidOption)
from /Users/Dan/.rvm/gems/ruby-1.9.3-p286@mailapp/gems/minitest-4.7.5/lib/minitest/unit.rb:1066:in `_run'
from /Users/Dan/.rvm/gems/ruby-1.9.3-p286@jurnit/gems/minitest-4.7.5/lib/minitest/unit.rb:1059:in `run'
from /Users/Dan/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/test/unit.rb:21:in `run'
from /Users/Dan/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
from /Users/Dan/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
from /Users/Dan/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
这是我当前的 Gemfile
source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '4.0.0.rc2'
gem 'mysql2'
gem 'jquery-rails'
gem 'turbolinks'
gem 'bcrypt-ruby', '3.0.1'
gem 'sass-rails', '~> 4.0.0.rc2'
gem 'coffee-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'bootstrap-sass', '2.3.1.0'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
group :development, :test do
gem 'rspec-rails'
gem 'capybara'
gem 'guard-rspec'
gem 'terminal-notifier-guard'
gem 'rb-fsevent'
end
group :test do
gem 'factory_girl_rails'
gem 'database_cleaner', github: 'bmabey/database_cleaner'
end
和 Guardfile
guard 'rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara features specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end