2011-11-29 14 views
7

私はドキュメントを見てきましたが、複数のフィルタの仕組みの説明には少し欠けているようです。誰もが良い説明や複数のフィルタの動作の良い説明のソースを持っていますか?リストに記載されている順序は重要ですか?あなたがラインの複数を書いた場合はここで1が期待できるもの以外の行動を持っている可能性のあるコードの例は、このを試す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」行単純な行為に複数の引数のように思えるです回。両方のタグがリストされているサンプルのみを除外(または実行します)するように、フィルターチェックを実際に組み合わせる方法はありますか?これで、コマンドラインから

+0

ような何かをすると便利場合はI /のみ/フォーカスされた項目を実行したい場合は、 "filter_run_excluding:focus => false"を使用する方が良いでしょうか?私は追加のfilter_runsが "filter_run:focus => true"に関係なく項目を追加すると仮定します。 – GlyphGryph

+0

私はこの同じ質問があります。あなたは解決策を見つけましたか? – Mike

+0

これは答えを参照してください: http://stackoverflow.com/questions/5628880/can-i-use-multiple-exclusion-filters-in-rspec –

答えて

3

を実行し、複数のフィルタ:

rspec spec --tag my_tag --tag my_second_tag -- tag ~my_third_tag 

〜ので、それらのタグを持つすべてのスペックを除外しますその

rspec spec --tag ~long_runing 
+0

本当に、質問に答えません。 – Mike