rspec 问题“无效选项:--autotest (OptionParser::InvalidOption)”

发布于 2024-10-13 02:21:22 字数 1123 浏览 3 评论 0原文

当我

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 技术交流群。

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

发布评论

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

评论(2

向地狱狂奔 2024-10-20 02:21:22

./.rspec 中是否定义了此选项?:

--autotest

如果是,请将其删除。

编辑

<罢工>
自动测试现在在 ./autotest/discover.rb 中配置,其中应包含:

Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }

似乎不再需要这样做。看看大卫的回答

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:

Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }

Seems this is no longer necessary. See David's answer

天荒地未老 2024-10-20 02:21:22

事实上,你甚至不需要那个。您只需要在项目根目录中添加一个 .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.

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