自动测试、RSpec 2 和 Ruby 1.9.2-p0 - 根本没有输出
我已经开始了用 Ruby 进行连续测试(B2.0 打印)一书,但遇到了迫在眉睫的问题。根据第一章,我使用 Jeweler 1.5.1 创建了一个空 Gem 使用
$ jeweler --rspec twits
rake 手动运行规范给出了正确的失败输出
$ rake spec (in /Users/mfurtak/Documents/Programming/Ruby/twits) /Users/mfurtak/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -S bundle exec rspec "spec/twits_spec.rb" F Failures: 1) Twits fails Failure/Error: fail "Trying to get this working" Trying to get this working # ./spec/twits_spec.rb:5:in `block (2 levels) in ' Finished in 0.00176 seconds 1 example, 1 failure rake aborted!
为了为 RSpec 2 配置自动测试,我创建了 ./autotest/discover.rb 在我的项目的根目录中,如书中所述和 其他地方包含以下内容:
Autotest.add_discovery { "rspec2" }
但是当我尝试通过自动测试(ZenTest 4.4.0)运行RSpec(2.2.0)规范时,我根本没有得到任何输出。
$ autotest
这都是通过 RVM (1.0.2) 使用 Ruby 1.9.2-p0。如果我切换到 Ruby 1.8.7-p302,一切都会按预期进行。
$ autotest loading autotest/rspec2 bundle exec /Users/mfurtak/.rvm/rubies/ruby-1.8.7-p302/bin/ruby -S /Users/mfurtak/.rvm/gems/ruby-1.8.7-p302/gems/rspec-core-2.2.1/bin/rspec --tty '/Users/mfurtak/Documents/Programming/Ruby/twits/spec/twits_spec.rb' F Failures: 1) Twits fails Failure/Error: fail "Trying to get this working" Trying to get this working # ./spec/twits_spec.rb:5 Finished in 0.00036 seconds 1 example, 1 failure
I have started the book Continuous Testing with Ruby (B2.0 printing), but am running into immediate problems. Per the first chapter, I have created an empty Gem using Jeweler 1.5.1
$ jeweler --rspec twits
Running the specs manually with rake gives the correct failing output
$ rake spec (in /Users/mfurtak/Documents/Programming/Ruby/twits) /Users/mfurtak/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -S bundle exec rspec "spec/twits_spec.rb" F Failures: 1) Twits fails Failure/Error: fail "Trying to get this working" Trying to get this working # ./spec/twits_spec.rb:5:in `block (2 levels) in ' Finished in 0.00176 seconds 1 example, 1 failure rake aborted!
To get Autotest configured for RSpec 2, I have created ./autotest/discover.rb in the root of my project as described in the book and elsewhere with the following contents:
Autotest.add_discovery { "rspec2" }
But when I attempt to run the RSpec (2.2.0) specs through autotest (ZenTest 4.4.0), I get no output at all.
$ autotest
This is all using Ruby 1.9.2-p0 through RVM (1.0.2). If I switch to Ruby 1.8.7-p302, things work as expected.
$ autotest loading autotest/rspec2 bundle exec /Users/mfurtak/.rvm/rubies/ruby-1.8.7-p302/bin/ruby -S /Users/mfurtak/.rvm/gems/ruby-1.8.7-p302/gems/rspec-core-2.2.1/bin/rspec --tty '/Users/mfurtak/Documents/Programming/Ruby/twits/spec/twits_spec.rb' F Failures: 1) Twits fails Failure/Error: fail "Trying to get this working" Trying to get this working # ./spec/twits_spec.rb:5 Finished in 0.00036 seconds 1 example, 1 failure
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
=]
我创建了这个 gem,它是自动测试的替代品,我认为它可以帮助解决您的问题。
称为无限测试。 (需要 RVM 可以吗?)
有关更多信息,请参阅:
https://github.com/tomas-stefano/infinity_test< /a>
如果您有任何问题,请在 gitub 中告诉我,我会帮助您! =)
=]
I created this gem that is an alternative to Autotest that I think will help with your problem.
Called InfinityTest. (need RVM ok?)
For more information see:
https://github.com/tomas-stefano/infinity_test
If you have any problem let me know in gitub that I'll help you! =)
注意到此 wiki 页面 上对 autotest 的斜体强调,我卸载了 ZenTest (4.4.0) gem 并安装了 autotest (4.4.5) gem。之后,
Ruby 1.9.2-p0 和 Ruby 1.8.7-p302 中的一切都可以正常工作
Noting the italic emphasis on autotest on this wiki page, I uninstalled the ZenTest (4.4.0) gem and instead installed the autotest (4.4.5) gem. After that and a
things are working correctly in both Ruby 1.9.2-p0 and Ruby 1.8.7-p302