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/spec_specs | |
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/spec_specs')
-rw-r--r-- | spec/spec_specs/runnable_spec.rb | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/spec/spec_specs/runnable_spec.rb b/spec/spec_specs/runnable_spec.rb index fd2e48888..da4faca4e 100644 --- a/spec/spec_specs/runnable_spec.rb +++ b/spec/spec_specs/runnable_spec.rb @@ -1,95 +1,95 @@ require File.dirname(__FILE__) + '/../spec_helper' describe PuppetTest::RunnableTest do - before do - @runnable_test = Class.new.extend(PuppetTest::RunnableTest) - end - - describe "#confine" do - subject { @runnable_test } + before do + @runnable_test = Class.new.extend(PuppetTest::RunnableTest) + end - it "should accept a hash" do - subject.confine({}).should_not raise_error(ArgumentError) - end + describe "#confine" do + subject { @runnable_test } - it "should accept a message and a block" do - subject.confine(""){}.should_not raise_error(ArgumentError) - end + it "should accept a hash" do + subject.confine({}).should_not raise_error(ArgumentError) + end + it "should accept a message and a block" do + subject.confine(""){}.should_not raise_error(ArgumentError) end - describe "#runnable?" do - describe "when the superclass is not runnable" do - before { @runnable_test.stubs(:superclass).returns(stub("unrunnable superclass", :runnable? => false)) } - subject { @runnable_test.runnable? } + end - it { should be_false } - end + describe "#runnable?" do + describe "when the superclass is not runnable" do + before { @runnable_test.stubs(:superclass).returns(stub("unrunnable superclass", :runnable? => false)) } + subject { @runnable_test.runnable? } - describe "when a confine is false" do - before { @runnable_test.confine(:message => false) } - subject { @runnable_test.runnable? } + it { should be_false } + end - it { should be_false } - end + describe "when a confine is false" do + before { @runnable_test.confine(:message => false) } + subject { @runnable_test.runnable? } - describe "when a confine has a block that returns false" do - before { @runnable_test.confine(:message){ false } } - subject { @runnable_test.runnable? } + it { should be_false } + end - it { should be_false } - end + describe "when a confine has a block that returns false" do + before { @runnable_test.confine(:message){ false } } + subject { @runnable_test.runnable? } - describe "when a confine is true and no false confines" do - before { @runnable_test.confine(:message => true) } - subject { @runnable_test.runnable? } + it { should be_false } + end - it { should be_true } - end + describe "when a confine is true and no false confines" do + before { @runnable_test.confine(:message => true) } + subject { @runnable_test.runnable? } - describe "when a confine has block that returns true and no false confines" do - before { @runnable_test.confine(:message){ true } } - subject { @runnable_test.runnable? } + it { should be_true } + end - it { should be_true } - end + describe "when a confine has block that returns true and no false confines" do + before { @runnable_test.confine(:message){ true } } + subject { @runnable_test.runnable? } + it { should be_true } end - describe "#messages" do - describe "before runnable? is called" do - subject { @runnable_test.messages } + end - it { should == [] } - end + describe "#messages" do + describe "before runnable? is called" do + subject { @runnable_test.messages } - describe "when runnable? is called and returns false" do - before do - @runnable_test.confine(:message => false) - @runnable_test.runnable? - end + it { should == [] } + end - subject { @runnable_test.messages } + describe "when runnable? is called and returns false" do + before do + @runnable_test.confine(:message => false) + @runnable_test.runnable? + end - it "should include the failed confine's message" do - should include(:message) - end + subject { @runnable_test.messages } - end + it "should include the failed confine's message" do + should include(:message) + end - describe "when runnable? is called whose block returns false" do - before do - @runnable_test.confine(:message){ false } - @runnable_test.runnable? - end + end - subject { @runnable_test.messages } + describe "when runnable? is called whose block returns false" do + before do + @runnable_test.confine(:message){ false } + @runnable_test.runnable? + end - it "should include the failed confine's message" do - should include(:message) - end + subject { @runnable_test.messages } - end + it "should include the failed confine's message" do + should include(:message) + end end + + end end |