【问题标题】:rspec with --tag option runs different test than spring rspec with same --tag option带有 --tag 选项的 rspec 与带有相同 --tag 选项的 spring rspec 运行不同的测试
【发布时间】:2014-10-20 02:11:29
【问题描述】:

当我跑步时

spring rspec --tag ~slow

我的测试都没有运行,我看到了这个意外的输出:

Run options:
  include {:focus=>true}
  exclude {:slow=>true}

All examples were filtered out; ignoring {:focus=>true}

All examples were filtered out

Finished in 0.21728 seconds (files took 0.43359 seconds to load)
0 examples, 0 failures

当我跑步时:

rspec --tag ~slow

我看到以下预期的测试集运行:

Run options:
  include {:focus=>true}
  exclude {:slow=>true}

All examples were filtered out; ignoring {:focus=>true}

.
. testing output remove for berevity
.


Finished in 6.9 seconds (files took 15.29 seconds to load)
179 examples, 0 failures, 4 pending

这是一个我可以解决的问题吗?或者,如果我想使用 spring,我是否必须放弃使用 --tags ?

TL;DR:似乎我必须在使用 Spring 节省时间或节省时间跳过缓慢的 rspec 测试之间做出选择。不能两者兼得。

附录: 在此处提交 Spring 问题:https://github.com/rails/spring/issues/359

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4 rspec rspec-rails


    【解决方案1】:

    现在可以了:

      time spring rspec ./spec --tag speed:slow  
      time spring rspec ./spec --tag ~speed:slow 
    

    似乎添加“./spec”是必要的更改。

    使用:
    * 春天 (1.2.0)
    * spring-commands-rspec (1.0.2)
    * rspec-collection_matchers (1.0.0)
    * rspec-core (3.0.4)
    * rspec 期望 (3.0.4)
    * rspec 模拟 (3.0.4)
    * rspec-rails (3.0.2)
    * rspec 支持 (3.0.4)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多