diff options
author | Markus Roberts <Markus@reality.com> | 2010-07-09 18:12:17 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-07-09 18:12:17 -0700 |
commit | 3180b9d9b2c844dade1d361326600f7001ec66dd (patch) | |
tree | 98fe7c5ac7eb942aac9c39f019a17b0b3f5a57f4 /spec/unit/provider/selmodule_spec.rb | |
parent | 543225970225de5697734bfaf0a6eee996802c04 (diff) | |
download | puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.tar.gz puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.tar.xz puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.zip |
Code smell: Two space indentation
Replaced 106806 occurances of ^( +)(.*$) with
The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people
who learned ruby in the 1900s) uses two-space indentation.
3 Examples:
The code:
end
# Tell getopt which arguments are valid
def test_get_getopt_args
element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new
assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")
becomes:
end
# Tell getopt which arguments are valid
def test_get_getopt_args
element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new
assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")
The code:
assert_equal(str, val)
assert_instance_of(Float, result)
end
# Now test it with a passed object
becomes:
assert_equal(str, val)
assert_instance_of(Float, result)
end
# Now test it with a passed object
The code:
end
assert_nothing_raised do
klass[:Yay] = "boo"
klass["Cool"] = :yayness
end
becomes:
end
assert_nothing_raised do
klass[:Yay] = "boo"
klass["Cool"] = :yayness
end
Diffstat (limited to 'spec/unit/provider/selmodule_spec.rb')
-rwxr-xr-x | spec/unit/provider/selmodule_spec.rb | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/spec/unit/provider/selmodule_spec.rb b/spec/unit/provider/selmodule_spec.rb index ed20ea97f..fda6d0d78 100755 --- a/spec/unit/provider/selmodule_spec.rb +++ b/spec/unit/provider/selmodule_spec.rb @@ -10,57 +10,57 @@ Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f provider_class = Puppet::Type.type(:selmodule).provider(:semodule) describe provider_class do - before :each do - @resource = stub("resource", :name => "foo") - @resource.stubs(:[]).returns "foo" - @provider = provider_class.new(@resource) - end - - describe "exists? method" do - it "should find a module if it is already loaded" do - @provider.expects(:command).with(:semodule).returns "/usr/sbin/semodule" - @provider.expects(:execpipe).with("/usr/sbin/semodule --list").yields ["bar\t1.2.3\n", "foo\t4.4.4\n", "bang\t1.0.0\n"] - @provider.exists?.should == :true - end + before :each do + @resource = stub("resource", :name => "foo") + @resource.stubs(:[]).returns "foo" + @provider = provider_class.new(@resource) + end - it "should return nil if not loaded" do - @provider.expects(:command).with(:semodule).returns "/usr/sbin/semodule" - @provider.expects(:execpipe).with("/usr/sbin/semodule --list").yields ["bar\t1.2.3\n", "bang\t1.0.0\n"] - @provider.exists?.should be_nil - end + describe "exists? method" do + it "should find a module if it is already loaded" do + @provider.expects(:command).with(:semodule).returns "/usr/sbin/semodule" + @provider.expects(:execpipe).with("/usr/sbin/semodule --list").yields ["bar\t1.2.3\n", "foo\t4.4.4\n", "bang\t1.0.0\n"] + @provider.exists?.should == :true + end - it "should return nil if no modules are loaded" do - @provider.expects(:command).with(:semodule).returns "/usr/sbin/semodule" - @provider.expects(:execpipe).with("/usr/sbin/semodule --list").yields [] - @provider.exists?.should be_nil - end + it "should return nil if not loaded" do + @provider.expects(:command).with(:semodule).returns "/usr/sbin/semodule" + @provider.expects(:execpipe).with("/usr/sbin/semodule --list").yields ["bar\t1.2.3\n", "bang\t1.0.0\n"] + @provider.exists?.should be_nil end - describe "selmodversion_file" do - it "should return 1.5.0 for the example policy file" do - @provider.expects(:selmod_name_to_filename).returns "#{File.dirname(__FILE__)}/selmodule-example.pp" - @provider.selmodversion_file.should == "1.5.0" - end + it "should return nil if no modules are loaded" do + @provider.expects(:command).with(:semodule).returns "/usr/sbin/semodule" + @provider.expects(:execpipe).with("/usr/sbin/semodule --list").yields [] + @provider.exists?.should be_nil end + end - describe "syncversion" do - it "should return :true if loaded and file modules are in sync" do - @provider.expects(:selmodversion_loaded).returns "1.5.0" - @provider.expects(:selmodversion_file).returns "1.5.0" - @provider.syncversion.should == :true - end + describe "selmodversion_file" do + it "should return 1.5.0 for the example policy file" do + @provider.expects(:selmod_name_to_filename).returns "#{File.dirname(__FILE__)}/selmodule-example.pp" + @provider.selmodversion_file.should == "1.5.0" + end + end - it "should return :false if loaded and file modules are not in sync" do - @provider.expects(:selmodversion_loaded).returns "1.4.0" - @provider.expects(:selmodversion_file).returns "1.5.0" - @provider.syncversion.should == :false - end + describe "syncversion" do + it "should return :true if loaded and file modules are in sync" do + @provider.expects(:selmodversion_loaded).returns "1.5.0" + @provider.expects(:selmodversion_file).returns "1.5.0" + @provider.syncversion.should == :true + end - it "should return before checking file version if no loaded policy" do - @provider.expects(:selmodversion_loaded).returns nil - @provider.syncversion.should == :false - end + it "should return :false if loaded and file modules are not in sync" do + @provider.expects(:selmodversion_loaded).returns "1.4.0" + @provider.expects(:selmodversion_file).returns "1.5.0" + @provider.syncversion.should == :false + end + it "should return before checking file version if no loaded policy" do + @provider.expects(:selmodversion_loaded).returns nil + @provider.syncversion.should == :false end + end + end |