summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2008-11-16 10:20:22 +1100
committerJames Turnbull <james@lovedthanlost.net>2008-11-16 10:20:22 +1100
commitb8ed6670cd0d77f63b153fb5d5afff41f2c03704 (patch)
treef4de9a545a9938826bbc4e7a45fd23264cd2c549 /spec/unit/provider
parent6be5ac84d6ebbf84c2c1b3f546c5f86edfbcc475 (diff)
downloadpuppet-b8ed6670cd0d77f63b153fb5d5afff41f2c03704.tar.gz
puppet-b8ed6670cd0d77f63b153fb5d5afff41f2c03704.tar.xz
puppet-b8ed6670cd0d77f63b153fb5d5afff41f2c03704.zip
Fixed #1735 and #1747 - Fixes to confine system
Diffstat (limited to 'spec/unit/provider')
-rwxr-xr-xspec/unit/provider/confine/variable.rb32
1 files changed, 13 insertions, 19 deletions
diff --git a/spec/unit/provider/confine/variable.rb b/spec/unit/provider/confine/variable.rb
index 38b3dad1c..5f4c6c7a2 100755
--- a/spec/unit/provider/confine/variable.rb
+++ b/spec/unit/provider/confine/variable.rb
@@ -27,52 +27,40 @@ describe Puppet::Provider::Confine::Variable do
@confine.name = :myvar
end
- it "should use the 'pass?' method to test validity" do
- @confine.expects(:pass?).with("foo")
- @confine.valid?
- end
-
it "should use settings if the variable name is a valid setting" do
Puppet.settings.expects(:valid?).with(:myvar).returns true
Puppet.settings.expects(:value).with(:myvar).returns "foo"
- @confine.pass?("foo")
+ @confine.valid?
end
it "should use Facter if the variable name is not a valid setting" do
Puppet.settings.expects(:valid?).with(:myvar).returns false
Facter.expects(:value).with(:myvar).returns "foo"
- @confine.pass?("foo")
+ @confine.valid?
end
- it "should return true if the value matches the facter value" do
+ it "should be valid if the value matches the facter value" do
@confine.expects(:test_value).returns "foo"
- @confine.pass?("foo").should be_true
+ @confine.should be_valid
end
it "should return false if the value does not match the facter value" do
@confine.expects(:test_value).returns "fee"
- @confine.pass?("foo").should be_false
+ @confine.should_not be_valid
end
it "should be case insensitive" do
@confine.expects(:test_value).returns "FOO"
- @confine.pass?("foo").should be_true
+ @confine.should be_valid
end
it "should not care whether the value is a string or symbol" do
@confine.expects(:test_value).returns "FOO"
- @confine.pass?(:foo).should be_true
- end
-
- it "should cache the facter value during testing" do
- Facter.expects(:value).once.returns("FOO")
-
- @confine.pass?(:foo)
- @confine.pass?(:foo)
+ @confine.should be_valid
end
it "should produce a message that the fact value is not correct" do
@@ -81,6 +69,12 @@ describe Puppet::Provider::Confine::Variable do
message.should be_include("facter")
message.should be_include("bar,bee")
end
+
+ it "should be valid if the test value matches any of the provided values" do
+ @confine = Puppet::Provider::Confine::Variable.new(%w{bar bee})
+ @confine.expects(:test_value).returns "bee"
+ @confine.should be_valid
+ end
end
describe "when summarizing multiple instances" do