gpt4 book ai didi

ruby-on-rails - Rails 和 RSpec : `rake spec` runs all specs twice

转载 作者:行者123 更新时间:2023-12-03 16:04:47 27 4
gpt4 key购买 nike

我使用 RSpec 设置了一个新的 Rails 4 应用程序。但是运行时rake rspec ,所有示例都运行两次:

rake spec
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
/Users/josh/.rvm/rubies/ruby-2.0.0-p353/bin/ruby -S rspec ./spec/controllers/dashboards_controller_spec.rb ./spec/models/member_spec.rb ./spec/requests/members_spec.rb ./spec/routing/members_routing_spec.rb
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
11/11 |============================================ 100 ============================================>| Time: 00:00:00

Finished in 0.21233 seconds
11 examples, 0 failures

Randomized with seed 15954

/Users/josh/.rvm/rubies/ruby-2.0.0-p353/bin/ruby -S rspec ./spec/controllers/dashboards_controller_spec.rb ./spec/models/member_spec.rb ./spec/requests/members_spec.rb ./spec/routing/members_routing_spec.rb
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
11/11 |============================================ 100 ============================================>| Time: 00:00:00

Finished in 0.18831 seconds
11 examples, 0 failures

Randomized with seed 24248

我发现了一些其他(旧)问题,但找不到适合我的解决方案。我应该如何尝试调试这个?运行 rspec很有魅力,但我很想找出这里的问题所在。

这是我的 spec_helper.rb :
https://github.com/jmuheim/transition/blob/master/spec/spec_helper.rb

这是原始的 Rails 项目:
https://github.com/jmuheim/transition

更新

我发现 spec rake 任务似乎被定义了两次(注意分隔每个任务描述的 /):
$ rake -T | grep spec
...
rake spec # Run all specs in spec directory (excluding plugin specs) / Run RSpec code examples
...

其中之一描述为 Run all specs in spec directory (excluding plugin specs) , 与 Run RSpec code examples 之一.
Run RSpec code examples似乎来自 rspec/core/rake_task.rb . Run all specs in spec directory (excluding plugin specs)似乎来自 rspec/rails/tasks/rspec.rake .

在我看来应该只有其中一个存在?!

更新 2
rspec-rails好像有问题两者都在 testdevelopment组。我在这里添加了一个问题: https://github.com/rspec/rspec-rails/issues/904

最佳答案

对我来说,这是由于我的 .rspec 文件中有重复的条目。无法判断这是否是这里的问题,因为 .rspec 文件在 .gitignore 中,但基本上如果你这样做:

-- format progress
-- format documentation

在您的 rspec 文件中,您将看到两次测试输出。

关于ruby-on-rails - Rails 和 RSpec : `rake spec` runs all specs twice,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20872977/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com