{"id":7023,"date":"2014-05-17T00:21:24","date_gmt":"2014-05-17T00:21:24","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/17\/how-i-can-make-the-complex-filter-for-examples-collection-of-common-programming-errors\/"},"modified":"2014-05-17T00:21:24","modified_gmt":"2014-05-17T00:21:24","slug":"how-i-can-make-the-complex-filter-for-examples-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/17\/how-i-can-make-the-complex-filter-for-examples-collection-of-common-programming-errors\/","title":{"rendered":"How I can make the complex filter for examples-Collection of common programming errors"},"content":{"rendered":"<p>I try to do complex filter for examples. I have this code:<\/p>\n<pre><code>require 'rspec'\n\nRSpec.configure do |config|\n  config.treat_symbols_as_metadata_keys_with_true_values = true\n  config.filter_run :foo =&gt; true\nend\n\ndescribe 'Filtering' do\n\n  tested_text = 'foooobar'\n\n  [:foo, :bar].each do |location|\n    [:first, :second].each do |current|\n      describe 'aaa ' + location.to_s, location =&gt; true do\n\n        before :all, location =&gt; true do\n          puts location\n        end\n\n        describe 'bbbb '+ current.to_s, current =&gt; true do\n\n          before :all, current =&gt; true do\n            puts current\n          end\n\n          it 'case 1 ' do\n            puts 'case 1 ' + tested_text.to_s\n          end\n        end\n      end\n    end\n  end\n\n  after :each do\n    puts 'refresh doc'\n  end\nend\n<\/code><\/pre>\n<p>When I run &#8220;rspec, I have some output<\/p>\n<pre><code>foo\nfirst\ncase 1 foooobar\nrefresh doc\nfoo\nsecond\ncase 1 foooobar\nrefresh doc\n\n2 examples, 0 failures, 2 passed\n\nFinished in 0.006087512 seconds\n<\/code><\/pre>\n<p>But If I want run only one example and add this line to Rspec.configure<\/p>\n<pre><code>config.filter_run :first =&gt; true\n<\/code><\/pre>\n<p>And I want to get<\/p>\n<pre><code>foo\nfirst\ncase 1 foooobar\nrefresh doc\n<\/code><\/pre>\n<p>But after when I have some unexpected output<\/p>\n<pre><code>foo\nfirst\ncase 1 foooobar\nrefresh doc\nfoo\nsecond\ncase 1 foooobar\nrefresh doc\nbar\nfirst\ncase 1 foooobar\nrefresh doc\n\n3 examples, 0 failures, 3 passed\n\nFinished in 0.011501239 seconds\n<\/code><\/pre>\n<p>Does enybody know how to make it work properly? Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I try to do complex filter for examples. I have this code: require &#8216;rspec&#8217; RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.filter_run :foo =&gt; true end describe &#8216;Filtering&#8217; do tested_text = &#8216;foooobar&#8217; [:foo, :bar].each do |location| [:first, :second].each do |current| describe &#8216;aaa &#8216; + location.to_s, location =&gt; true do before :all, location =&gt; true do puts [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7023","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7023"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7023\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}