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/package/hpux_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/package/hpux_spec.rb')
-rw-r--r-- | spec/unit/provider/package/hpux_spec.rb | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/spec/unit/provider/package/hpux_spec.rb b/spec/unit/provider/package/hpux_spec.rb index 8343c6052..e4ac22e21 100644 --- a/spec/unit/provider/package/hpux_spec.rb +++ b/spec/unit/provider/package/hpux_spec.rb @@ -5,48 +5,48 @@ require File.dirname(__FILE__) + '/../../../spec_helper' provider_class = Puppet::Type.type(:package).provider(:hpux) describe provider_class do - before(:each) do - # Create a mock resource - @resource = stub 'resource' - - # A catch all; no parameters set - @resource.stubs(:[]).returns(nil) - - # But set name and source - @resource.stubs(:[]).with(:name).returns "mypackage" - @resource.stubs(:[]).with(:source).returns "mysource" - @resource.stubs(:[]).with(:ensure).returns :installed - - @provider = provider_class.new - @provider.stubs(:resource).returns @resource - end - - it "should have an install method" do - @provider = provider_class.new - @provider.should respond_to(:install) - end - - it "should have an uninstall method" do - @provider = provider_class.new - @provider.should respond_to(:uninstall) - end - - it "should have a swlist method" do - @provider = provider_class.new - @provider.should respond_to(:swlist) - end - - describe "when installing" do - it "should use a command-line like 'swinstall -x mount_all_filesystems=false -s SOURCE PACKAGE-NAME'" do - @provider.expects(:swinstall).with('-x', 'mount_all_filesystems=false', '-s', 'mysource', 'mypackage') - @provider.install - end + before(:each) do + # Create a mock resource + @resource = stub 'resource' + + # A catch all; no parameters set + @resource.stubs(:[]).returns(nil) + + # But set name and source + @resource.stubs(:[]).with(:name).returns "mypackage" + @resource.stubs(:[]).with(:source).returns "mysource" + @resource.stubs(:[]).with(:ensure).returns :installed + + @provider = provider_class.new + @provider.stubs(:resource).returns @resource + end + + it "should have an install method" do + @provider = provider_class.new + @provider.should respond_to(:install) + end + + it "should have an uninstall method" do + @provider = provider_class.new + @provider.should respond_to(:uninstall) + end + + it "should have a swlist method" do + @provider = provider_class.new + @provider.should respond_to(:swlist) + end + + describe "when installing" do + it "should use a command-line like 'swinstall -x mount_all_filesystems=false -s SOURCE PACKAGE-NAME'" do + @provider.expects(:swinstall).with('-x', 'mount_all_filesystems=false', '-s', 'mysource', 'mypackage') + @provider.install end + end - describe "when uninstalling" do - it "should use a command-line like 'swremove -x mount_all_filesystems=false PACKAGE-NAME'" do - @provider.expects(:swremove).with('-x', 'mount_all_filesystems=false', 'mypackage') - @provider.uninstall - end + describe "when uninstalling" do + it "should use a command-line like 'swremove -x mount_all_filesystems=false PACKAGE-NAME'" do + @provider.expects(:swremove).with('-x', 'mount_all_filesystems=false', 'mypackage') + @provider.uninstall end + end end |