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/type/mcx_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/type/mcx_spec.rb')
-rwxr-xr-x | spec/unit/type/mcx_spec.rb | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/spec/unit/type/mcx_spec.rb b/spec/unit/type/mcx_spec.rb index 8b5dfb073..703ecb473 100755 --- a/spec/unit/type/mcx_spec.rb +++ b/spec/unit/type/mcx_spec.rb @@ -28,73 +28,73 @@ mcx_type = Puppet::Type.type(:mcx) describe mcx_type, "when validating attributes" do - properties = [:ensure, :content] - parameters = [:name, :ds_type, :ds_name] - - parameters.each do |p| - it "should have a #{p} parameter" do - mcx_type.attrclass(p).ancestors.should be_include(Puppet::Parameter) - end - it "should have documentation for its #{p} parameter" do - mcx_type.attrclass(p).doc.should be_instance_of(String) - end + properties = [:ensure, :content] + parameters = [:name, :ds_type, :ds_name] + + parameters.each do |p| + it "should have a #{p} parameter" do + mcx_type.attrclass(p).ancestors.should be_include(Puppet::Parameter) + end + it "should have documentation for its #{p} parameter" do + mcx_type.attrclass(p).doc.should be_instance_of(String) end + end - properties.each do |p| - it "should have a #{p} property" do - mcx_type.attrclass(p).ancestors.should be_include(Puppet::Property) - end - it "should have documentation for its #{p} property" do - mcx_type.attrclass(p).doc.should be_instance_of(String) - end + properties.each do |p| + it "should have a #{p} property" do + mcx_type.attrclass(p).ancestors.should be_include(Puppet::Property) end + it "should have documentation for its #{p} property" do + mcx_type.attrclass(p).doc.should be_instance_of(String) + end + end end describe mcx_type, "default values" do - before :each do - provider_class = mcx_type.provider(mcx_type.providers[0]) - mcx_type.stubs(:defaultprovider).returns provider_class - end + before :each do + provider_class = mcx_type.provider(mcx_type.providers[0]) + mcx_type.stubs(:defaultprovider).returns provider_class + end - it "should be nil for :ds_type" do - mcx_type.new(:name => '/Foo/bar')[:ds_type].should be_nil - end + it "should be nil for :ds_type" do + mcx_type.new(:name => '/Foo/bar')[:ds_type].should be_nil + end - it "should be nil for :ds_name" do - mcx_type.new(:name => '/Foo/bar')[:ds_name].should be_nil - end + it "should be nil for :ds_name" do + mcx_type.new(:name => '/Foo/bar')[:ds_name].should be_nil + end - it "should be nil for :content" do - mcx_type.new(:name => '/Foo/bar')[:content].should be_nil - end + it "should be nil for :content" do + mcx_type.new(:name => '/Foo/bar')[:content].should be_nil + end end describe mcx_type, "when validating properties" do - before :each do - provider_class = mcx_type.provider(mcx_type.providers[0]) - mcx_type.stubs(:defaultprovider).returns provider_class - end - - it "should be able to create an instance" do - lambda { - mcx_type.new(:name => '/Foo/bar') - }.should_not raise_error - end - - it "should support :present as a value to :ensure" do - lambda { - mcx_type.new(:name => "/Foo/bar", :ensure => :present) - }.should_not raise_error - end - - it "should support :absent as a value to :ensure" do - lambda { - mcx_type.new(:name => "/Foo/bar", :ensure => :absent) - }.should_not raise_error - end + before :each do + provider_class = mcx_type.provider(mcx_type.providers[0]) + mcx_type.stubs(:defaultprovider).returns provider_class + end + + it "should be able to create an instance" do + lambda { + mcx_type.new(:name => '/Foo/bar') + }.should_not raise_error + end + + it "should support :present as a value to :ensure" do + lambda { + mcx_type.new(:name => "/Foo/bar", :ensure => :present) + }.should_not raise_error + end + + it "should support :absent as a value to :ensure" do + lambda { + mcx_type.new(:name => "/Foo/bar", :ensure => :absent) + }.should_not raise_error + end end |