English 中文(简体)
我能够使用多种排他性过滤器。
原标题:can I use multiple exclusion filters in rspec?

在一份——书目中,Im 建立了一种排外过滤器,如:

RSpec.configure do |config|
  # we need determine this once at the very front
  # and the result be available in the instance
  server_success = server1_available?

  config.exclusion_filter = {
    :svr1 => lambda {|what|
      case what
      when :available
        !server_success
      end
    }
  }
end

其后,在档案中,我确实这样做。

describe :get_items_by_client, :svr1 => :available do

如果服务器有点,则防止试验执行。

如果我只管理光谱档案,所有工作都会受到罚款。 然而,在另一个档案中,我有类似的密码,可以控制使用不同服务器的测试,而当我操作时,我只看到每个服务器的检查都进行(我有“服务器——可用吗?”),但只有一套测试被排除在外(尽管没有服务器)。

我开始认为,你只能有一个单一的排他性过滤器,但我可以找到任何可以说话的docs。 这是否可按每个档案进行? 在一个支持档案中,我可以有一个单一的复杂过滤器,但当我只管理一个单一光谱仪时,我会怎样把它纳入其中?

理想的情况是,我想找到一个表格,每个文件都有工作,但请允许我一劳永逸地检查情况,因为这是一个比较昂贵的检查,我有这方面的几个例子。

问题回答
config.filter_run_excluding :cost => true
config.filter_run_excluding :slow => true

从事这项工作。





相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签