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 /test/ral/providers/service | |
| 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 'test/ral/providers/service')
| -rwxr-xr-x | test/ral/providers/service/base.rb | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/test/ral/providers/service/base.rb b/test/ral/providers/service/base.rb index ffaf5987e..82d36ab98 100755 --- a/test/ral/providers/service/base.rb +++ b/test/ral/providers/service/base.rb @@ -8,73 +8,73 @@ require File.dirname(__FILE__) + '/../../../lib/puppettest' require 'puppettest' class TestBaseServiceProvider < Test::Unit::TestCase - include PuppetTest + include PuppetTest - def test_base - running = tempfile + def test_base + running = tempfile - commands = {} - %w{touch rm test}.each do |c| - path = %x{which #{c}}.chomp - if path == "" - $stderr.puts "Cannot find '#{c}'; cannot test base service provider" - return - end - commands[c.to_sym] = path - end + commands = {} + %w{touch rm test}.each do |c| + path = %x{which #{c}}.chomp + if path == "" + $stderr.puts "Cannot find '#{c}'; cannot test base service provider" + return + end + commands[c.to_sym] = path + end - service = Puppet::Type.type(:service).new( + service = Puppet::Type.type(:service).new( - :name => "yaytest", :provider => :base, - :start => "#{commands[:touch]} #{running}", - :status => "#{commands[:test]} -f #{running}", + :name => "yaytest", :provider => :base, + :start => "#{commands[:touch]} #{running}", + :status => "#{commands[:test]} -f #{running}", - :stop => "#{commands[:rm]} #{running}" - ) + :stop => "#{commands[:rm]} #{running}" + ) - provider = service.provider - assert(provider, "did not get base provider") + provider = service.provider + assert(provider, "did not get base provider") - assert_nothing_raised do - provider.start - end - assert(FileTest.exists?(running), "start was not called correctly") - assert_nothing_raised do - assert_equal(:running, provider.status, "status was not returned correctly") - end - assert_nothing_raised do - provider.stop - end - assert(! FileTest.exists?(running), "stop was not called correctly") - assert_nothing_raised do - assert_equal(:stopped, provider.status, "status was not returned correctly") - end + assert_nothing_raised do + provider.start + end + assert(FileTest.exists?(running), "start was not called correctly") + assert_nothing_raised do + assert_equal(:running, provider.status, "status was not returned correctly") + end + assert_nothing_raised do + provider.stop + end + assert(! FileTest.exists?(running), "stop was not called correctly") + assert_nothing_raised do + assert_equal(:stopped, provider.status, "status was not returned correctly") end + end - # Testing #454 - def test_that_failures_propagate - nope = "/no/such/command" + # Testing #454 + def test_that_failures_propagate + nope = "/no/such/command" - service = Puppet::Type.type(:service).new( + service = Puppet::Type.type(:service).new( - :name => "yaytest", :provider => :base, - :start => nope, - :status => nope, - :stop => nope, + :name => "yaytest", :provider => :base, + :start => nope, + :status => nope, + :stop => nope, - :restart => nope - ) + :restart => nope + ) - provider = service.provider - assert(provider, "did not get base provider") + provider = service.provider + assert(provider, "did not get base provider") - # We can't fail well when status is messed up, because we depend on the return code - # of the command for data. - %w{start stop restart}.each do |command| - assert_raise(Puppet::Error, "did not throw error when #{command} failed") do - provider.send(command) - end - end + # We can't fail well when status is messed up, because we depend on the return code + # of the command for data. + %w{start stop restart}.each do |command| + assert_raise(Puppet::Error, "did not throw error when #{command} failed") do + provider.send(command) + end end + end end |
