【问题标题】:I cant get rspec autotest to working? (Ruby, no rails)我无法让 rspec 自动测试正常工作? (红宝石,在轨道上)
【发布时间】:2011-12-13 18:49:38
【问题描述】:

我有一个基本的 ruby​​ 项目:-

$ tree
.
├── Gemfile
├── lib
│   ├── checkout.rb
│   └── item.rb
├── README.md
└── test
    ├── checkout_spec.rb
    └── item_spec.rb

哪个可以运行 rspec 测试:-

$ rspec test/*_spec.rb
....

Finished in 0.18797 seconds
4 examples, 0 failures

但是谁想要每秒向上箭头并按回车,我想要自动测试......

但是当我运行它时,它找不到我的测试!

$ autotest -vw
No tests matched Gemfile
No tests matched README.md
No tests matched lib/checkout.rb
No tests matched lib/item.rb
No tests matched test/checkout_spec.rb
No tests matched test/item_spec.rb

然后我开始保存文件:-

{"lib/checkout.rb"=>2011-12-07 22:06:04 +0000}
No tests matched lib/checkout.rb
{"lib/checkout.rb"=>2011-12-07 22:06:04 +0000}
No tests matched lib/checkout.rb
{"test/.goutputstream-NQC45V"=>2011-12-07 22:06:20 +0000}
No tests matched test/.goutputstream-NQC45V
{"test/.goutputstream-NQC45V"=>2011-12-07 22:06:20 +0000}
No tests matched test/.goutputstream-NQC45V
{"lib/checkout.rb"=>2011-12-07 22:06:45 +0000}
No tests matched lib/checkout.rb
{"lib/checkout.rb"=>2011-12-07 22:06:45 +0000}
No tests matched lib/checkout.rb
<just sits here

我已阅读有关 .autotestspec_helper.rb 的信息,但似乎可以在正确的搜索/页面上找到目标?


编辑:锡人发现的帮助和我的布局之间明显不匹配。

但是将我的 test 更改为 tests 并没有帮助!:-

No tests matched tests/checkout_spec.rb
No tests matched tests/item_spec.rb
No tests matched tests/rule_parser_spec.rb
No tests matched tests/runner.rb
No tests matched tests/spec_helper.rb
{"lib/rule_parser.rb"=>2011-12-08 07:24:29 +0000}
No tests matched lib/rule_parser.rb
{"lib/rule_parser.rb"=>2011-12-08 07:24:29 +0000}
No tests matched lib/rule_parser.rb
{"tests/checkout_spec.rb"=>2011-12-08 07:24:35 +0000}
No tests matched tests/checkout_spec.rb
{"tests/checkout_spec.rb"=>2011-12-08 07:24:35 +0000}
No tests matched tests/checkout_spec.rb

【问题讨论】:

    标签: ruby rspec autotest


    【解决方案1】:

    我认为您应该将其更改为规范。我不使用自动测试,但最新版本的 rspec 假设您在项目的根目录中有一个规范目录。所以我猜应该自动测试。

    【讨论】:

      【解决方案2】:

      我把目录改成了spec

      现在两者都工作了! :-

      rspec
      autotest
      

      【讨论】:

        【解决方案3】:

        将您的test 目录更改为tests。那应该使自动测试更快乐。

        来自autotest --help

        假设代码在 lib 中,而测试在测试中。

        【讨论】:

        • 啊,看起来像个赢家,但是,唉,我已经更新了 OP 以显示代码输出。
        • 嗯,我认为您应该将其更改为规范。我不使用自动测试,但最新版本的 rspec 假设您在项目的根目录中有一个规范目录。所以我猜应该自动测试。
        • @lucapette 出于某种原因,我完全忽略了您的回复!因此,我的帖子正是您发布的内容!你应该把它作为一个答案,我会接受它!
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-08-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多