Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

#prune tests with the double

  • Loading branch information...
commit d6b1dbc2b5ce84eb5082ee01abadabb06986167a 1 parent a7d6acd
@AlexKVal AlexKVal authored
Showing with 18 additions and 12 deletions.
  1. +18 −12 spec/rspec/core/filter_manager_spec.rb
View
30 spec/rspec/core/filter_manager_spec.rb
@@ -83,25 +83,31 @@ def opposite(name)
end
describe "#prune" do
+ def filterable_object_with(args = {})
+ object = double('a filterable object')
+ object.stub(:any_apply?) { |f| Metadata.new(args).any_apply?(f) }
+ object
+ end
+
it "includes objects with tags matching inclusions" do
- included = RSpec::Core::Metadata.new({:foo => :bar})
- excluded = RSpec::Core::Metadata.new
+ included = filterable_object_with({:foo => :bar})
+ excluded = filterable_object_with
filter_manager = FilterManager.new
filter_manager.include :foo => :bar
filter_manager.prune([included, excluded]).should eq([included])
end
it "excludes objects with tags matching exclusions" do
- included = RSpec::Core::Metadata.new
- excluded = RSpec::Core::Metadata.new({:foo => :bar})
+ included = filterable_object_with
+ excluded = filterable_object_with({:foo => :bar})
filter_manager = FilterManager.new
filter_manager.exclude :foo => :bar
filter_manager.prune([included, excluded]).should eq([included])
end
it "prefers exclusion when matches previously set inclusion" do
- included = RSpec::Core::Metadata.new
- excluded = RSpec::Core::Metadata.new({:foo => :bar})
+ included = filterable_object_with
+ excluded = filterable_object_with({:foo => :bar})
filter_manager = FilterManager.new
filter_manager.include :foo => :bar
filter_manager.exclude :foo => :bar
@@ -109,8 +115,8 @@ def opposite(name)
end
it "prefers inclusion when matches previously set exclusion" do
- included = RSpec::Core::Metadata.new({:foo => :bar})
- excluded = RSpec::Core::Metadata.new
+ included = filterable_object_with({:foo => :bar})
+ excluded = filterable_object_with
filter_manager = FilterManager.new
filter_manager.exclude :foo => :bar
filter_manager.include :foo => :bar
@@ -118,8 +124,8 @@ def opposite(name)
end
it "prefers previously set inclusion when exclusion matches but has lower priority" do
- included = RSpec::Core::Metadata.new({:foo => :bar})
- excluded = RSpec::Core::Metadata.new
+ included = filterable_object_with({:foo => :bar})
+ excluded = filterable_object_with
filter_manager = FilterManager.new
filter_manager.include :foo => :bar
filter_manager.exclude_with_low_priority :foo => :bar
@@ -127,8 +133,8 @@ def opposite(name)
end
it "prefers previously set exclusion when inclusion matches but has lower priority" do
- included = RSpec::Core::Metadata.new
- excluded = RSpec::Core::Metadata.new({:foo => :bar})
+ included = filterable_object_with
+ excluded = filterable_object_with({:foo => :bar})
filter_manager = FilterManager.new
filter_manager.exclude :foo => :bar
filter_manager.include_with_low_priority :foo => :bar
Please sign in to comment.
Something went wrong with that request. Please try again.