结合RSpec过滤器?
问题描述:
我一直在浏览文档,但多个过滤器的工作原理似乎有点欠缺。有没有人有一个很好的解释或多个过滤器的行为很好的解释来源?他们列出的订单是否重要?下面是可能有比人能想到其他行为的代码示例...结合RSpec过滤器?
Rspec.configure do |c|
this_version = get_version_number.to_sym
c.filter_run :focus=> true
c.filter_run_excluding :limit_to=>true, this_version => false
c.filter_run :new_stuff=>true
c.run_all_when_everything_filtered
end
it "is focused, but not new", :focus
it "is is new", :new_stuff
it "is new and focused", :new_stuff, :focus
it "is focused and new, but limited to a different version", :focus, :limit_to, :correct_version
这个做实验,这也似乎是对“filter_run_excluding”行简单动作的多个参数是,如果你写的多线倍。有没有办法让它真正地结合过滤器检查,以便它排除(或运行,我想)只有两个标签列出的例子?在命令行
答
运行多个过滤器与此:
rspec spec --tag my_tag --tag my_second_tag -- tag ~my_third_tag
了〜会排除与这些标签的任何规范,所以它经常有用到这样做
rspec spec --tag ~long_runing
+0
虽然是真的,不回答的问题。 – Mike
如果I /只/想运行焦点项目,使用“filter_run_excluding:focus => false”会更好吗?我认为不管“filter_run:focus => true”,额外的filter_runs都会添加项目,对吗? – GlyphGryph
我有同样的问题。你有没有找到解决方案? – Mike
这看起来像回答: http://*.com/questions/5628880/can-i-use-multiple-exclusion-filters-in-rspec –