|
3 | 3 | require 'puppet/confiner'
|
4 | 4 |
|
5 | 5 | describe Puppet::Confiner do
|
| 6 | + let(:coll) { Puppet::ConfineCollection.new('') } |
| 7 | + |
6 | 8 | before do
|
7 | 9 | @object = Object.new
|
8 | 10 | @object.extend(Puppet::Confiner)
|
|
21 | 23 | end
|
22 | 24 |
|
23 | 25 | it "should delegate its confine method to its confine collection" do
|
24 |
| - coll = double('collection') |
25 | 26 | allow(@object).to receive(:confine_collection).and_return(coll)
|
26 | 27 | expect(coll).to receive(:confine).with(:foo => :bar, :bee => :baz)
|
27 | 28 | @object.confine(:foo => :bar, :bee => :baz)
|
|
39 | 40 |
|
40 | 41 | describe "when testing suitability" do
|
41 | 42 | before do
|
42 |
| - @coll = double('collection') |
43 |
| - allow(@object).to receive(:confine_collection).and_return(@coll) |
| 43 | + allow(@object).to receive(:confine_collection).and_return(coll) |
44 | 44 | end
|
45 | 45 |
|
46 | 46 | it "should return true if the confine collection is valid" do
|
47 |
| - expect(@coll).to receive(:valid?).and_return(true) |
| 47 | + expect(coll).to receive(:valid?).and_return(true) |
48 | 48 | expect(@object).to be_suitable
|
49 | 49 | end
|
50 | 50 |
|
51 | 51 | it "should return false if the confine collection is invalid" do
|
52 |
| - expect(@coll).to receive(:valid?).and_return(false) |
| 52 | + expect(coll).to receive(:valid?).and_return(false) |
53 | 53 | expect(@object).not_to be_suitable
|
54 | 54 | end
|
55 | 55 |
|
56 | 56 | it "should return the summary of the confine collection if a long result is asked for" do
|
57 |
| - expect(@coll).to receive(:summary).and_return("myresult") |
| 57 | + expect(coll).to receive(:summary).and_return("myresult") |
58 | 58 | expect(@object.suitable?(false)).to eq("myresult")
|
59 | 59 | end
|
60 | 60 | end
|
|
0 commit comments