diff options
author | Markus Roberts <Markus@reality.com> | 2010-06-23 15:51:08 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-06-23 22:27:29 -0700 |
commit | 51b70c05167399eb2274fc1add18b6b18d31429d (patch) | |
tree | 1a33b11f0f589d6f5cd806d6da9de317887ca0e6 /spec/unit/provider/selboolean_spec.rb | |
parent | 9958c805dd90acadbb56ed3095e665d8afa990cd (diff) | |
download | puppet-51b70c05167399eb2274fc1add18b6b18d31429d.tar.gz puppet-51b70c05167399eb2274fc1add18b6b18d31429d.tar.xz puppet-51b70c05167399eb2274fc1add18b6b18d31429d.zip |
[#3994] rename the specs to have _spec.rb at the end
Some spec files like active_record.rb had names that would confuse the
load path and get loaded instead of the intended implentation when the
spec was run from the same directory as the file.
Author: Matt Robinson <matt@puppetlabs.com>
Date: Fri Jun 11 15:29:33 2010 -0700
Diffstat (limited to 'spec/unit/provider/selboolean_spec.rb')
-rwxr-xr-x | spec/unit/provider/selboolean_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/unit/provider/selboolean_spec.rb b/spec/unit/provider/selboolean_spec.rb new file mode 100755 index 000000000..2004485ca --- /dev/null +++ b/spec/unit/provider/selboolean_spec.rb @@ -0,0 +1,37 @@ +#!/usr/bin/env ruby + +Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") } + +provider_class = Puppet::Type.type(:selboolean).provider(:getsetsebool) + +describe provider_class do + before :each do + @resource = stub("resource", :name => "foo") + @resource.stubs(:[]).returns "foo" + @provider = provider_class.new(@resource) + end + + it "should return :on when getsebool returns on" do + @provider.expects(:getsebool).with("foo").returns "foo --> on\n" + @provider.value.should == :on + end + + it "should return :off when getsebool returns on" do + @provider.expects(:getsebool).with("foo").returns "foo --> off\n" + @provider.value.should == :off + end + + it "should call execpipe when updating boolean setting" do + @provider.expects(:command).with(:setsebool).returns "/usr/sbin/setsebool" + @provider.expects(:execpipe).with("/usr/sbin/setsebool foo off") + @provider.value = :off + end + + it "should call execpipe with -P when updating persistent boolean setting" do + @resource.stubs(:[]).with(:persistent).returns :true + @provider.expects(:command).with(:setsebool).returns "/usr/sbin/setsebool" + @provider.expects(:execpipe).with("/usr/sbin/setsebool -P foo off") + @provider.value = :off + end + +end |