RSpec 错误 - “无效选项”

发布于 2024-10-17 15:46:29 字数 1740 浏览 7 评论 0原文

在使用自动测试运行 RSpec 时,我不断遇到问题。我的 ~/.autotest 文件看起来像这样:

require 'autotest/growl' 
require 'autotest/fsevent' 
Autotest.add_hook :initialize do |autotest| 
        autotest.add_mapping(/^spec\/requests\/.*_spec\.rb$/) do 
        autotest.files_matching(/^spec\/requests\/.*_spec\.rb$/) 
        end 
end 

对出了什么问题有什么想法吗?

bundle exec /Users/TTS/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -S /Users/ 
TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.3.1/bin/rspec --tty '/ 
Users/TTS/Rails/sample_app/spec/controllers/pages_controller_spec.rb' 
'/Users/TTS/Rails/sample_app/spec/controllers/ 
sessions_controller_spec.rb' '/Users/TTS/Rails/sample_app/spec/ 
controllers/users_controller_spec.rb' '/Users/TTS/Rails/sample_app/ 
spec/models/user_spec.rb' '/Users/TTS/Rails/sample_app/spec/requests/ 
layout_links_spec.rb' '/Users/TTS/Rails/sample_app/spec/requests/ 
users_spec.rb' 
/Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.0.1/lib/rspec/ 
core/option_parser.rb:18:in `parse!': invalid option: --tty 
(OptionParser::InvalidOption) 
        from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.0.1/lib/ 
rspec/core/option_parser.rb:4:in `parse!' 
        from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.0.1/lib/ 
rspec/core/configuration_options.rb:64:in `parse_command_line_options' 
        from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.0.1/lib/ 
rspec/core/configuration_options.rb:46:in `parse_options' 
        from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.0.1/lib/ 
rspec/core/runner.rb:41:in `run' 
        from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.0.1/lib/ 
rspec/core/runner.rb:10:in `block in autorun'

I keep getting an issue when running RSpec with Autotest. My
~/.autotest file looks like this:

require 'autotest/growl' 
require 'autotest/fsevent' 
Autotest.add_hook :initialize do |autotest| 
        autotest.add_mapping(/^spec\/requests\/.*_spec\.rb$/) do 
        autotest.files_matching(/^spec\/requests\/.*_spec\.rb$/) 
        end 
end 

Any thoughts on what's wrong?

bundle exec /Users/TTS/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -S /Users/ 
TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.3.1/bin/rspec --tty '/ 
Users/TTS/Rails/sample_app/spec/controllers/pages_controller_spec.rb' 
'/Users/TTS/Rails/sample_app/spec/controllers/ 
sessions_controller_spec.rb' '/Users/TTS/Rails/sample_app/spec/ 
controllers/users_controller_spec.rb' '/Users/TTS/Rails/sample_app/ 
spec/models/user_spec.rb' '/Users/TTS/Rails/sample_app/spec/requests/ 
layout_links_spec.rb' '/Users/TTS/Rails/sample_app/spec/requests/ 
users_spec.rb' 
/Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.0.1/lib/rspec/ 
core/option_parser.rb:18:in `parse!': invalid option: --tty 
(OptionParser::InvalidOption) 
        from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.0.1/lib/ 
rspec/core/option_parser.rb:4:in `parse!' 
        from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.0.1/lib/ 
rspec/core/configuration_options.rb:64:in `parse_command_line_options' 
        from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.0.1/lib/ 
rspec/core/configuration_options.rb:46:in `parse_options' 
        from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.0.1/lib/ 
rspec/core/runner.rb:41:in `run' 
        from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.0.1/lib/ 
rspec/core/runner.rb:10:in `block in autorun'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

懒猫 2024-10-24 15:46:29

FWIW,我的 .autotest 文件与你的相同,所以这不是问题。你能验证你正在运行什么自动测试 gem 吗? (我的版本是 4.4.6,运行良好。)

FWIW, my .autotest file is identical to yours, so that's not the problem. Can you verify what autotest gem you are running? (Mine is at 4.4.6 and is working fine.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文