rspec 问题“无效选项:--autotest (OptionParser::InvalidOption)”
当我
bundle exec rake spec
/Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/option_parser.rb:18:in `parse!': invalid option: --autotest (OptionParser::InvalidOption)
from /Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/option_parser.rb:4:in `parse!'
from /Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/configuration_options.rb:104:in `options_from'
from /Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/configuration_options.rb:100:in `global_options'
from /Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/configuration_options.rb:65:in `parse_options'
from /Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:41:in `run'
from /Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:10:in `block in autorun'
我不确定问题是什么。我尝试卸载我的 gems 并重新安装它们。我尝试过不同版本的 rspec2。相同的应用程序的规格曾经对我有用。我不知道可能发生了什么变化导致了这个错误。
有什么想法吗?
I keep getting an issue with rspec when I
bundle exec rake spec
/Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/option_parser.rb:18:in `parse!': invalid option: --autotest (OptionParser::InvalidOption)
from /Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/option_parser.rb:4:in `parse!'
from /Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/configuration_options.rb:104:in `options_from'
from /Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/configuration_options.rb:100:in `global_options'
from /Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/configuration_options.rb:65:in `parse_options'
from /Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:41:in `run'
from /Users/sean/.rvm/gems/ruby-1.9.2-p0@hub/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:10:in `block in autorun'
I'm not sure what the problem is. I have tried uninstalling my gems and reinstalling them. I've tried different versions of rspec2. The same application's specs used to work for me. I have no idea what might have changed that introduced this error.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
./.rspec
中是否定义了此选项?:--autotest
如果是,请将其删除。
编辑
<罢工>
自动测试现在在
./autotest/discover.rb
中配置,其中应包含:似乎不再需要这样做。看看大卫的回答
Do you have this option defined in
./.rspec
?:--autotest
If so, remove it.
EDIT
Autotest is now configured in
./autotest/discover.rb
, which should contain:Seems this is no longer necessary. See David's answer
事实上,你甚至不需要那个。您只需要在项目根目录中添加一个 .rspec 文件(可以有选项也可以为空)来添加“rspec2”发现,并且“rails”会根据类似 Rails 的目录来发现结构。
Actually, you don't even need that. All you need is a
.rspec
file in the project root directory (it can have options or be empty) to add the "rspec2" discovery, and "rails" gets discovered based on a rails-like directory structure.