summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rwxr-xr-xspec/integration/indirector/rest.rb162
-rwxr-xr-xspec/integration/network/server/mongrel.rb18
-rwxr-xr-xspec/integration/network/server/webrick.rb14
-rwxr-xr-xspec/integration/type/file.rb2
-rwxr-xr-xspec/integration/type/tidy.rb2
-rw-r--r--spec/spec_helper.rb2
-rwxr-xr-xspec/unit/agent.rb2
-rwxr-xr-xspec/unit/configurer.rb2
-rwxr-xr-xspec/unit/daemon.rb4
-rwxr-xr-xspec/unit/indirector.rb2
-rwxr-xr-xspec/unit/indirector/active_record.rb2
-rwxr-xr-xspec/unit/indirector/catalog/active_record.rb2
-rwxr-xr-xspec/unit/indirector/catalog/compiler.rb2
-rwxr-xr-xspec/unit/indirector/file.rb2
-rwxr-xr-xspec/unit/indirector/indirection.rb12
-rwxr-xr-xspec/unit/indirector/node/ldap.rb2
-rwxr-xr-xspec/unit/indirector/node/rest.rb4
-rwxr-xr-xspec/unit/indirector/rest.rb12
-rwxr-xr-xspec/unit/indirector/ssl_file.rb2
-rw-r--r--spec/unit/network/handler/fileserver.rb2
-rwxr-xr-xspec/unit/network/http.rb6
-rwxr-xr-xspec/unit/network/http/handler.rb2
-rwxr-xr-xspec/unit/network/http/mongrel.rb30
-rwxr-xr-xspec/unit/network/http/webrick.rb10
-rwxr-xr-xspec/unit/network/rights.rb4
-rwxr-xr-xspec/unit/network/server.rb22
-rwxr-xr-xspec/unit/node/environment.rb4
-rwxr-xr-xspec/unit/node/facts.rb2
-rw-r--r--spec/unit/parser/ast.rb2
-rwxr-xr-xspec/unit/parser/ast/arithmetic_operator.rb4
-rwxr-xr-xspec/unit/parser/ast/astarray.rb20
-rwxr-xr-xspec/unit/parser/ast/boolean_operator.rb2
-rwxr-xr-xspec/unit/parser/ast/collexpr.rb12
-rwxr-xr-xspec/unit/parser/ast/comparison_operator.rb18
-rwxr-xr-xspec/unit/parser/ast/minus.rb2
-rwxr-xr-xspec/unit/parser/ast/not.rb2
-rwxr-xr-xspec/unit/parser/ast/resource_override.rb10
-rwxr-xr-xspec/unit/parser/ast/resource_reference.rb10
-rwxr-xr-xspec/unit/parser/ast/vardef.rb18
-rwxr-xr-xspec/unit/parser/collector.rb2
-rwxr-xr-xspec/unit/parser/compiler.rb12
-rw-r--r--spec/unit/parser/files.rb2
-rwxr-xr-xspec/unit/parser/functions/versioncmp.rb4
-rwxr-xr-xspec/unit/parser/interpreter.rb2
-rwxr-xr-xspec/unit/parser/lexer.rb6
-rwxr-xr-xspec/unit/parser/parser.rb26
-rwxr-xr-xspec/unit/provider/macauthorization.rb58
-rwxr-xr-xspec/unit/provider/mcx/mcxcontent.rb8
-rwxr-xr-xspec/unit/provider/package/apt.rb12
-rwxr-xr-xspec/unit/provider/package/pkgdmg.rb18
-rwxr-xr-xspec/unit/provider/selboolean.rb2
-rwxr-xr-xspec/unit/provider/selmodule.rb4
-rw-r--r--spec/unit/provider/service/daemontools.rb4
-rwxr-xr-xspec/unit/provider/service/launchd.rb30
-rw-r--r--spec/unit/provider/service/runit.rb2
-rwxr-xr-xspec/unit/provider/user/ldap.rb2
-rw-r--r--spec/unit/provider/user/user_role_add.rb2
-rwxr-xr-xspec/unit/provider/zfs/solaris.rb8
-rwxr-xr-xspec/unit/provider/zone/solaris.rb2
-rwxr-xr-xspec/unit/rails.rb26
-rwxr-xr-xspec/unit/resource/catalog.rb12
-rwxr-xr-xspec/unit/simple_graph.rb12
-rwxr-xr-xspec/unit/ssl/certificate_authority.rb4
-rwxr-xr-xspec/unit/ssl/certificate_authority/interface.rb2
-rwxr-xr-xspec/unit/ssl/certificate_factory.rb2
-rwxr-xr-xspec/unit/ssl/host.rb2
-rwxr-xr-xspec/unit/transaction/change.rb2
-rwxr-xr-xspec/unit/type.rb4
-rw-r--r--spec/unit/type/augeas.rb46
-rwxr-xr-xspec/unit/type/component.rb2
-rwxr-xr-xspec/unit/type/computer.rb22
-rwxr-xr-xspec/unit/type/file.rb4
-rwxr-xr-xspec/unit/type/file/content.rb2
-rwxr-xr-xspec/unit/type/macauthorization.rb32
-rwxr-xr-xspec/unit/type/mcx.rb4
-rwxr-xr-xspec/unit/type/tidy.rb2
-rw-r--r--spec/unit/util/cache_accumulator.rb2
-rwxr-xr-xspec/unit/util/cacher.rb10
-rw-r--r--spec/unit/util/package.rb4
-rw-r--r--spec/unit/util/selinux.rb4
-rwxr-xr-xspec/unit/util/settings.rb4
-rwxr-xr-xspec/unit/util/storage.rb10
82 files changed, 426 insertions, 426 deletions
diff --git a/spec/integration/indirector/rest.rb b/spec/integration/indirector/rest.rb
index 26f3d60a8..27ffc95fe 100755
--- a/spec/integration/indirector/rest.rb
+++ b/spec/integration/indirector/rest.rb
@@ -7,19 +7,19 @@ require 'puppet/indirector/rest'
# a fake class that will be indirected via REST
class Puppet::TestIndirectedFoo
- extend Puppet::Indirector
+ extend Puppet::Indirector
indirects :test_indirected_foo, :terminus_setting => :test_indirected_foo_terminus
-
+
attr_reader :value
-
+
def initialize(value = 0)
@value = value
end
-
+
def self.from_yaml(yaml)
YAML.load(yaml)
end
-
+
def name
"bob"
end
@@ -77,18 +77,18 @@ describe Puppet::Indirector::REST do
# do not trigger the authorization layer
Puppet::Network::HTTP::WEBrickREST.any_instance.stubs(:check_authorization).returns(true)
end
-
+
describe "when finding a model instance over REST" do
describe "when a matching model instance can be found" do
before :each do
@model_instance = Puppet::TestIndirectedFoo.new(23)
@mock_model.stubs(:find).returns @model_instance
end
-
+
it "should not fail" do
lambda { Puppet::TestIndirectedFoo.find('bar') }.should_not raise_error
end
-
+
it 'should return an instance of the model class' do
Puppet::TestIndirectedFoo.find('bar').class.should == Puppet::TestIndirectedFoo
end
@@ -97,11 +97,11 @@ describe Puppet::Indirector::REST do
@mock_model.expects(:find).with { |key, args| args[:one] == "two" and args[:three] == "four" }.returns @model_instance
Puppet::TestIndirectedFoo.find('bar', :one => "two", :three => "four")
end
-
+
it 'should return the instance of the model class associated with the provided lookup key' do
Puppet::TestIndirectedFoo.find('bar').value.should == @model_instance.value
end
-
+
it 'should set an expiration on model instance' do
Puppet::TestIndirectedFoo.find('bar').expiration.should_not be_nil
end
@@ -113,25 +113,25 @@ describe Puppet::Indirector::REST do
Puppet::TestIndirectedFoo.find('bar')
end
end
-
+
describe "when no matching model instance can be found" do
before :each do
@mock_model = stub('faked model', :name => "foo", :find => nil)
Puppet::Indirector::Request.any_instance.stubs(:model).returns(@mock_model)
end
-
+
it "should return nil" do
Puppet::TestIndirectedFoo.find('bar').should be_nil
end
end
-
+
describe "when an exception is encountered in looking up a model instance" do
before :each do
@mock_model = stub('faked model', :name => "foo")
@mock_model.stubs(:find).raises(RuntimeError)
- Puppet::Indirector::Request.any_instance.stubs(:model).returns(@mock_model)
+ Puppet::Indirector::Request.any_instance.stubs(:model).returns(@mock_model)
end
-
+
it "should raise an exception" do
lambda { Puppet::TestIndirectedFoo.find('bar') }.should raise_error(Net::HTTPError)
end
@@ -149,11 +149,11 @@ describe Puppet::Indirector::REST do
@mock_model.stubs(:render_multiple).returns @model_instances.to_yaml
end
-
+
it "should not fail" do
lambda { Puppet::TestIndirectedFoo.search('bar') }.should_not raise_error
end
-
+
it 'should return all matching results' do
Puppet::TestIndirectedFoo.search('bar').length.should == @model_instances.length
end
@@ -162,13 +162,13 @@ describe Puppet::Indirector::REST do
@mock_model.expects(:search).with { |key, args| args[:one] == "two" and args[:three] == "four" }.returns @model_instances
Puppet::TestIndirectedFoo.search("foo", :one => "two", :three => "four")
end
-
+
it 'should return model instances' do
- Puppet::TestIndirectedFoo.search('bar').each do |result|
+ Puppet::TestIndirectedFoo.search('bar').each do |result|
result.class.should == Puppet::TestIndirectedFoo
end
end
-
+
it 'should return the instance of the model class associated with the provided lookup key' do
Puppet::TestIndirectedFoo.search('bar').collect { |i| i.value }.should == @model_instances.collect { |i| i.value }
end
@@ -179,7 +179,7 @@ describe Puppet::Indirector::REST do
@mock_model = stub('faked model', :name => "foo", :find => nil)
Puppet::Indirector::Request.any_instance.stubs(:model).returns(@mock_model)
end
-
+
it "should return nil" do
Puppet::TestIndirectedFoo.find('bar').should be_nil
end
@@ -189,11 +189,11 @@ describe Puppet::Indirector::REST do
before :each do
@mock_model = stub('faked model')
@mock_model.stubs(:find).raises(RuntimeError)
- Puppet::Indirector::Request.any_instance.stubs(:model).returns(@mock_model)
+ Puppet::Indirector::Request.any_instance.stubs(:model).returns(@mock_model)
end
-
+
it "should raise an exception" do
- lambda { Puppet::TestIndirectedFoo.find('bar') }.should raise_error(Net::HTTPError)
+ lambda { Puppet::TestIndirectedFoo.find('bar') }.should raise_error(Net::HTTPError)
end
end
end
@@ -203,33 +203,33 @@ describe Puppet::Indirector::REST do
before :each do
@mock_model.stubs(:destroy).returns true
end
-
+
it "should not fail" do
lambda { Puppet::TestIndirectedFoo.destroy('bar') }.should_not raise_error
end
-
+
it 'should return success' do
Puppet::TestIndirectedFoo.destroy('bar').should == true
end
end
-
+
describe "when no matching model instance can be found" do
before :each do
@mock_model.stubs(:destroy).returns false
end
-
+
it "should return failure" do
Puppet::TestIndirectedFoo.destroy('bar').should == false
end
end
-
+
describe "when an exception is encountered in destroying a model instance" do
before :each do
@mock_model.stubs(:destroy).raises(RuntimeError)
end
-
+
it "should raise an exception" do
- lambda { Puppet::TestIndirectedFoo.destroy('bar') }.should raise_error(Net::HTTPError)
+ lambda { Puppet::TestIndirectedFoo.destroy('bar') }.should raise_error(Net::HTTPError)
end
end
end
@@ -239,43 +239,43 @@ describe Puppet::Indirector::REST do
@instance = Puppet::TestIndirectedFoo.new(42)
@mock_model.stubs(:save_object).returns @instance
@mock_model.stubs(:convert_from).returns @instance
- Puppet::Network::HTTP::WEBrickREST.any_instance.stubs(:save_object).returns(@instance)
+ Puppet::Network::HTTP::WEBrickREST.any_instance.stubs(:save_object).returns(@instance)
end
-
+
describe "when a successful save can be performed" do
before :each do
end
-
+
it "should not fail" do
lambda { @instance.save }.should_not raise_error
end
-
+
it 'should return an instance of the model class' do
@instance.save.class.should == Puppet::TestIndirectedFoo
end
-
+
it 'should return a matching instance of the model class' do
@instance.save.value.should == @instance.value
end
end
-
+
describe "when a save cannot be completed" do
before :each do
Puppet::Network::HTTP::WEBrickREST.any_instance.stubs(:save_object).returns(false)
end
-
+
it "should return failure" do
@instance.save.should == false
end
end
-
+
describe "when an exception is encountered in performing a save" do
before :each do
- Puppet::Network::HTTP::WEBrickREST.any_instance.stubs(:save_object).raises(RuntimeError)
+ Puppet::Network::HTTP::WEBrickREST.any_instance.stubs(:save_object).raises(RuntimeError)
end
-
+
it "should raise an exception" do
- lambda { @instance.save }.should raise_error(Net::HTTPError)
+ lambda { @instance.save }.should raise_error(Net::HTTPError)
end
end
end
@@ -287,7 +287,7 @@ describe Puppet::Indirector::REST do
describe "when using mongrel" do
confine "Mongrel is not available" => Puppet.features.mongrel?
-
+
before :each do
Puppet[:servertype] = 'mongrel'
@params = { :port => 34343, :handlers => [ :test_indirected_foo ] }
@@ -314,18 +314,18 @@ describe Puppet::Indirector::REST do
after do
@server.unlisten
end
-
+
describe "when finding a model instance over REST" do
describe "when a matching model instance can be found" do
before :each do
@model_instance = Puppet::TestIndirectedFoo.new(23)
@mock_model.stubs(:find).returns @model_instance
end
-
+
it "should not fail" do
lambda { Puppet::TestIndirectedFoo.find('bar') }.should_not raise_error
end
-
+
it 'should return an instance of the model class' do
Puppet::TestIndirectedFoo.find('bar').class.should == Puppet::TestIndirectedFoo
end
@@ -334,11 +334,11 @@ describe Puppet::Indirector::REST do
@mock_model.expects(:find).with { |key, args| args[:one] == "two" and args[:three] == "four" }.returns @model_instance
Puppet::TestIndirectedFoo.find('bar', :one => "two", :three => "four")
end
-
+
it 'should return the instance of the model class associated with the provided lookup key' do
Puppet::TestIndirectedFoo.find('bar').value.should == @model_instance.value
end
-
+
it 'should set an expiration on model instance' do
Puppet::TestIndirectedFoo.find('bar').expiration.should_not be_nil
end
@@ -350,24 +350,24 @@ describe Puppet::Indirector::REST do
Puppet::TestIndirectedFoo.find('bar')
end
end
-
+
describe "when no matching model instance can be found" do
before :each do
@mock_model.stubs(:find).returns nil
end
-
+
it "should return nil" do
Puppet::TestIndirectedFoo.find('bar').should be_nil
end
end
-
+
describe "when an exception is encountered in looking up a model instance" do
before :each do
@mock_model.stubs(:find).raises(RuntimeError)
end
-
+
it "should raise an exception" do
- lambda { Puppet::TestIndirectedFoo.find('bar') }.should raise_error(Net::HTTPError)
+ lambda { Puppet::TestIndirectedFoo.find('bar') }.should raise_error(Net::HTTPError)
end
end
end
@@ -383,11 +383,11 @@ describe Puppet::Indirector::REST do
@mock_model.stubs(:search).returns @model_instances
@mock_model.stubs(:render_multiple).returns @model_instances.to_yaml
end
-
+
it "should not fail" do
lambda { Puppet::TestIndirectedFoo.search('bar') }.should_not raise_error
end
-
+
it 'should return all matching results' do
Puppet::TestIndirectedFoo.search('bar').length.should == @model_instances.length
end
@@ -396,42 +396,42 @@ describe Puppet::Indirector::REST do
@mock_model.expects(:search).with { |key, args| args[:one] == "two" and args[:three] == "four" }.returns @model_instances
Puppet::TestIndirectedFoo.search('bar', :one => "two", :three => "four")
end
-
+
it 'should return model instances' do
- Puppet::TestIndirectedFoo.search('bar').each do |result|
+ Puppet::TestIndirectedFoo.search('bar').each do |result|
result.class.should == Puppet::TestIndirectedFoo
end
end
-
+
it 'should return the instance of the model class associated with the provided lookup key' do
Puppet::TestIndirectedFoo.search('bar').collect { |i| i.value }.should == @model_instances.collect { |i| i.value }
end
-
+
it 'should set an expiration on model instances' do
Puppet::TestIndirectedFoo.search('bar').each do |result|
result.expiration.should_not be_nil
end
end
end
-
+
describe "when no matching model instance can be found" do
before :each do
@mock_model.stubs(:search).returns nil
@mock_model.stubs(:render_multiple).returns nil.to_yaml
end
-
+
it "should return nil" do
Puppet::TestIndirectedFoo.search('bar').should == []
end
end
-
+
describe "when an exception is encountered in looking up a model instance" do
before :each do
@mock_model.stubs(:find).raises(RuntimeError)
end
-
+
it "should raise an exception" do
- lambda { Puppet::TestIndirectedFoo.find('bar') }.should raise_error(Net::HTTPError)
+ lambda { Puppet::TestIndirectedFoo.find('bar') }.should raise_error(Net::HTTPError)
end
end
end
@@ -441,33 +441,33 @@ describe Puppet::Indirector::REST do
before :each do
@mock_model.stubs(:destroy).returns true
end
-
+
it "should not fail" do
lambda { Puppet::TestIndirectedFoo.destroy('bar') }.should_not raise_error
end
-
+
it 'should return success' do
Puppet::TestIndirectedFoo.destroy('bar').should == true
end
end
-
+
describe "when no matching model instance can be found" do
before :each do
@mock_model.stubs(:destroy).returns false
end
-
+
it "should return failure" do
Puppet::TestIndirectedFoo.destroy('bar').should == false
end
end
-
+
describe "when an exception is encountered in destroying a model instance" do
before :each do
@mock_model.stubs(:destroy).raises(RuntimeError)
end
-
+
it "should raise an exception" do
- lambda { Puppet::TestIndirectedFoo.destroy('bar') }.should raise_error(Net::HTTPError)
+ lambda { Puppet::TestIndirectedFoo.destroy('bar') }.should raise_error(Net::HTTPError)
end
end
end
@@ -479,13 +479,13 @@ describe Puppet::Indirector::REST do
# LAK:NOTE This stub is necessary to prevent the REST call from calling
# REST.save again, thus producing painful infinite recursion.
- Puppet::Network::HTTP::MongrelREST.any_instance.stubs(:save_object).returns(@instance)
+ Puppet::Network::HTTP::MongrelREST.any_instance.stubs(:save_object).returns(@instance)
end
-
+
describe "when a successful save can be performed" do
before :each do
end
-
+
it "should not fail" do
lambda { @instance.save }.should_not raise_error
end
@@ -493,29 +493,29 @@ describe Puppet::Indirector::REST do
it 'should return an instance of the model class' do
@instance.save.class.should == Puppet::TestIndirectedFoo
end
-
+
it 'should return a matching instance of the model class' do
@instance.save.value.should == @instance.value
end
end
-
+
describe "when a save cannot be completed" do
before :each do
Puppet::Network::HTTP::MongrelREST.any_instance.stubs(:save_object).returns(false)
end
-
+
it "should return failure" do
@instance.save.should == false
end
end
-
+
describe "when an exception is encountered in performing a save" do
before :each do
- Puppet::Network::HTTP::MongrelREST.any_instance.stubs(:save_object).raises(RuntimeError)
+ Puppet::Network::HTTP::MongrelREST.any_instance.stubs(:save_object).raises(RuntimeError)
end
-
+
it "should raise an exception" do
- lambda { @instance.save }.should raise_error(Net::HTTPError)
+ lambda { @instance.save }.should raise_error(Net::HTTPError)
end
end
end
diff --git a/spec/integration/network/server/mongrel.rb b/spec/integration/network/server/mongrel.rb
index d621220e2..1365fbd41 100755
--- a/spec/integration/network/server/mongrel.rb
+++ b/spec/integration/network/server/mongrel.rb
@@ -7,12 +7,12 @@ require 'socket'
describe Puppet::Network::Server do
describe "when using mongrel" do
confine "Mongrel is not available" => Puppet.features.mongrel?
-
+
before :each do
Puppet[:servertype] = 'mongrel'
Puppet[:server] = '127.0.0.1'
@params = { :port => 34346, :handlers => [ :node ] }
- @server = Puppet::Network::Server.new(@params)
+ @server = Puppet::Network::Server.new(@params)
end
after { Puppet.settings.clear }
@@ -26,11 +26,11 @@ describe Puppet::Network::Server do
describe "when listening" do
it "should be reachable on the specified address and port" do
@server.listen
- lambda { TCPSocket.new('127.0.0.1', 34346) }.should_not raise_error
+ lambda { TCPSocket.new('127.0.0.1', 34346) }.should_not raise_error
end
it "should default to '127.0.0.1' as its bind address" do
- @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
+ @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
@server.stubs(:unlisten) # we're breaking listening internally, so we have to keep it from unlistening
@server.send(:http_server).expects(:listen).with { |args| args[:address] == "127.0.0.1" }
@server.listen
@@ -38,7 +38,7 @@ describe Puppet::Network::Server do
it "should use any specified bind address" do
Puppet[:bindaddress] = "0.0.0.0"
- @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
+ @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
@server.stubs(:unlisten) # we're breaking listening internally, so we have to keep it from unlistening
@server.send(:http_server).expects(:listen).with { |args| args[:address] == "0.0.0.0" }
@server.listen
@@ -50,17 +50,17 @@ describe Puppet::Network::Server do
lambda { @server2.listen }.should raise_error
end
end
-
+
describe "after unlistening" do
it "should not be reachable on the port and address assigned" do
@server.listen
@server.unlisten
- lambda { TCPSocket.new('127.0.0.1', 34346) }.should raise_error(Errno::ECONNREFUSED)
+ lambda { TCPSocket.new('127.0.0.1', 34346) }.should raise_error(Errno::ECONNREFUSED)
end
end
-
+
after :each do
@server.unlisten if @server.listening?
- end
+ end
end
end
diff --git a/spec/integration/network/server/webrick.rb b/spec/integration/network/server/webrick.rb
index 06916573f..73616d22d 100755
--- a/spec/integration/network/server/webrick.rb
+++ b/spec/integration/network/server/webrick.rb
@@ -42,13 +42,13 @@ describe Puppet::Network::Server do
describe "when listening" do
it "should be reachable on the specified address and port" do
- @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
+ @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
@server.listen
- lambda { TCPSocket.new('127.0.0.1', 34343) }.should_not raise_error
+ lambda { TCPSocket.new('127.0.0.1', 34343) }.should_not raise_error
end
it "should default to '0.0.0.0' as its bind address" do
- @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
+ @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
@server.stubs(:unlisten) # we're breaking listening internally, so we have to keep it from unlistening
@server.send(:http_server).expects(:listen).with { |args| args[:address] == "0.0.0.0" }
@server.listen
@@ -56,14 +56,14 @@ describe Puppet::Network::Server do
it "should use any specified bind address" do
Puppet[:bindaddress] = "127.0.0.1"
- @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
+ @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
@server.stubs(:unlisten) # we're breaking listening internally, so we have to keep it from unlistening
@server.send(:http_server).expects(:listen).with { |args| args[:address] == "127.0.0.1" }
@server.listen
end
it "should not allow multiple servers to listen on the same address and port" do
- @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
+ @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
@server.listen
@server2 = Puppet::Network::Server.new(@params.merge(:port => 34343))
lambda { @server2.listen }.should raise_error
@@ -76,10 +76,10 @@ describe Puppet::Network::Server do
describe "after unlistening" do
it "should not be reachable on the port and address assigned" do
- @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
+ @server = Puppet::Network::Server.new(@params.merge(:port => 34343))
@server.listen
@server.unlisten
- lambda { TCPSocket.new('127.0.0.1', 34343) }.should raise_error(Errno::ECONNREFUSED)
+ lambda { TCPSocket.new('127.0.0.1', 34343) }.should raise_error(Errno::ECONNREFUSED)
end
end
end
diff --git a/spec/integration/type/file.rb b/spec/integration/type/file.rb
index ef0cd3924..2877153f0 100755
--- a/spec/integration/type/file.rb
+++ b/spec/integration/type/file.rb
@@ -143,7 +143,7 @@ describe Puppet::Type.type(:file) do
@catalog.resource(:file, File.join(@dest, "two")).should be_instance_of(@file.class)
end
end
-
+
it "should have an edge to each resource in the relationship graph" do
@catalog.apply do |trans|
one = @catalog.resource(:file, File.join(@dest, "one"))
diff --git a/spec/integration/type/tidy.rb b/spec/integration/type/tidy.rb
index c2206f97d..632e21bb8 100755
--- a/spec/integration/type/tidy.rb
+++ b/spec/integration/type/tidy.rb
@@ -14,7 +14,7 @@ describe Puppet::Type.type(:tidy) do
target = tmpfile("no_such_file_tidy_link_testing")
Dir.mkdir(dir)
File.symlink(target, link)
-
+
tidy = Puppet::Type.type(:tidy).new :path => dir, :recurse => true
catalog = Puppet::Resource::Catalog.new
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 5c7b6ee86..7e19b1d07 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -6,7 +6,7 @@ $LOAD_PATH.unshift("#{dir}/../lib")
$LOAD_PATH.unshift("#{dir}/../test/lib") # Add the old test dir, so that we can still find our local mocha and spec
# include any gems in vendor/gems
-Dir["#{dir}/../vendor/gems/**"].each do |path|
+Dir["#{dir}/../vendor/gems/**"].each do |path|
libpath = File.join(path, "lib")
if File.directory?(libpath)
$LOAD_PATH.unshift(libpath)
diff --git a/spec/unit/agent.rb b/spec/unit/agent.rb
index a583a5210..c133ca9cc 100755
--- a/spec/unit/agent.rb
+++ b/spec/unit/agent.rb
@@ -169,7 +169,7 @@ describe Puppet::Agent do
@agent.should be_splayed
end
end
-
+
describe "when stopping" do
it "should do nothing if already stopping" do
@agent.expects(:stopping?).returns true
diff --git a/spec/unit/configurer.rb b/spec/unit/configurer.rb
index c27445a64..95d205d56 100755
--- a/spec/unit/configurer.rb
+++ b/spec/unit/configurer.rb
@@ -55,7 +55,7 @@ describe Puppet::Configurer, "when executing a catalog run" do
catalog.expects(:apply).with(:one => true)
@agent.run :one => true
end
-
+
it "should benchmark how long it takes to apply the catalog" do
@agent.expects(:benchmark).with(:notice, "Finished catalog run")
diff --git a/spec/unit/daemon.rb b/spec/unit/daemon.rb
index 0477decb1..960d79d50 100755
--- a/spec/unit/daemon.rb
+++ b/spec/unit/daemon.rb
@@ -133,7 +133,7 @@ describe Puppet::Daemon do
sync = mock 'sync'
Puppet::Util.expects(:sync).with("me").returns sync
-
+
sync.expects(:synchronize).with(Sync::EX)
@daemon.create_pidfile
end
@@ -170,7 +170,7 @@ describe Puppet::Daemon do
sync = mock 'sync'
Puppet::Util.expects(:sync).with("me").returns sync
-
+
sync.expects(:synchronize).with(Sync::EX)
@daemon.remove_pidfile
end
diff --git a/spec/unit/indirector.rb b/spec/unit/indirector.rb
index c77ab0f62..0b4c61695 100755
--- a/spec/unit/indirector.rb
+++ b/spec/unit/indirector.rb
@@ -36,7 +36,7 @@ describe Puppet::Indirector, "when registering an indirection" do
@indirection = @thingie.indirects(:test)
@indirection.should be_instance_of(Puppet::Indirector::Indirection)
end
-
+
it "should not allow a model to register under multiple names" do
# Keep track of the indirection instance so we can delete it on cleanup
@indirection = @thingie.indirects :first
diff --git a/spec/unit/indirector/active_record.rb b/spec/unit/indirector/active_record.rb
index 6d81b0fbe..c3cdc07ed 100755
--- a/spec/unit/indirector/active_record.rb
+++ b/spec/unit/indirector/active_record.rb
@@ -47,7 +47,7 @@ describe Puppet::Indirector::ActiveRecord do
@terminus.find(@request)
end
-
+
it "should return nil if no instance is found" do
@ar_model.expects(:find_by_name).with(@name).returns nil
@terminus.find(@request).should be_nil
diff --git a/spec/unit/indirector/catalog/active_record.rb b/spec/unit/indirector/catalog/active_record.rb
index 2b5395a36..4b02178cd 100755
--- a/spec/unit/indirector/catalog/active_record.rb
+++ b/spec/unit/indirector/catalog/active_record.rb
@@ -54,7 +54,7 @@ describe Puppet::Resource::Catalog::ActiveRecord do
result.should be_instance_of(Puppet::Resource::Catalog)
result.name.should == "foo"
end
-
+
it "should set each of the host's resources as a transportable resource within the catalog" do
host = stub 'host', :name => "foo"
Puppet::Rails::Host.expects(:find_by_name).returns host
diff --git a/spec/unit/indirector/catalog/compiler.rb b/spec/unit/indirector/catalog/compiler.rb
index 9dac76f0e..6e49a6529 100755
--- a/spec/unit/indirector/catalog/compiler.rb
+++ b/spec/unit/indirector/catalog/compiler.rb
@@ -189,7 +189,7 @@ describe Puppet::Resource::Catalog::Compiler do
end
it "should look node information up via the Node class with the provided key" do
- @node.stubs :merge
+ @node.stubs :merge
Puppet::Node.expects(:find).with(@name).returns(@node)
@compiler.find(@request)
end
diff --git a/spec/unit/indirector/file.rb b/spec/unit/indirector/file.rb
index d64ed9f57..c19d8bee1 100755
--- a/spec/unit/indirector/file.rb
+++ b/spec/unit/indirector/file.rb
@@ -24,7 +24,7 @@ describe Puppet::Indirector::File do
@request = stub 'request', :key => @path
end
-
+
describe Puppet::Indirector::File, " when finding files" do
it "should provide a method to return file contents at a specified path" do
diff --git a/spec/unit/indirector/indirection.rb b/spec/unit/indirector/indirection.rb
index af649bb88..5d9efd2ea 100755
--- a/spec/unit/indirector/indirection.rb
+++ b/spec/unit/indirector/indirection.rb
@@ -209,7 +209,7 @@ describe Puppet::Indirector::Indirection do
@indirection.request(:funtest, "yayness").should equal(request)
end
end
-
+
describe "and looking for a model instance" do
before { @method = :find }
@@ -425,7 +425,7 @@ describe Puppet::Indirector::Indirection do
end
end
end
-
+
describe "and removing a model instance" do
before { @method = :destroy }
@@ -580,7 +580,7 @@ describe Puppet::Indirector::Indirection do
@indirection = Puppet::Indirector::Indirection.new(mock('model'), :test)
Puppet::Indirector::Indirection.instance(:test).should equal(@indirection)
end
-
+
it "should return nil when the named indirection has not been created" do
Puppet::Indirector::Indirection.instance(:test).should be_nil
end
@@ -590,7 +590,7 @@ describe Puppet::Indirector::Indirection do
@indirection = Puppet::Indirector::Indirection.new(mock_model, :test)
Puppet::Indirector::Indirection.model(:test).should equal(mock_model)
end
-
+
it "should return nil when no model matches the requested name" do
Puppet::Indirector::Indirection.model(:test).should be_nil
end
@@ -776,10 +776,10 @@ describe Puppet::Indirector::Indirection do
describe "and saving" do
end
-
+
describe "and finding" do
end
-
+
after :each do
@indirection.delete
end
diff --git a/spec/unit/indirector/node/ldap.rb b/spec/unit/indirector/node/ldap.rb
index d407796c6..e25bc36c4 100755
--- a/spec/unit/indirector/node/ldap.rb
+++ b/spec/unit/indirector/node/ldap.rb
@@ -12,7 +12,7 @@ describe Puppet::Node::Ldap do
describe "when searching for a single node" do
before :each do
@searcher = Puppet::Node::Ldap.new
-
+
@name = "mynode.domain.com"
@node = stub 'node', :name => @name, :name= => nil
@node.stub_everything
diff --git a/spec/unit/indirector/node/rest.rb b/spec/unit/indirector/node/rest.rb
index 3b99e33c4..c00bb98d0 100755
--- a/spec/unit/indirector/node/rest.rb
+++ b/spec/unit/indirector/node/rest.rb
@@ -8,6 +8,6 @@ describe Puppet::Node::Rest do
before do
@searcher = Puppet::Node::Rest.new
end
-
-
+
+
end
diff --git a/spec/unit/indirector/rest.rb b/spec/unit/indirector/rest.rb
index d135b8dba..9f77deb55 100755
--- a/spec/unit/indirector/rest.rb
+++ b/spec/unit/indirector/rest.rb
@@ -22,7 +22,7 @@ describe "a REST http call", :shared => true do
@searcher.expects(:deserialize).with(@response).returns "myobject"
@searcher.send(@method, *@arguments).should == 'myobject'
- end
+ end
end
describe Puppet::Indirector::REST do
@@ -171,7 +171,7 @@ describe Puppet::Indirector::REST do
@searcher.expects(:deserialize).with(@response).returns "myobject"
@searcher.find(@request).should == 'myobject'
- end
+ end
it "should use the URI generated by the Handler module" do
@searcher.expects(:indirection2uri).with(@request).returns "/my/uri"
@@ -218,7 +218,7 @@ describe Puppet::Indirector::REST do
@searcher.expects(:deserialize).with(@response, true).returns "myobject"
@searcher.search(@request).should == 'myobject'
- end
+ end
it "should use the URI generated by the Handler module" do
@searcher.expects(:indirection2uri).with(@request).returns "/mys/uri"
@@ -243,7 +243,7 @@ describe Puppet::Indirector::REST do
@searcher.expects(:deserialize).raises(ArgumentError)
lambda { @searcher.search(@request) }.should raise_error(ArgumentError)
end
- end
+ end
describe "when doing a destroy" do
before :each do
@@ -270,7 +270,7 @@ describe Puppet::Indirector::REST do
@searcher.expects(:deserialize).with(@response).returns "myobject"
@searcher.destroy(@request).should == 'myobject'
- end
+ end
it "should use the URI generated by the Handler module" do
@searcher.expects(:indirection2uri).with(@request).returns "/my/uri"
@@ -341,7 +341,7 @@ describe Puppet::Indirector::REST do
@searcher.expects(:deserialize).with(@response).returns "myobject"
@searcher.save(@request).should == 'myobject'
- end
+ end
it "should provide an Accept header containing the list of supported formats joined with commas" do
@connection.expects(:put).with { |path, data, args| args["Accept"] == "supported, formats" }.returns(@response)
diff --git a/spec/unit/indirector/ssl_file.rb b/spec/unit/indirector/ssl_file.rb
index 559e2f98d..7a9d629de 100755
--- a/spec/unit/indirector/ssl_file.rb
+++ b/spec/unit/indirector/ssl_file.rb
@@ -62,7 +62,7 @@ describe Puppet::Indirector::SslFile do
Puppet::SSL::Host.expects(:ca_name).returns "amaca"
@searcher.should be_ca("amaca")
end
-
+
describe "when choosing the location for certificates" do
it "should set them at the ca setting's path if a ca setting is available and the name resolves to the CA name" do
@file_class.store_in nil
diff --git a/spec/unit/network/handler/fileserver.rb b/spec/unit/network/handler/fileserver.rb
index 386e77693..fbb5c8ae2 100644
--- a/spec/unit/network/handler/fileserver.rb
+++ b/spec/unit/network/handler/fileserver.rb
@@ -157,7 +157,7 @@ describe Puppet::Network::Handler::FileServer do
it "should list a file within a directory when given the file path with recursion" do
@mount.list("facter/fact.rb", true, "false").should == [["/", "file"], ["/", "file"]]
end
-
+
it "should return a merged view of all plugins for all modules" do
list = @mount.list("facter",true,false)
list.should == [["/", "directory"], ["/fact.rb", "file"], ["/", "directory"], ["/fact.rb", "file"]]
diff --git a/spec/unit/network/http.rb b/spec/unit/network/http.rb
index 1fa025b0b..220726788 100755
--- a/spec/unit/network/http.rb
+++ b/spec/unit/network/http.rb
@@ -11,7 +11,7 @@ describe Puppet::Network::HTTP do
it "should return the webrick HTTP server class when asked for a webrick server" do
Puppet::Network::HTTP.server_class_by_type(:webrick).should be(Puppet::Network::HTTP::WEBrick)
end
-
+
describe "when asked for a mongrel server" do
if Puppet.features.mongrel?
it "should return the mongrel server class" do
@@ -23,12 +23,12 @@ describe Puppet::Network::HTTP do
end
end
end
-
+
it "should fail to return the mongrel HTTP server class if mongrel is not available " do
Puppet.features.expects(:mongrel?).returns(false)
Proc.new { Puppet::Network::HTTP.server_class_by_type(:mongrel) }.should raise_error(ArgumentError)
end
-
+
it "should return an error when asked for an unknown server" do
Proc.new { Puppet::Network::HTTP.server_class_by_type :foo }.should raise_error(ArgumentError)
end
diff --git a/spec/unit/network/http/handler.rb b/spec/unit/network/http/handler.rb
index 1d10447af..8ef6e00d1 100755
--- a/spec/unit/network/http/handler.rb
+++ b/spec/unit/network/http/handler.rb
@@ -12,7 +12,7 @@ describe Puppet::Network::HTTP::Handler do
before do
@handler = HttpHandled.new
end
-
+
it "should include the v1 REST API" do
Puppet::Network::HTTP::Handler.ancestors.should be_include(Puppet::Network::HTTP::API::V1)
end
diff --git a/spec/unit/network/http/mongrel.rb b/spec/unit/network/http/mongrel.rb
index 59f893251..c0ca68e43 100755
--- a/spec/unit/network/http/mongrel.rb
+++ b/spec/unit/network/http/mongrel.rb
@@ -8,7 +8,7 @@ require 'puppet/network/http'
describe "Puppet::Network::HTTP::Mongrel", "after initializing" do
confine "Mongrel is not available" => Puppet.features.mongrel?
-
+
it "should not be listening" do
require 'puppet/network/http/mongrel'
@@ -33,34 +33,34 @@ describe "Puppet::Network::HTTP::Mongrel", "when turning on listening" do
@listen_params = { :address => "127.0.0.1", :port => 31337, :protocols => [ :rest, :xmlrpc ], :xmlrpc_handlers => [ :status, :fileserver ] }
end
-
+
it "should fail if already listening" do
@server.listen(@listen_params)
Proc.new { @server.listen(@listen_params) }.should raise_error(RuntimeError)
end
-
+
it "should require at least one protocol" do
Proc.new { @server.listen(@listen_params.delete_if {|k,v| :protocols == k}) }.should raise_error(ArgumentError)
end
-
+
it "should require a listening address to be specified" do
Proc.new { @server.listen(@listen_params.delete_if {|k,v| :address == k})}.should raise_error(ArgumentError)
end
-
+
it "should require a listening port to be specified" do
Proc.new { @server.listen(@listen_params.delete_if {|k,v| :port == k})}.should raise_error(ArgumentError)
end
-
+
it "should order a mongrel server to start" do
@mock_mongrel.expects(:run)
@server.listen(@listen_params)
end
-
+
it "should tell mongrel to listen on the specified address and port" do
Mongrel::HttpServer.expects(:new).with("127.0.0.1", 31337).returns(@mock_mongrel)
@server.listen(@listen_params)
end
-
+
it "should be listening" do
Mongrel::HttpServer.expects(:new).returns(@mock_mongrel)
@server.listen(@listen_params)
@@ -72,9 +72,9 @@ describe "Puppet::Network::HTTP::Mongrel", "when turning on listening" do
Puppet::Network::HTTP::MongrelREST.expects(:new).returns "myhandler"
@mock_mongrel.expects(:register).with("/", "myhandler")
- @server.listen(@listen_params)
+ @server.listen(@listen_params)
end
-
+
it "should use a Mongrel + REST class to configure Mongrel when REST services are requested" do
@server.expects(:class_for_protocol).with(:rest).at_least_once.returns(Puppet::Network::HTTP::MongrelREST)
@server.listen(@listen_params)
@@ -102,26 +102,26 @@ end
describe "Puppet::Network::HTTP::Mongrel", "when turning off listening" do
confine "Mongrel is not available" => Puppet.features.mongrel?
-
+
before do
@mock_mongrel = mock('mongrel httpserver')
@mock_mongrel.stubs(:run)
@mock_mongrel.stubs(:register)
Mongrel::HttpServer.stubs(:new).returns(@mock_mongrel)
- @server = Puppet::Network::HTTP::Mongrel.new
+ @server = Puppet::Network::HTTP::Mongrel.new
@listen_params = { :address => "127.0.0.1", :port => 31337, :handlers => [ :node, :catalog ], :protocols => [ :rest ] }
end
-
+
it "should fail unless listening" do
Proc.new { @server.unlisten }.should raise_error(RuntimeError)
end
-
+
it "should order mongrel server to stop" do
@server.listen(@listen_params)
@mock_mongrel.expects(:stop)
@server.unlisten
end
-
+
it "should not be listening" do
@server.listen(@listen_params)
@mock_mongrel.stubs(:stop)
diff --git a/spec/unit/network/http/webrick.rb b/spec/unit/network/http/webrick.rb
index a6fbfc83f..d0c4b5562 100755
--- a/spec/unit/network/http/webrick.rb
+++ b/spec/unit/network/http/webrick.rb
@@ -16,7 +16,7 @@ end
describe Puppet::Network::HTTP::WEBrick, "when turning on listening" do
before do
@mock_webrick = stub('webrick', :[] => {})
- [:mount, :start, :shutdown].each {|meth| @mock_webrick.stubs(meth)}
+ [:mount, :start, :shutdown].each {|meth| @mock_webrick.stubs(meth)}
WEBrick::HTTPServer.stubs(:new).returns(@mock_webrick)
@server = Puppet::Network::HTTP::WEBrick.new
[:setup_logger, :setup_ssl].each {|meth| @server.stubs(meth).returns({})} # the empty hash is required because of how we're merging
@@ -37,7 +37,7 @@ describe Puppet::Network::HTTP::WEBrick, "when turning on listening" do
end
it "should require a listening port to be specified" do
- Proc.new { @server.listen(@listen_params.delete_if {|k,v| :port == k})}.should raise_error(ArgumentError)
+ Proc.new { @server.listen(@listen_params.delete_if {|k,v| :port == k})}.should raise_error(ArgumentError)
end
it "should order a webrick server to start" do
@@ -146,7 +146,7 @@ describe Puppet::Network::HTTP::WEBrick, "when looking up the class to handle a
end
it "should accept a protocol" do
- lambda { Puppet::Network::HTTP::WEBrick.class_for_protocol("bob") }.should_not raise_error(ArgumentError)
+ lambda { Puppet::Network::HTTP::WEBrick.class_for_protocol("bob") }.should_not raise_error(ArgumentError)
end
it "should use a WEBrick + REST class when a REST protocol is specified" do
@@ -163,7 +163,7 @@ describe Puppet::Network::HTTP::WEBrick, "when turning off listening" do
@mock_webrick = stub('webrick', :[] => {})
[:mount, :start, :shutdown].each {|meth| @mock_webrick.stubs(meth)}
WEBrick::HTTPServer.stubs(:new).returns(@mock_webrick)
- @server = Puppet::Network::HTTP::WEBrick.new
+ @server = Puppet::Network::HTTP::WEBrick.new
[:setup_logger, :setup_ssl].each {|meth| @server.stubs(meth).returns({})} # the empty hash is required because of how we're merging
@listen_params = { :address => "127.0.0.1", :port => 31337, :handlers => [ :node, :catalog ], :protocols => [ :rest ] }
end
@@ -188,7 +188,7 @@ end
describe Puppet::Network::HTTP::WEBrick do
before do
@mock_webrick = stub('webrick', :[] => {})
- [:mount, :start, :shutdown].each {|meth| @mock_webrick.stubs(meth)}
+ [:mount, :start, :shutdown].each {|meth| @mock_webrick.stubs(meth)}
WEBrick::HTTPServer.stubs(:new).returns(@mock_webrick)
@server = Puppet::Network::HTTP::WEBrick.new
end
diff --git a/spec/unit/network/rights.rb b/spec/unit/network/rights.rb
index 8a86c8c34..244fa18c8 100755
--- a/spec/unit/network/rights.rb
+++ b/spec/unit/network/rights.rb
@@ -508,9 +508,9 @@ describe Puppet::Network::Rights do
# mocha doesn't allow testing super...
# it "should delegate to the AuthStore for the result" do
# @acl.method(:save)
- #
+ #
# @acl.expects(:allowed?).with("me","127.0.0.1")
- #
+ #
# @acl.allowed?("me","127.0.0.1", :save)
# end
end
diff --git a/spec/unit/network/server.rb b/spec/unit/network/server.rb
index 081848d85..2aeb99a8b 100755
--- a/spec/unit/network/server.rb
+++ b/spec/unit/network/server.rb
@@ -68,7 +68,7 @@ describe Puppet::Network::Server do
it "should fail to initialize if no listening port can be found" do
Puppet.settings.stubs(:value).with(:bindaddress).returns("127.0.0.1")
Puppet.settings.stubs(:value).with(:masterport).returns(nil)
- lambda { Puppet::Network::Server.new }.should raise_error(ArgumentError)
+ lambda { Puppet::Network::Server.new }.should raise_error(ArgumentError)
end
it "should use the Puppet configurator to determine which HTTP server will be used to provide access to clients" do
@@ -164,7 +164,7 @@ describe Puppet::Network::Server do
sync = mock 'sync'
Puppet::Util.expects(:sync).with("me").returns sync
-
+
sync.expects(:synchronize).with(Sync::EX)
@server.create_pidfile
end
@@ -201,7 +201,7 @@ describe Puppet::Network::Server do
sync = mock 'sync'
Puppet::Util.expects(:sync).with("me").returns sync
-
+
sync.expects(:synchronize).with(Sync::EX)
@server.remove_pidfile
end
@@ -265,7 +265,7 @@ describe Puppet::Network::Server do
it "should allow the use of indirection names to specify which indirections are to be no longer accessible to clients" do
@server.register(:foo)
- lambda { @server.unregister(:foo) }.should_not raise_error
+ lambda { @server.unregister(:foo) }.should_not raise_error
end
it "should leave other indirections accessible to clients when turning off indirections" do
@@ -292,7 +292,7 @@ describe Puppet::Network::Server do
it "should disable client access immediately when turning off indirections" do
@server.register(:foo, :bar)
- @server.unregister(:foo)
+ @server.unregister(:foo)
lambda { @server.unregister(:foo) }.should raise_error(ArgumentError)
end
@@ -339,7 +339,7 @@ describe Puppet::Network::Server do
@server2.unregister(:foo, :xyzzy)
lambda { @server.unregister(:xyzzy) }.should raise_error(ArgumentError)
lambda { @server2.unregister(:bar) }.should raise_error(ArgumentError)
- end
+ end
describe "when managing xmlrpc registrations" do
before do
@@ -392,7 +392,7 @@ describe Puppet::Network::Server do
it "should disable client access immediately when turning off namespaces" do
@server.register_xmlrpc(:foo, :bar)
- @server.unregister_xmlrpc(:foo)
+ @server.unregister_xmlrpc(:foo)
lambda { @server.unregister_xmlrpc(:foo) }.should raise_error(ArgumentError)
end
@@ -414,7 +414,7 @@ describe Puppet::Network::Server do
it "should indicate that it is not listening" do
@server.should_not be_listening
- end
+ end
it "should not allow listening to be turned off" do
lambda { @server.unlisten }.should raise_error(RuntimeError)
@@ -461,7 +461,7 @@ describe Puppet::Network::Server do
it "should fetch an instance of an HTTP server" do
@server.stubs(:http_server_class).returns(@mock_http_server_class)
@mock_http_server_class.expects(:new).returns(@mock_http_server)
- @server.listen
+ @server.listen
end
it "should cause the HTTP server to listen" do
@@ -507,7 +507,7 @@ describe Puppet::Network::Server do
@mock_http_server.expects(:listen).with do |args|
args[:protocols] == [ :rest, :xmlrpc ]
end
- @server.listen
+ @server.listen
end
end
@@ -528,7 +528,7 @@ describe Puppet::Network::Server do
Puppet::Indirector::Indirection.stubs(:model).returns mock('indirection')
@server.register(:foo)
- lambda { @server.unregister(:foo) }.should raise_error(RuntimeError)
+ lambda { @server.unregister(:foo) }.should raise_error(RuntimeError)
end
end
end
diff --git a/spec/unit/node/environment.rb b/spec/unit/node/environment.rb
index 3b58a115b..f8b2dea7f 100755
--- a/spec/unit/node/environment.rb
+++ b/spec/unit/node/environment.rb
@@ -13,11 +13,11 @@ describe Puppet::Node::Environment do
it "should include the Cacher module" do
Puppet::Node::Environment.ancestors.should be_include(Puppet::Util::Cacher)
end
-
+
it "should use the filetimeout for the ttl for the modulepath" do
Puppet::Node::Environment.attr_ttl(:modulepath).should == Integer(Puppet[:filetimeout])
end
-
+
it "should use the filetimeout for the ttl for the module list" do
Puppet::Node::Environment.attr_ttl(:modules).should == Integer(Puppet[:filetimeout])
end
diff --git a/spec/unit/node/facts.rb b/spec/unit/node/facts.rb
index a557066b8..a6e227ac3 100755
--- a/spec/unit/node/facts.rb
+++ b/spec/unit/node/facts.rb
@@ -36,7 +36,7 @@ describe Puppet::Node::Facts, "when indirecting" do
Puppet.settings.expects(:value).with(:downcasefacts).returns true
@facts.values["one"] = "Two"
-
+
@facts.downcase_if_necessary
@facts.values["one"].should == "two"
end
diff --git a/spec/unit/parser/ast.rb b/spec/unit/parser/ast.rb
index 35e2b1eff..35f575b1b 100644
--- a/spec/unit/parser/ast.rb
+++ b/spec/unit/parser/ast.rb
@@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
require 'puppet/parser/ast'
describe Puppet::Parser::AST do
-
+
it "should use the file lookup module" do
Puppet::Parser::AST.ancestors.should be_include(Puppet::FileCollection::Lookup)
end
diff --git a/spec/unit/parser/ast/arithmetic_operator.rb b/spec/unit/parser/ast/arithmetic_operator.rb
index 9c1ff864e..4a0be483b 100755
--- a/spec/unit/parser/ast/arithmetic_operator.rb
+++ b/spec/unit/parser/ast/arithmetic_operator.rb
@@ -17,7 +17,7 @@ describe Puppet::Parser::AST::ArithmeticOperator do
lval.expects(:safeevaluate).with(@scope).returns(1)
rval = stub "rval"
rval.expects(:safeevaluate).with(@scope).returns(2)
-
+
operator = ast::ArithmeticOperator.new :rval => rval, :operator => "+", :lval => lval
operator.evaluate(@scope)
end
@@ -65,7 +65,7 @@ describe Puppet::Parser::AST::ArithmeticOperator do
@scope.expects(:lookupvar).with("two").returns(2)
one = ast::Variable.new( :value => "one" )
two = ast::Variable.new( :value => "two" )
-
+
operator = ast::ArithmeticOperator.new :lval => one, :operator => "+", :rval => two
operator.evaluate(@scope).should == 3
end
diff --git a/spec/unit/parser/ast/astarray.rb b/spec/unit/parser/ast/astarray.rb
index b3026fe1e..212c3fd14 100755
--- a/spec/unit/parser/ast/astarray.rb
+++ b/spec/unit/parser/ast/astarray.rb
@@ -11,14 +11,14 @@ describe Puppet::Parser::AST::ASTArray do
array = Puppet::Parser::AST::ASTArray.new :children => []
array.should respond_to(:[])
end
-
+
it "should evaluate all its children" do
item1 = stub "item1", :is_a? => true
item2 = stub "item2", :is_a? => true
item1.expects(:safeevaluate).with(@scope).returns(123)
item2.expects(:safeevaluate).with(@scope).returns(246)
-
+
operator = Puppet::Parser::AST::ASTArray.new :children => [item1,item2]
operator.evaluate(@scope)
end
@@ -29,9 +29,9 @@ describe Puppet::Parser::AST::ASTArray do
item2.stubs(:is_a?).with(Puppet::Parser::AST).returns(true)
item2.stubs(:instance_of?).with(Puppet::Parser::AST::ASTArray).returns(true)
item2.stubs(:each).yields(item1)
-
+
item1.expects(:safeevaluate).with(@scope).returns(123)
-
+
operator = Puppet::Parser::AST::ASTArray.new :children => [item2]
operator.evaluate(@scope).should == [123]
end
@@ -42,9 +42,9 @@ describe Puppet::Parser::AST::ASTArray do
item2.stubs(:is_a?).with(Puppet::Parser::AST).returns(true)
item2.stubs(:instance_of?).with(Puppet::Parser::AST::ASTArray).returns(true)
item2.stubs(:each).yields([item1])
-
+
item1.expects(:safeevaluate).with(@scope).returns(123)
-
+
operator = Puppet::Parser::AST::ASTArray.new :children => [item2]
operator.evaluate(@scope).should == [123]
end
@@ -55,12 +55,12 @@ describe Puppet::Parser::AST::ASTArray do
item2.stubs(:is_a?).with(Puppet::Parser::AST).returns(true)
item2.stubs(:instance_of?).with(Puppet::Parser::AST::ASTArray).returns(true)
item2.stubs(:each).yields([item1])
-
+
item1.expects(:safeevaluate).with(@scope).returns([123])
-
+
operator = Puppet::Parser::AST::ASTArray.new :children => [item2]
operator.evaluate(@scope).should == [[123]]
end
-
-
+
+
end
diff --git a/spec/unit/parser/ast/boolean_operator.rb b/spec/unit/parser/ast/boolean_operator.rb
index 13f5e6530..d8e9603e8 100755
--- a/spec/unit/parser/ast/boolean_operator.rb
+++ b/spec/unit/parser/ast/boolean_operator.rb
@@ -17,7 +17,7 @@ describe Puppet::Parser::AST::BooleanOperator do
lval.expects(:safeevaluate).with(@scope).returns("true")
rval = stub "rval", :safeevaluate => false
rval.expects(:safeevaluate).never
-
+
operator = ast::BooleanOperator.new :rval => rval, :operator => "or", :lval => lval
operator.evaluate(@scope)
end
diff --git a/spec/unit/parser/ast/collexpr.rb b/spec/unit/parser/ast/collexpr.rb
index 5f0ca941e..51cd820a2 100755
--- a/spec/unit/parser/ast/collexpr.rb
+++ b/spec/unit/parser/ast/collexpr.rb
@@ -7,9 +7,9 @@ describe Puppet::Parser::AST::CollExpr do
ast = Puppet::Parser::AST
before :each do
- @scope = Puppet::Parser::Scope.new()
+ @scope = Puppet::Parser::Scope.new()
end
-
+
describe "when evaluating with two operands" do
before :each do
@test1 = mock 'test1'
@@ -31,14 +31,14 @@ describe Puppet::Parser::AST::CollExpr do
end
it "should propagate expression type and form to child if expression themselves" do
- [@test1, @test2].each do |t|
+ [@test1, @test2].each do |t|
t.expects(:is_a?).returns(true)
t.expects(:form).returns(false)
t.expects(:type).returns(false)
t.expects(:type=)
t.expects(:form=)
end
-
+
collexpr = ast::CollExpr.new(:test1 => @test1, :test2 => @test2, :oper=>"==", :form => true, :type => true)
result = collexpr.evaluate(@scope)
end
@@ -48,7 +48,7 @@ describe Puppet::Parser::AST::CollExpr do
@resource = mock 'resource'
@resource.expects(:[]).with("test1").at_least(1).returns("test2")
end
-
+
it "should evaluate like the original expression for ==" do
collexpr = ast::CollExpr.new(:test1 => @test1, :test2 => @test2, :oper => "==")
collexpr.evaluate(@scope)[1].call(@resource).should === (@resource["test1"] == "test2")
@@ -73,7 +73,7 @@ describe Puppet::Parser::AST::CollExpr do
end
end
end
-
+
it "should check for array member equality if resource parameter is an array for ==" do
array = mock 'array', :safeevaluate => "array"
test1 = mock 'test1'
diff --git a/spec/unit/parser/ast/comparison_operator.rb b/spec/unit/parser/ast/comparison_operator.rb
index 80e8307fa..26311797f 100755
--- a/spec/unit/parser/ast/comparison_operator.rb
+++ b/spec/unit/parser/ast/comparison_operator.rb
@@ -14,7 +14,7 @@ describe Puppet::Parser::AST::ComparisonOperator do
lval.expects(:safeevaluate).with(@scope)
rval = stub "rval"
rval.expects(:safeevaluate).with(@scope)
-
+
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => lval, :operator => "==", :rval => rval
operator.evaluate(@scope)
end
@@ -22,18 +22,18 @@ describe Puppet::Parser::AST::ComparisonOperator do
it "should convert arguments strings to numbers if they are" do
Puppet::Parser::Scope.expects(:number?).with("1").returns(1)
Puppet::Parser::Scope.expects(:number?).with("2").returns(2)
-
+
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => @one, :operator => "==", :rval => @two
operator.evaluate(@scope)
end
-
+
%w{< > <= >= ==}.each do |oper|
it "should use string comparison #{oper} if operands are strings" do
lval = stub 'one', :safeevaluate => "one"
rval = stub 'two', :safeevaluate => "two"
Puppet::Parser::Scope.stubs(:number?).with("one").returns(nil)
Puppet::Parser::Scope.stubs(:number?).with("two").returns(nil)
-
+
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => lval, :operator => oper, :rval => rval
operator.evaluate(@scope).should == "one".send(oper,"two")
end
@@ -44,11 +44,11 @@ describe Puppet::Parser::AST::ComparisonOperator do
rval = stub 'two', :safeevaluate => "2"
Puppet::Parser::Scope.stubs(:number?).with("one").returns(nil)
Puppet::Parser::Scope.stubs(:number?).with("2").returns(2)
-
+
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => lval, :operator => ">", :rval => rval
lambda { operator.evaluate(@scope) }.should raise_error(ArgumentError)
end
-
+
it "should fail for an unknown operator" do
lambda { operator = Puppet::Parser::AST::ComparisonOperator.new :lval => @one, :operator => "or", :rval => @two }.should raise_error
end
@@ -56,7 +56,7 @@ describe Puppet::Parser::AST::ComparisonOperator do
%w{< > <= >= ==}.each do |oper|
it "should return the result of using '#{oper}' to compare the left and right sides" do
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => @one, :operator => oper, :rval => @two
-
+
operator.evaluate(@scope).should == 1.send(oper,2)
end
end
@@ -73,7 +73,7 @@ describe Puppet::Parser::AST::ComparisonOperator do
@scope.expects(:lookupvar).with("one").returns(1)
@scope.expects(:lookupvar).with("two").returns(2)
-
+
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => one, :operator => "<", :rval => two
operator.evaluate(@scope).should == true
end
@@ -84,7 +84,7 @@ describe Puppet::Parser::AST::ComparisonOperator do
ten = stub 'one', :safeevaluate => "10"
nine = stub 'two', :safeevaluate => "9"
operator = Puppet::Parser::AST::ComparisonOperator.new :lval => ten, :operator => oper, :rval => nine
-
+
operator.evaluate(@scope).should == 10.send(oper,9)
end
end
diff --git a/spec/unit/parser/ast/minus.rb b/spec/unit/parser/ast/minus.rb
index 83bd92d0d..782fd3e0c 100755
--- a/spec/unit/parser/ast/minus.rb
+++ b/spec/unit/parser/ast/minus.rb
@@ -10,7 +10,7 @@ describe Puppet::Parser::AST::Minus do
it "should evaluate its argument" do
value = stub "value"
value.expects(:safeevaluate).with(@scope).returns(123)
-
+
operator = Puppet::Parser::AST::Minus.new :value => value
operator.evaluate(@scope)
end
diff --git a/spec/unit/parser/ast/not.rb b/spec/unit/parser/ast/not.rb
index 0fe2deddd..a3bf0b85d 100755
--- a/spec/unit/parser/ast/not.rb
+++ b/spec/unit/parser/ast/not.rb
@@ -12,7 +12,7 @@ describe Puppet::Parser::AST::Not do
it "should evaluate its child expression" do
val = stub "val"
val.expects(:safeevaluate).with(@scope)
-
+
operator = Puppet::Parser::AST::Not.new :value => val
operator.evaluate(@scope)
end
diff --git a/spec/unit/parser/ast/resource_override.rb b/spec/unit/parser/ast/resource_override.rb
index c1520bf78..2735757d4 100755
--- a/spec/unit/parser/ast/resource_override.rb
+++ b/spec/unit/parser/ast/resource_override.rb
@@ -31,19 +31,19 @@ describe Puppet::Parser::AST::ResourceOverride do
it "should return the overriden resource directly when called with one item" do
klass = stub 'klass', :title => "title", :type => "one"
object = mock 'object', :safeevaluate => klass
- override = ast::ResourceOverride.new(:object => object , :params => @params).evaluate(@scope)
+ override = ast::ResourceOverride.new(:object => object , :params => @params).evaluate(@scope)
override.should be_an_instance_of(Puppet::Parser::Resource)
override.title.should == "title"
- override.type.should == "One"
+ override.type.should == "One"
end
it "should return an array of overriden resources when called with an array of titles" do
klass1 = stub 'klass1', :title => "title1", :type => "one"
klass2 = stub 'klass2', :title => "title2", :type => "one"
-
+
object = mock 'object', :safeevaluate => [klass1,klass2]
-
- override = ast::ResourceOverride.new(:object => object , :params => @params).evaluate(@scope)
+
+ override = ast::ResourceOverride.new(:object => object , :params => @params).evaluate(@scope)
override.should have(2).elements
override.each {|o| o.should be_an_instance_of(Puppet::Parser::Resource) }
end
diff --git a/spec/unit/parser/ast/resource_reference.rb b/spec/unit/parser/ast/resource_reference.rb
index ce2915a97..c7b6e8780 100755
--- a/spec/unit/parser/ast/resource_reference.rb
+++ b/spec/unit/parser/ast/resource_reference.rb
@@ -23,7 +23,7 @@ describe Puppet::Parser::AST::ResourceReference do
it "should evaluate correctly reference to define" do
klass = stub 'klass', :title => "three", :classname => type
@scope.stubs(:finddefine).returns(klass)
-
+
newref("three", type).evaluate(@scope).to_ref.should == Puppet::Parser::Resource::Reference.new( :type => type, :title => "three" ).to_ref
end
end
@@ -31,13 +31,13 @@ describe Puppet::Parser::AST::ResourceReference do
it "should be able to call qualified_class" do
klass = stub 'klass', :title => "three", :classname => "one"
@scope.expects(:findclass).with("one").returns(klass)
- newref("three","class").qualified_class(@scope,"one").should == "one"
+ newref("three","class").qualified_class(@scope,"one").should == "one"
end
it "should be able to find qualified classes when evaluating" do
klass = stub 'klass', :title => "one", :classname => "one"
@scope.stubs(:findclass).returns(klass)
-
+
evaled = newref("one", "class").evaluate(@scope)
evaled.type.should == "Class"
evaled.title.should == "one"
@@ -47,7 +47,7 @@ describe Puppet::Parser::AST::ResourceReference do
titles = mock 'titles', :safeevaluate => ["title1","title2"]
ref = ast::ResourceReference.new( :title => titles, :type => "Resource" )
ref.stubs(:qualified_type).with(@scope).returns("Resource")
-
+
ref.evaluate(@scope).should have(2).elements
end
@@ -56,7 +56,7 @@ describe Puppet::Parser::AST::ResourceReference do
ref = ast::ResourceReference.new( :title => titles, :type => "Class" )
ref.expects(:qualified_class).with(@scope,"title1").returns("class")
ref.expects(:qualified_class).with(@scope,"title2").returns("class")
-
+
ref.evaluate(@scope)
end
diff --git a/spec/unit/parser/ast/vardef.rb b/spec/unit/parser/ast/vardef.rb
index 6bd355c89..14de68923 100755
--- a/spec/unit/parser/ast/vardef.rb
+++ b/spec/unit/parser/ast/vardef.rb
@@ -12,11 +12,11 @@ describe Puppet::Parser::AST::VarDef do
it "should evaluate arguments" do
name = mock 'name'
value = mock 'value'
-
+
name.expects(:safeevaluate).with(@scope)
value.expects(:safeevaluate).with(@scope)
- vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
+ vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
:line => nil
vardef.evaluate(@scope)
end
@@ -24,21 +24,21 @@ describe Puppet::Parser::AST::VarDef do
it "should be in append=false mode if called without append" do
name = stub 'name', :safeevaluate => "var"
value = stub 'value', :safeevaluate => "1"
-
+
@scope.expects(:setvar).with { |name,value,file,line,append| append == nil }
-
- vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
+
+ vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
:line => nil
vardef.evaluate(@scope)
end
-
+
it "should call scope in append mode if append is true" do
name = stub 'name', :safeevaluate => "var"
value = stub 'value', :safeevaluate => "1"
-
+
@scope.expects(:setvar).with { |name,value,file,line,append| append == true }
-
- vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
+
+ vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
:line => nil, :append => true
vardef.evaluate(@scope)
end
diff --git a/spec/unit/parser/collector.rb b/spec/unit/parser/collector.rb
index 4756204ce..813fbb8c0 100755
--- a/spec/unit/parser/collector.rb
+++ b/spec/unit/parser/collector.rb
@@ -496,7 +496,7 @@ describe Puppet::Parser::Collector, "when building its ActiveRecord query for co
Puppet::Rails::Resource.stubs(:find).with { |*arguments|
options = arguments[3]
- options[:conditions][0] =~ /^host_id != \?/ and options[:conditions][1] == 5
+ options[:conditions][0] =~ /^host_id != \?/ and options[:conditions][1] == 5
}.returns([])
@collector.evaluate
diff --git a/spec/unit/parser/compiler.rb b/spec/unit/parser/compiler.rb
index cf5ad086a..1a037b090 100755
--- a/spec/unit/parser/compiler.rb
+++ b/spec/unit/parser/compiler.rb
@@ -187,7 +187,7 @@ describe Puppet::Parser::Compiler do
@compiler.add_resource(@scope, resource)
resource.expects(:evaluate).never
-
+
@compiler.compile
end
@@ -198,7 +198,7 @@ describe Puppet::Parser::Compiler do
# We have to now mark the resource as evaluated
resource.expects(:evaluate).with { |*whatever| resource.evaluated = true }
-
+
@compiler.compile
end
@@ -206,7 +206,7 @@ describe Puppet::Parser::Compiler do
resource = stub 'already_evaluated', :ref => "File[testing]", :builtin? => false, :evaluated? => true, :virtual? => false
@compiler.add_resource(@scope, resource)
resource.expects(:evaluate).never
-
+
@compiler.compile
end
@@ -220,7 +220,7 @@ describe Puppet::Parser::Compiler do
resource.expects(:evaluate).with { |*whatever| resource.evaluated = true; @compiler.add_resource(@scope, resource2) }
resource2.expects(:evaluate).with { |*whatever| resource2.evaluated = true }
-
+
@compiler.compile
end
@@ -296,7 +296,7 @@ describe Puppet::Parser::Compiler do
@compiler.add_resource(@scope, resource)
resource.expects(:evaluate).never
-
+
@compiler.compile
end
end
@@ -307,7 +307,7 @@ describe Puppet::Parser::Compiler do
2.times { |i|
coll = mock 'coll%s' % i
@compiler.add_collection(coll)
-
+
# This is the hard part -- we have to emulate the fact that
# collections delete themselves if they are done evaluating.
coll.expects(:evaluate).with do
diff --git a/spec/unit/parser/files.rb b/spec/unit/parser/files.rb
index 2c91ea7e4..7aa1a34f5 100644
--- a/spec/unit/parser/files.rb
+++ b/spec/unit/parser/files.rb
@@ -26,7 +26,7 @@ describe Puppet::Parser::Files do
mod.expects(:template).returns("/one/mymod/templates/mytemplate")
Puppet::Parser::Files.find_template("mymod/mytemplate").should == "/one/mymod/templates/mytemplate"
end
-
+
it "should return the file in the templatedir if it exists" do
Puppet.settings.expects(:value).with(:templatedir, nil).returns("/my/templates")
Puppet[:modulepath] = "/one:/two"
diff --git a/spec/unit/parser/functions/versioncmp.rb b/spec/unit/parser/functions/versioncmp.rb
index 06b125ea0..0595f8711 100755
--- a/spec/unit/parser/functions/versioncmp.rb
+++ b/spec/unit/parser/functions/versioncmp.rb
@@ -15,11 +15,11 @@ describe "the versioncmp function" do
it "should raise a ParseError if there is less than 2 arguments" do
lambda { @scope.function_versioncmp(["1.2"]) }.should raise_error(Puppet::ParseError)
end
-
+
it "should raise a ParseError if there is more than 2 arguments" do
lambda { @scope.function_versioncmp(["1.2", "2.4.5", "3.5.6"]) }.should raise_error(Puppet::ParseError)
end
-
+
it "should call Puppet::Util::Package.versioncmp (included in scope)" do
Puppet::Util::Package.expects(:versioncmp).with("1.2", "1.3").returns(-1)
diff --git a/spec/unit/parser/interpreter.rb b/spec/unit/parser/interpreter.rb
index fe63bbd65..f06186a4e 100755
--- a/spec/unit/parser/interpreter.rb
+++ b/spec/unit/parser/interpreter.rb
@@ -98,7 +98,7 @@ describe Puppet::Parser::Interpreter do
@interp.expects(:create_parser).with(:myenv).raises(Puppet::Error, "Could not parse")
- lambda { @interp.parser(:myenv) }.should raise_error(Puppet::Error)
+ lambda { @interp.parser(:myenv) }.should raise_error(Puppet::Error)
end
end
end
diff --git a/spec/unit/parser/lexer.rb b/spec/unit/parser/lexer.rb
index 24c34632f..2946c4152 100755
--- a/spec/unit/parser/lexer.rb
+++ b/spec/unit/parser/lexer.rb
@@ -135,10 +135,10 @@ describe Puppet::Parser::Lexer::TOKENS do
:LBRACE => '{',
:RBRACE => '}',
:LPAREN => '(',
- :RPAREN => ')',
+ :RPAREN => ')',
:EQUALS => '=',
:ISEQUAL => '==',
- :GREATEREQUAL => '>=',
+ :GREATEREQUAL => '>=',
:GREATERTHAN => '>',
:LESSTHAN => '<',
:LESSEQUAL => '<=',
@@ -551,7 +551,7 @@ describe "Puppet::Parser::Lexer in the old tests" do
it "should correctly parse names with numerals" do
string = %w{1name name1 11names names11}
-
+
string.each { |t|
@lexer.string = t
@lexer.fullscan.should == [[:NAME,t],[false,false]]
diff --git a/spec/unit/parser/parser.rb b/spec/unit/parser/parser.rb
index ef05bc876..2c34bb64b 100755
--- a/spec/unit/parser/parser.rb
+++ b/spec/unit/parser/parser.rb
@@ -40,7 +40,7 @@ describe Puppet::Parser do
end
it "boolean operation, it should create the correct ast objects" do
- ast::BooleanOperator.expects(:new).with {
+ ast::BooleanOperator.expects(:new).with {
|h| h[:rval].is_a?(ast::Boolean) and h[:lval].is_a?(ast::Boolean) and h[:operator]=="or"
}
@parser.parse("if true or true { $var = 1 }")
@@ -48,7 +48,7 @@ describe Puppet::Parser do
end
it "comparison operation, it should create the correct ast objects" do
- ast::ComparisonOperator.expects(:new).with {
+ ast::ComparisonOperator.expects(:new).with {
|h| h[:lval].is_a?(ast::Name) and h[:rval].is_a?(ast::Name) and h[:operator]=="<"
}
@parser.parse("if 1 < 2 { $var = 1 }")
@@ -60,10 +60,10 @@ describe Puppet::Parser do
describe Puppet::Parser, "when parsing if complex expressions" do
it "should create a correct ast tree" do
aststub = stub_everything 'ast'
- ast::ComparisonOperator.expects(:new).with {
+ ast::ComparisonOperator.expects(:new).with {
|h| h[:rval].is_a?(ast::Name) and h[:lval].is_a?(ast::Name) and h[:operator]==">"
}.returns(aststub)
- ast::ComparisonOperator.expects(:new).with {
+ ast::ComparisonOperator.expects(:new).with {
|h| h[:rval].is_a?(ast::Name) and h[:lval].is_a?(ast::Name) and h[:operator]=="=="
}.returns(aststub)
ast::BooleanOperator.expects(:new).with {
@@ -79,7 +79,7 @@ describe Puppet::Parser do
end
describe Puppet::Parser, "when parsing resource references" do
-
+
it "should not raise syntax errors" do
lambda { @parser.parse('exec { test: param => File["a"] }') }.should_not raise_error
end
@@ -87,18 +87,18 @@ describe Puppet::Parser do
it "should not raise syntax errors with multiple references" do
lambda { @parser.parse('exec { test: param => File["a","b"] }') }.should_not raise_error
end
-
+
it "should create an ast::ResourceReference" do
ast::Resource.stubs(:new)
- ast::ResourceReference.expects(:new).with { |arg|
+ ast::ResourceReference.expects(:new).with { |arg|
arg[:line]==1 and arg[:type]=="File" and arg[:title].is_a?(ast::ASTArray)
}
@parser.parse('exec { test: command => File["a","b"] }')
end
end
-
+
describe Puppet::Parser, "when parsing resource overrides" do
-
+
it "should not raise syntax errors" do
lambda { @parser.parse('Resource["title"] { param => value }') }.should_not raise_error
end
@@ -108,14 +108,14 @@ describe Puppet::Parser do
end
it "should create an ast::ResourceOverride" do
- ast::ResourceOverride.expects(:new).with { |arg|
+ ast::ResourceOverride.expects(:new).with { |arg|
arg[:line]==1 and arg[:object].is_a?(ast::ResourceReference) and arg[:params].is_a?(ast::ResourceParam)
}
@parser.parse('Resource["title1","title2"] { param => value }')
end
-
+
end
-
+
describe Puppet::Parser, "when parsing if statements" do
it "should not raise errors with empty if" do
@@ -172,7 +172,7 @@ describe Puppet::Parser do
lambda { @parser.parse("$a = [1,2,]") }.should_not raise_error
end
end
-
+
describe Puppet::Parser, "when instantiating class of same name" do
before :each do
diff --git a/spec/unit/provider/macauthorization.rb b/spec/unit/provider/macauthorization.rb
index 8c9636f16..8e0ba2456 100755
--- a/spec/unit/provider/macauthorization.rb
+++ b/spec/unit/provider/macauthorization.rb
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
-#
+#
# Unit testing for the macauthorization provider
#
@@ -11,20 +11,20 @@ require 'facter/util/plist'
provider_class = Puppet::Type.type(:macauthorization).provider(:macauthorization)
describe provider_class do
-
+
before :each do
# Create a mock resource
@resource = stub 'resource'
-
+
@authname = "foo.spam.eggs.puppettest"
@authplist = {}
-
+
@rules = {@authname => @authplist}
-
+
authdb = {}
authdb["rules"] = { "foorule" => "foo" }
authdb["rights"] = { "fooright" => "foo" }
-
+
# Stub out Plist::parse_xml
Plist.stubs(:parse_xml).returns(authdb)
@@ -38,42 +38,42 @@ describe provider_class do
@provider = provider_class.new(@resource)
end
-
+
it "should have a create method" do
@provider.should respond_to(:create)
end
-
+
it "should have a destroy method" do
@provider.should respond_to(:destroy)
end
-
+
it "should have an exists? method" do
@provider.should respond_to(:exists?)
end
-
+
it "should have a flush method" do
@provider.should respond_to(:flush)
end
-
+
properties = [ :allow_root, :authenticate_user, :auth_class, :comment,
:group, :k_of_n, :mechanisms, :rule, :session_owner,
:shared, :timeout, :tries, :auth_type ]
-
+
properties.each do |prop|
it "should have a #{prop.to_s} method" do
@provider.should respond_to(prop.to_s)
end
-
+
it "should have a #{prop.to_s}= method" do
@provider.should respond_to(prop.to_s + "=")
end
end
-
+
describe "when destroying a right" do
before :each do
@resource.stubs(:[]).with(:auth_type).returns(:right)
end
-
+
it "should call the internal method destroy_right" do
@provider.expects(:destroy_right)
@provider.destroy
@@ -83,41 +83,41 @@ describe provider_class do
@provider.destroy
end
end
-
+
describe "when destroying a rule" do
before :each do
@resource.stubs(:[]).with(:auth_type).returns(:rule)
end
-
+
it "should call the internal method destroy_rule" do
@provider.expects(:destroy_rule)
@provider.destroy
end
end
-
+
describe "when flushing a right" do
before :each do
@resource.stubs(:[]).with(:auth_type).returns(:right)
end
-
+
it "should call the internal method flush_right" do
@provider.expects(:flush_right)
@provider.flush
end
-
+
it "should call the internal method set_right" do
@provider.expects(:set_right)
@provider.flush
end
-
+
it "should read and write to the auth database with the right arguments" do
- @provider.expects(:execute).with() { |cmds, args|
+ @provider.expects(:execute).with() { |cmds, args|
cmds.include?("read") and
cmds.include?(@authname) and
args[:combine] == false
}.once
-
- @provider.expects(:execute).with() { |cmds, args|
+
+ @provider.expects(:execute).with() { |cmds, args|
cmds.include?("write") and
cmds.include?(@authname) and
args[:combine] == false and
@@ -125,23 +125,23 @@ describe provider_class do
}.once
@provider.flush
end
-
+
end
-
+
describe "when flushing a rule" do
before :each do
@resource.stubs(:[]).with(:auth_type).returns(:rule)
end
-
+
it "should call the internal method flush_rule" do
@provider.expects(:flush_rule)
@provider.flush
end
-
+
it "should call the internal method set_rule" do
@provider.expects(:set_rule)
@provider.flush
end
end
-end \ No newline at end of file
+end
diff --git a/spec/unit/provider/mcx/mcxcontent.rb b/spec/unit/provider/mcx/mcxcontent.rb
index eedff7dad..d8f431afe 100755
--- a/spec/unit/provider/mcx/mcxcontent.rb
+++ b/spec/unit/provider/mcx/mcxcontent.rb
@@ -3,8 +3,8 @@
# Copyright (C) 2008 Jeffrey J McCune.
# This program and entire repository is free software; you can
-# redistribute it and/or modify it under the terms of the GNU
-# General Public License as published by the Free Software
+# redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software
# Foundation; either version 2 of the License, or any later version.
# This program is distributed in the hope that it will be useful,
@@ -74,11 +74,11 @@ describe provider_class do
it "should execute external command dscl from :create" do
@provider.class.expects(:dscl).returns('').once
@provider.create
- end
+ end
it "should execute external command dscl from :destroy" do
@provider.class.expects(:dscl).with('localhost', '-mcxdelete', @ds_path).returns('').once
@provider.destroy
- end
+ end
it "should execute external command dscl from :exists?" do
@provider.class.expects(:dscl).with('localhost', '-mcxexport', @ds_path).returns('').once
@provider.exists?
diff --git a/spec/unit/provider/package/apt.rb b/spec/unit/provider/package/apt.rb
index 0ec1cd9ed..25d74bf90 100755
--- a/spec/unit/provider/package/apt.rb
+++ b/spec/unit/provider/package/apt.rb
@@ -98,40 +98,40 @@ Version table:
it "should use 'apt-get install' with the package name if no version is asked for" do
@resource.expects(:[]).with(:ensure).returns :installed
@provider.expects(:aptget).with { |*command| command[-1] == "asdf" and command[-2] == :install }
-
+
@provider.install
end
it "should specify the package version if one is asked for" do
@resource.expects(:[]).with(:ensure).returns "1.0"
@provider.expects(:aptget).with { |*command| command[-1] == "asdf=1.0" }
-
+
@provider.install
end
it "should do a quiet install" do
@provider.expects(:aptget).with { |*command| command.include?("-q") }
-
+
@provider.install
end
it "should default to 'yes' for all questions" do
@provider.expects(:aptget).with { |*command| command.include?("-y") }
-
+
@provider.install
end
it "should keep config files if asked" do
@resource.expects(:[]).with(:configfiles).returns :keep
@provider.expects(:aptget).with { |*command| command.include?("DPkg::Options::=--force-confold") }
-
+
@provider.install
end
it "should replace config files if asked" do
@resource.expects(:[]).with(:configfiles).returns :replace
@provider.expects(:aptget).with { |*command| command.include?("DPkg::Options::=--force-confnew") }
-
+
@provider.install
end
end
diff --git a/spec/unit/provider/package/pkgdmg.rb b/spec/unit/provider/package/pkgdmg.rb
index ea65ba2d4..d43757401 100755
--- a/spec/unit/provider/package/pkgdmg.rb
+++ b/spec/unit/provider/package/pkgdmg.rb
@@ -8,11 +8,11 @@ describe provider do
before do
@resource = stub 'resource', :[] => "dummypkgdmg"
@provider = provider.new(@resource)
-
+
@fakemountpoint = "/tmp/dmg.foo"
@fakehdiutilinfo = {"system-entities" => [{"mount-point" => @fakemountpoint}] }
@fakehdiutilplist = Plist::Emit.dump(@fakehdiutilinfo)
-
+
@hdiutilmountargs = ["mount", "-plist", "-nobrowse", "-readonly",
"-noidme", "-mountrandom", "/tmp"]
end
@@ -20,17 +20,17 @@ describe provider do
it "should not be versionable" do
provider.versionable?.should be_false
end
-
+
it "should not be uninstallable" do
provider.uninstallable?.should be_false
end
-
+
describe "when installing it should fail when" do
it "no source is specified" do
@resource.stubs(:[]).with(:source).returns nil
lambda { @provider.install }.should raise_error(Puppet::Error)
end
-
+
it "no name is specified" do
@resource.stubs(:[]).with(:name).returns nil
lambda { @provider.install }.should raise_error(Puppet::Error)
@@ -40,13 +40,13 @@ describe provider do
@resource.stubs(:[]).with(:source).returns "notendingindotdmg"
lambda { @provider.install }.should raise_error(Puppet::Error)
end
-
+
it "a disk image with no system entities is mounted" do
@provider.stubs(:[]).with(:hdiutil).returns ""
lambda { @provider.install }.should raise_error(Puppet::Error)
end
end
-
+
# These tests shouldn't be this messy. The pkgdmg provider needs work...
describe "when installing" do
before do
@@ -55,14 +55,14 @@ describe provider do
@resource.stubs(:[]).with(:source).returns "foo.dmg"
File.stubs(:open).yields fh
end
-
+
it "should call hdiutil to mount and eject the disk image" do
Dir.stubs(:entries).returns []
@provider.class.expects(:hdiutil).with("eject", @fakemountpoint).returns 0
@provider.class.expects(:hdiutil).with("mount", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", "/tmp", nil).returns @fakehdiutilplist
@provider.install
end
-
+
it "should call installpkg if a pkg/mpkg is found on the dmg" do
Dir.stubs(:entries).returns ["foo.pkg"]
@provider.class.stubs(:hdiutil).returns @fakehdiutilplist
diff --git a/spec/unit/provider/selboolean.rb b/spec/unit/provider/selboolean.rb
index 4006df151..2004485ca 100755
--- a/spec/unit/provider/selboolean.rb
+++ b/spec/unit/provider/selboolean.rb
@@ -26,7 +26,7 @@ describe provider_class do
@provider.expects(:execpipe).with("/usr/sbin/setsebool foo off")
@provider.value = :off
end
-
+
it "should call execpipe with -P when updating persistent boolean setting" do
@resource.stubs(:[]).with(:persistent).returns :true
@provider.expects(:command).with(:setsebool).returns "/usr/sbin/setsebool"
diff --git a/spec/unit/provider/selmodule.rb b/spec/unit/provider/selmodule.rb
index e92441d23..5f60322d8 100755
--- a/spec/unit/provider/selmodule.rb
+++ b/spec/unit/provider/selmodule.rb
@@ -16,7 +16,7 @@ describe provider_class do
@provider = provider_class.new(@resource)
end
- describe "exists? method" do
+ 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"]
@@ -45,7 +45,7 @@ describe provider_class do
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_loaded).returns "1.5.0"
@provider.expects(:selmodversion_file).returns "1.5.0"
@provider.syncversion.should == :true
end
diff --git a/spec/unit/provider/service/daemontools.rb b/spec/unit/provider/service/daemontools.rb
index 29e9dd5be..2e9abaca8 100644
--- a/spec/unit/provider/service/daemontools.rb
+++ b/spec/unit/provider/service/daemontools.rb
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
-#
+#
# Unit testing for the Daemontools service Provider
#
# author Brice Figureau
@@ -32,7 +32,7 @@ describe provider_class do
@provider.stubs(:resource).returns @resource
end
-
+
it "should have a restartcmd method" do
@provider.should respond_to(:restartcmd)
end
diff --git a/spec/unit/provider/service/launchd.rb b/spec/unit/provider/service/launchd.rb
index 8e657a622..b2c51a4d6 100755
--- a/spec/unit/provider/service/launchd.rb
+++ b/spec/unit/provider/service/launchd.rb
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
-#
+#
# Unit testing for the launchd service provider
#
@@ -14,7 +14,7 @@ describe provider_class do
before :each do
# Create a mock resource
@resource = stub 'resource'
-
+
@provider = provider_class.new
@joblabel = "com.foo.food"
@jobplist = {}
@@ -30,7 +30,7 @@ describe provider_class do
# stub out the provider methods that actually touch the filesystem
# or execute commands
- @provider.stubs(:plist_from_label).returns([@joblabel, @jobplist])
+ @provider.stubs(:plist_from_label).returns([@joblabel, @jobplist])
@provider.stubs(:execute).returns("")
@provider.stubs(:resource).returns @resource
end
@@ -38,28 +38,28 @@ describe provider_class do
it "should have a start method for #{@provider.object_id}" do
@provider.should respond_to(:start)
end
-
+
it "should have a stop method" do
@provider.should respond_to(:stop)
end
-
+
it "should have an enabled? method" do
@provider.should respond_to(:enabled?)
end
-
+
it "should have an enable method" do
@provider.should respond_to(:enable)
end
-
+
it "should have a disable method" do
@provider.should respond_to(:disable)
end
-
+
it "should have a status method" do
@provider.should respond_to(:status)
end
-
-
+
+
describe "when checking status" do
it "should call the external command 'launchctl list' once" do
@provider.expects(:launchctl).with(:list).returns("rotating-strawberry-madonnas")
@@ -74,7 +74,7 @@ describe provider_class do
@provider.status.should == :running
end
end
-
+
describe "when starting the service" do
it "should look for the relevant plist once" do
@provider.expects(:plist_from_label).once
@@ -97,7 +97,7 @@ describe provider_class do
@provider.start
end
end
-
+
describe "when stopping the service" do
it "should look for the relevant plist once" do
@provider.expects(:plist_from_label).once
@@ -120,7 +120,7 @@ describe provider_class do
@provider.stop
end
end
-
+
describe "when enabling the service" do
it "should look for the relevant plist once" do
@provider.expects(:plist_from_label).once
@@ -131,12 +131,12 @@ describe provider_class do
@provider.stop
end
end
-
+
describe "when disabling the service" do
it "should look for the relevant plist once" do
@provider.expects(:plist_from_label).once
@provider.stop
end
end
-
+
end
diff --git a/spec/unit/provider/service/runit.rb b/spec/unit/provider/service/runit.rb
index 8eb53849b..b0c5dd896 100644
--- a/spec/unit/provider/service/runit.rb
+++ b/spec/unit/provider/service/runit.rb
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
-#
+#
# Unit testing for the Runit service Provider
#
# author Brice Figureau
diff --git a/spec/unit/provider/user/ldap.rb b/spec/unit/provider/user/ldap.rb
index f1c571779..a004e2081 100755
--- a/spec/unit/provider/user/ldap.rb
+++ b/spec/unit/provider/user/ldap.rb
@@ -27,7 +27,7 @@ describe provider_class do
it "should be able to manage passwords" do
provider_class.should be_manages_passwords
end
-
+
it "should use the ldap group provider to convert group names to numbers" do
provider = provider_class.new(:name => "foo")
Puppet::Type.type(:group).provider(:ldap).expects(:name2id).with("bar").returns 10
diff --git a/spec/unit/provider/user/user_role_add.rb b/spec/unit/provider/user/user_role_add.rb
index 49359eb10..781eba428 100644
--- a/spec/unit/provider/user/user_role_add.rb
+++ b/spec/unit/provider/user/user_role_add.rb
@@ -239,7 +239,7 @@ describe provider_class do
File.stubs(:rename)
@provider.password=("hashedpassword")
end
-
+
it "should rename the /etc/shadow_tmp to /etc/shadow" do
File.stubs(:open).with("/etc/shadow", "r")
File.expects(:rename).with("/etc/shadow_tmp", "/etc/shadow")
diff --git a/spec/unit/provider/zfs/solaris.rb b/spec/unit/provider/zfs/solaris.rb
index 9189e44f0..8167340ce 100755
--- a/spec/unit/provider/zfs/solaris.rb
+++ b/spec/unit/provider/zfs/solaris.rb
@@ -43,15 +43,15 @@ describe provider_class do
@provider.delete
end
end
-
+
describe "when calling exist?" do
it "should call zfs with :list" do
#return stuff because we have to slice and dice it
@provider.expects(:zfs).with(:list).returns("NAME USED AVAIL REFER MOUNTPOINT\nmyzfs 100K 27.4M /myzfs")
@provider.exists?
end
-
- it "should return true if returned values match the name" do
+
+ it "should return true if returned values match the name" do
@provider.stubs(:zfs).with(:list).returns("NAME USED AVAIL REFER MOUNTPOINT\n#{@resource[:name]} 100K 27.4M /myzfs")
@provider.exists?.should == true
end
@@ -60,7 +60,7 @@ describe provider_class do
@provider.stubs(:zfs).with(:list).returns("no soup for you")
@provider.exists?.should == false
end
-
+
end
[:mountpoint, :compression, :copies, :quota, :reservation, :sharenfs, :snapdir].each do |prop|
diff --git a/spec/unit/provider/zone/solaris.rb b/spec/unit/provider/zone/solaris.rb
index b7dd74705..4f061fef0 100755
--- a/spec/unit/provider/zone/solaris.rb
+++ b/spec/unit/provider/zone/solaris.rb
@@ -25,7 +25,7 @@ describe provider_class do
@provider.expects(:zoneadm)
@provider.install
end
-
+
it "should just install if there are no install args" do
@resource.stubs(:[]).with(:install_args).returns(nil)
@provider.expects(:zoneadm).with(:install)
diff --git a/spec/unit/rails.rb b/spec/unit/rails.rb
index df3f149da..d98c88774 100755
--- a/spec/unit/rails.rb
+++ b/spec/unit/rails.rb
@@ -18,18 +18,18 @@ describe Puppet::Rails, "when initializing any connection" do
it "should use settings" do
Puppet.settings.expects(:use).with(:main, :rails, :puppetmasterd)
-
+
Puppet::Rails.connect
end
-
+
it "should set up a logger with the appropriate Rails log file" do
logger = mock 'logger'
Logger.expects(:new).with(Puppet[:railslog]).returns(logger)
ActiveRecord::Base.expects(:logger=).with(logger)
-
+
Puppet::Rails.connect
end
-
+
it "should set the log level to whatever the value is in the settings" do
Puppet.settings.stubs(:use)
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("debug")
@@ -42,20 +42,20 @@ describe Puppet::Rails, "when initializing any connection" do
ActiveRecord::Base.stubs(:verify_active_connections!)
ActiveRecord::Base.stubs(:establish_connection)
Puppet::Rails.stubs(:database_arguments)
-
+
Puppet::Rails.connect
end
-
+
it "should call ActiveRecord::Base.verify_active_connections!" do
ActiveRecord::Base.expects(:verify_active_connections!)
-
+
Puppet::Rails.connect
end
-
+
it "should call ActiveRecord::Base.establish_connection with database_arguments" do
Puppet::Rails.expects(:database_arguments)
ActiveRecord::Base.expects(:establish_connection)
-
+
Puppet::Rails.connect
end
end
@@ -67,7 +67,7 @@ describe Puppet::Rails, "when initializing a sqlite3 connection" do
Puppet.settings.expects(:value).with(:dbadapter).returns("sqlite3")
Puppet.settings.expects(:value).with(:rails_loglevel).returns("testlevel")
Puppet.settings.expects(:value).with(:dblocation).returns("testlocation")
-
+
Puppet::Rails.database_arguments.should == {
:adapter => "sqlite3",
:log_level => "testlevel",
@@ -87,7 +87,7 @@ describe Puppet::Rails, "when initializing a mysql or postgresql connection" do
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
Puppet.settings.stubs(:value).with(:dbsocket).returns("")
-
+
Puppet::Rails.database_arguments.should == {
:adapter => "mysql",
:log_level => "testlevel",
@@ -97,7 +97,7 @@ describe Puppet::Rails, "when initializing a mysql or postgresql connection" do
:database => "testname"
}
end
-
+
it "should provide the adapter, log_level, and host, username, password, database, and socket arguments" do
Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql")
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
@@ -106,7 +106,7 @@ describe Puppet::Rails, "when initializing a mysql or postgresql connection" do
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
-
+
Puppet::Rails.database_arguments.should == {
:adapter => "mysql",
:log_level => "testlevel",
diff --git a/spec/unit/resource/catalog.rb b/spec/unit/resource/catalog.rb
index bf46f25cd..cf6a87461 100755
--- a/spec/unit/resource/catalog.rb
+++ b/spec/unit/resource/catalog.rb
@@ -114,7 +114,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
bucket.expects(:type=).with("Class")
bucket.expects(:name=).with(:main)
main.stubs(:builtin?).returns(false)
-
+
Puppet::TransBucket.expects(:new).returns bucket
config.extract_to_transportable.should equal(bucket)
@@ -380,7 +380,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
@catalog.make_default_resources
@catalog.resource(:schedule, "daily").should_not be_nil
end
-
+
it "should optionally support an initialization block and should finalize after such blocks" do
@one.expects :finish
@two.expects :finish
@@ -539,7 +539,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
@transaction.expects :cleanup
@catalog.apply
end
-
+
it "should return the transaction" do
@catalog.apply.should equal(@transaction)
end
@@ -549,7 +549,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
trans.should equal(@transaction)
end
end
-
+
it "should default to not being a host catalog" do
@catalog.host_config.should be_nil
end
@@ -589,7 +589,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
@transaction.stubs(:addtimes)
file = Puppet::Type.type(:file).new(:name => "/yay", :ensure => :file)
@catalog.apply do |trans|
- @catalog.add_resource file
+ @catalog.add_resource file
@catalog.resource("File[/yay]").should_not be_nil
end
@catalog.resource("File[/yay]").should be_nil
@@ -644,7 +644,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
before do
@catalog.host_config = false
end
-
+
it "should never send reports" do
Puppet[:report] = true
Puppet[:summarize] = true
diff --git a/spec/unit/simple_graph.rb b/spec/unit/simple_graph.rb
index 739ce4ee8..22d6ebe3d 100755
--- a/spec/unit/simple_graph.rb
+++ b/spec/unit/simple_graph.rb
@@ -251,7 +251,7 @@ describe Puppet::SimpleGraph do
@graph.vertex?(:one).should be_true
@graph.vertex?(:two).should be_true
end
-
+
it "should retain labels on edges" do
@graph.add_edge(:one, :two, :callback => :awesome)
edge = @graph.reversal.edge(:two, :one)
@@ -377,7 +377,7 @@ describe Puppet::SimpleGraph do
describe "when determining dependencies" do
before do
@graph = Puppet::SimpleGraph.new
-
+
@graph.add_edge("a", "b")
@graph.add_edge("a", "c")
@graph.add_edge("b", "d")
@@ -402,7 +402,7 @@ describe Puppet::SimpleGraph do
it "should find single dependencies" do
@graph.dependencies("c").sort.should == %w{a}
end
-
+
it "should return an empty array when there are no dependencies" do
@graph.dependencies("a").sort.should == []
end
@@ -417,16 +417,16 @@ describe Puppet::SimpleGraph do
def each
@children.each do |c| yield c end
end
-
+
def initialize(name, ary)
@name = name
@children = ary
end
-
+
def push(*ary)
ary.each { |c| @children.push(c)}
end
-
+
def to_s
@name
end
diff --git a/spec/unit/ssl/certificate_authority.rb b/spec/unit/ssl/certificate_authority.rb
index fb30cb027..4c2466d93 100755
--- a/spec/unit/ssl/certificate_authority.rb
+++ b/spec/unit/ssl/certificate_authority.rb
@@ -274,7 +274,7 @@ describe Puppet::SSL::CertificateAuthority do
@ca.next_serial.should == 2
end
-
+
it "should write the next serial number to the serial file as hex" do
@filehandle.expects(:<<).with("0002")
@@ -552,7 +552,7 @@ describe Puppet::SSL::CertificateAuthority do
@ca.waiting?.should == %w{one two}
end
-
+
it "should delegate removing hosts to the Host class" do
Puppet::SSL::Host.expects(:destroy).with("myhost")
diff --git a/spec/unit/ssl/certificate_authority/interface.rb b/spec/unit/ssl/certificate_authority/interface.rb
index 617cfa6ba..784c6cf9a 100755
--- a/spec/unit/ssl/certificate_authority/interface.rb
+++ b/spec/unit/ssl/certificate_authority/interface.rb
@@ -107,7 +107,7 @@ describe Puppet::SSL::CertificateAuthority::Interface do
it "should call :generate on the CA for each host specified" do
@applier = @class.new(:generate, %w{host1 host2})
-
+
@ca.expects(:generate).with("host1")
@ca.expects(:generate).with("host2")
diff --git a/spec/unit/ssl/certificate_factory.rb b/spec/unit/ssl/certificate_factory.rb
index 822b330f2..089ce3f43 100755
--- a/spec/unit/ssl/certificate_factory.rb
+++ b/spec/unit/ssl/certificate_factory.rb
@@ -96,7 +96,7 @@ describe Puppet::SSL::CertificateFactory do
@factory.result
end
end
-
+
describe "when building extensions" do
it "should have tests"
end
diff --git a/spec/unit/ssl/host.rb b/spec/unit/ssl/host.rb
index e4140f44c..38a1f3ed9 100755
--- a/spec/unit/ssl/host.rb
+++ b/spec/unit/ssl/host.rb
@@ -673,7 +673,7 @@ describe Puppet::SSL::Host do
@host.expects(:exit).with(1).raises(SystemExit)
lambda { @host.wait_for_cert(0) }.should raise_error(SystemExit)
end
-
+
it "should exit if the wait time is 0 and it can neither find nor retrieve a certificate" do
@host.stubs(:certificate).returns nil
@host.expects(:generate)
diff --git a/spec/unit/transaction/change.rb b/spec/unit/transaction/change.rb
index 1f69311cd..9e0cedc5c 100755
--- a/spec/unit/transaction/change.rb
+++ b/spec/unit/transaction/change.rb
@@ -93,7 +93,7 @@ describe Puppet::Transaction::Change do
@change.stubs :event
@change.forward
end
-
+
it "should produce a :noop event and return" do
@property.stub_everything
diff --git a/spec/unit/type.rb b/spec/unit/type.rb
index 1d7f0d1a1..a9e48a274 100755
--- a/spec/unit/type.rb
+++ b/spec/unit/type.rb
@@ -128,7 +128,7 @@ describe Puppet::Type do
it "should use the name from the hash as the title if no explicit title is provided" do
Puppet::Type.type(:mount).new(:name => "/yay").title.should == "/yay"
end
-
+
it "should use the Resource Type's namevar to determine how to find the name in the hash" do
Puppet::Type.type(:file).new(:path => "/yay").title.should == "/yay"
end
@@ -233,7 +233,7 @@ describe Puppet::Type do
it "should use the name from the hash as the title if no explicit title is provided" do
@type.hash2resource(:name => "foo").title.should == "foo"
end
-
+
it "should use the Resource Type's namevar to determine how to find the name in the hash" do
@type.stubs(:namevar).returns :myname
diff --git a/spec/unit/type/augeas.rb b/spec/unit/type/augeas.rb
index 4a605f8f2..ff34d57ca 100644
--- a/spec/unit/type/augeas.rb
+++ b/spec/unit/type/augeas.rb
@@ -11,10 +11,10 @@ describe augeas do
it "should have a default provider inheriting from Puppet::Provider" do
augeas.defaultprovider.ancestors.should be_include(Puppet::Provider)
end
-
+
it "should have a valid provider" do
augeas.new(:name => "foo").provider.class.ancestors.should be_include(Puppet::Provider)
- end
+ end
end
describe "basic structure" do
@@ -27,14 +27,14 @@ describe augeas do
it "should have an parse_commands feature" do
augeas.provider_feature(:parse_commands).should_not be_nil
end
-
+
it "should have an need_to_run? feature" do
augeas.provider_feature(:need_to_run?).should_not be_nil
- end
-
+ end
+
it "should have an execute_changes feature" do
augeas.provider_feature(:execute_changes).should_not be_nil
- end
+ end
properties = [:returns]
params = [:name, :context, :onlyif, :changes, :root, :load_path, :type_check]
@@ -47,8 +47,8 @@ describe augeas do
it "should have documentation for its %s property" % property do
augeas.attrclass(property).doc.should be_instance_of(String)
end
- end
-
+ end
+
params.each do |param|
it "should have a %s parameter" % param do
augeas.attrclass(param).ancestors.should be_include(Puppet::Parameter)
@@ -57,9 +57,9 @@ describe augeas do
it "should have documentation for its %s parameter" % param do
augeas.attrclass(param).doc.should be_instance_of(String)
end
- end
+ end
end
-
+
describe "default values" do
before do
provider_class = augeas.provider(augeas.providers[0])
@@ -69,24 +69,24 @@ describe augeas do
it "should be blank for context" do
augeas.new(:name => :context)[:context].should == ""
end
-
+
it "should be blank for onlyif" do
augeas.new(:name => :onlyif)[:onlyif].should == ""
- end
-
+ end
+
it "should be blank for load_path" do
augeas.new(:name => :load_path)[:load_path].should == ""
- end
-
+ end
+
it "should be / for root" do
augeas.new(:name => :root)[:root].should == "/"
- end
-
+ end
+
it "should be false for type_check" do
augeas.new(:name => :type_check)[:type_check].should == :false
- end
+ end
end
-
+
describe "provider interaction" do
it "should munge the changes" do
provider = stub("provider", :parse_commands => "Jar Jar Binks")
@@ -95,19 +95,19 @@ describe augeas do
changes.value= "Testing 123"
changes.value.should == "Jar Jar Binks"
end
-
+
it "should return 0 if it does not need to run" do
provider = stub("provider", :need_to_run? => false)
resource = stub('resource', :resource => nil, :provider => provider, :line => nil, :file => nil)
changes = augeas.attrclass(:returns).new(:resource => resource)
changes.retrieve.should == 0
- end
-
+ end
+
it "should return :need_to_run if it needs to run" do
provider = stub("provider", :need_to_run? => true)
resource = stub('resource', :resource => nil, :provider => provider, :line => nil, :file => nil)
changes = augeas.attrclass(:returns).new(:resource => resource)
changes.retrieve.should == :need_to_run
- end
+ end
end
end
diff --git a/spec/unit/type/component.rb b/spec/unit/type/component.rb
index 99421f81d..64d26d5e2 100755
--- a/spec/unit/type/component.rb
+++ b/spec/unit/type/component.rb
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
-
+
require File.dirname(__FILE__) + '/../../spec_helper'
component = Puppet::Type.type(:component)
diff --git a/spec/unit/type/computer.rb b/spec/unit/type/computer.rb
index 26299487e..c81ee45ee 100755
--- a/spec/unit/type/computer.rb
+++ b/spec/unit/type/computer.rb
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
-
+
require File.dirname(__FILE__) + '/../../spec_helper'
computer = Puppet::Type.type(:computer)
@@ -15,16 +15,16 @@ describe Puppet::Type.type(:computer), " when checking computer objects" do
@properties = {}
@ensure = Puppet::Type::Computer.attrclass(:ensure).new(:resource => @resource)
end
-
+
it "should be able to create a instance" do
provider_class = Puppet::Type::Computer.provider(Puppet::Type::Computer.providers[0])
Puppet::Type::Computer.expects(:defaultprovider).returns provider_class
computer.new(:name => "bar").should_not be_nil
end
-
+
properties = [:en_address, :ip_address]
params = [:name]
-
+
properties.each do |property|
it "should have a %s property" % property do
computer.attrclass(property).ancestors.should be_include(Puppet::Property)
@@ -33,14 +33,14 @@ describe Puppet::Type.type(:computer), " when checking computer objects" do
it "should have documentation for its %s property" % property do
computer.attrclass(property).doc.should be_instance_of(String)
end
-
+
it "should accept :absent as a value" do
prop = computer.attrclass(property).new(:resource => @resource)
prop.should = :absent
prop.should.must == :absent
end
end
-
+
params.each do |param|
it "should have a %s parameter" % param do
computer.attrclass(param).ancestors.should be_include(Puppet::Parameter)
@@ -50,7 +50,7 @@ describe Puppet::Type.type(:computer), " when checking computer objects" do
computer.attrclass(param).doc.should be_instance_of(String)
end
end
-
+
describe "default values" do
before do
provider_class = computer.provider(computer.providers[0])
@@ -60,17 +60,17 @@ describe Puppet::Type.type(:computer), " when checking computer objects" do
it "should be nil for en_address" do
computer.new(:name => :en_address)[:en_address].should == nil
end
-
+
it "should be nil for ip_address" do
computer.new(:name => :ip_address)[:ip_address].should == nil
end
end
-
- describe "when managing the ensure property" do
+
+ describe "when managing the ensure property" do
it "should support a :present value" do
lambda { @ensure.should = :present }.should_not raise_error
end
-
+
it "should support an :absent value" do
lambda { @ensure.should = :absent }.should_not raise_error
end
diff --git a/spec/unit/type/file.rb b/spec/unit/type/file.rb
index 582cc1f81..efe2ac251 100755
--- a/spec/unit/type/file.rb
+++ b/spec/unit/type/file.rb
@@ -443,7 +443,7 @@ describe Puppet::Type.type(:file) do
it "should store the metadata in the source property for each resource so the source does not have to requery the metadata" do
@file.stubs(:perform_recursion).returns [@first]
@resource.expects(:parameter).with(:source).returns @parameter
-
+
@parameter.expects(:metadata=).with(@first)
@file.recurse_remote("first" => @resource)
@@ -463,7 +463,7 @@ describe Puppet::Type.type(:file) do
@file.stubs(:perform_recursion).returns [@first]
@file.parameter(:source).expects(:metadata=).with @first
-
+
@file.recurse_remote("first" => @resource)
end
diff --git a/spec/unit/type/file/content.rb b/spec/unit/type/file/content.rb
index 0529cd33f..8bdb1f226 100755
--- a/spec/unit/type/file/content.rb
+++ b/spec/unit/type/file/content.rb
@@ -34,7 +34,7 @@ describe content do
@content = content.new(:resource => @resource)
@content.checksum_type.should == :litemd5
end
-
+
it "should only return the checksum type from the checksum parameter if the parameter returns a whole checksum" do
checksum = mock 'checksum'
checksum.expects(:checktype).returns "{md5}something"
diff --git a/spec/unit/type/macauthorization.rb b/spec/unit/type/macauthorization.rb
index 5873265f5..191a16bd0 100755
--- a/spec/unit/type/macauthorization.rb
+++ b/spec/unit/type/macauthorization.rb
@@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../spec_helper'
macauth_type = Puppet::Type.type(:macauthorization)
describe Puppet::Type.type(:macauthorization), "when checking macauthorization objects" do
-
+
before do
authplist = {}
authplist["rules"] = { "foorule" => "foo" }
@@ -14,60 +14,60 @@ describe Puppet::Type.type(:macauthorization), "when checking macauthorization o
Plist.stubs(:parse_xml).with("/etc/authorization").returns(authplist)
macauth_type.stubs(:defaultprovider).returns provider_class
end
-
+
describe "when validating attributes" do
-
+
parameters = [:name,]
- properties = [:auth_type, :allow_root, :authenticate_user, :auth_class,
- :comment, :group, :k_of_n, :mechanisms, :rule,
+ properties = [:auth_type, :allow_root, :authenticate_user, :auth_class,
+ :comment, :group, :k_of_n, :mechanisms, :rule,
:session_owner, :shared, :timeout, :tries]
-
+
parameters.each do |parameter|
it "should have a %s parameter" % parameter do
macauth_type.attrclass(parameter).ancestors.should be_include(Puppet::Parameter)
end
-
+
it "should have documentation for its %s parameter" % parameter do
macauth_type.attrclass(parameter).doc.should be_instance_of(String)
end
end
-
+
properties.each do |property|
it "should have a %s property" % property do
macauth_type.attrclass(property).ancestors.should be_include(Puppet::Property)
end
-
+
it "should have documentation for its %s property" % property do
macauth_type.attrclass(property).doc.should be_instance_of(String)
end
end
-
+
end
-
+
describe "when validating properties" do
-
+
it "should have a default provider inheriting from Puppet::Provider" do
macauth_type.defaultprovider.ancestors.should be_include(Puppet::Provider)
end
-
+
it "should be able to create an instance" do
lambda {
macauth_type.new(:name => 'foo')
}.should_not raise_error
end
-
+
it "should support :present as a value to :ensure" do
lambda {
macauth_type.new(:name => "foo", :ensure => :present)
}.should_not raise_error
end
-
+
it "should support :absent as a value to :ensure" do
lambda {
macauth_type.new(:name => "foo", :ensure => :absent)
}.should_not raise_error
end
-
+
end
end
diff --git a/spec/unit/type/mcx.rb b/spec/unit/type/mcx.rb
index eee7793d8..8b5dfb073 100755
--- a/spec/unit/type/mcx.rb
+++ b/spec/unit/type/mcx.rb
@@ -3,8 +3,8 @@
# Copyright (C) 2008 Jeffrey J McCune.
# This program and entire repository is free software; you can
-# redistribute it and/or modify it under the terms of the GNU
-# General Public License as published by the Free Software
+# redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software
# Foundation; either version 2 of the License, or any later version.
# This program is distributed in the hope that it will be useful,
diff --git a/spec/unit/type/tidy.rb b/spec/unit/type/tidy.rb
index cf244ca0e..caf5b22b7 100755
--- a/spec/unit/type/tidy.rb
+++ b/spec/unit/type/tidy.rb
@@ -15,7 +15,7 @@ describe tidy do
File.expects(:lstat).with("/foo/bar").returns stat
resource.stat("/foo/bar").should == stat
end
-
+
[:age, :size, :path, :matches, :type, :recurse, :rmdirs].each do |param|
it "should have a %s parameter" % param do
Puppet::Type.type(:tidy).attrclass(param).ancestors.should be_include(Puppet::Parameter)
diff --git a/spec/unit/util/cache_accumulator.rb b/spec/unit/util/cache_accumulator.rb
index 55ecb7e34..2d976d0b1 100644
--- a/spec/unit/util/cache_accumulator.rb
+++ b/spec/unit/util/cache_accumulator.rb
@@ -56,7 +56,7 @@ describe Puppet::Util::CacheAccumulator do
name = 'foo'
@test_class.expects(:find_or_create_by_name).with(name).returns(@test_class.new(name)).once
@alt_class.expects(:find_or_create_by_name).with(name).returns(@alt_class.new(name)).once
-
+
[@test_class, @alt_class].each do |klass|
klass.accumulate_by_name(name).name.should == name
klass.accumulate_by_name(name).class.should == klass
diff --git a/spec/unit/util/cacher.rb b/spec/unit/util/cacher.rb
index a1dd17adb..40688bc88 100755
--- a/spec/unit/util/cacher.rb
+++ b/spec/unit/util/cacher.rb
@@ -123,7 +123,7 @@ describe Puppet::Util::Cacher do
it "should allow specification of a ttl for cached attributes" do
klass = Class.new do
- include Puppet::Util::Cacher
+ include Puppet::Util::Cacher
end
klass.cached_attr(:myattr, :ttl => 5) { Time.now }
@@ -133,7 +133,7 @@ describe Puppet::Util::Cacher do
it "should allow specification of a ttl as a string" do
klass = Class.new do
- include Puppet::Util::Cacher
+ include Puppet::Util::Cacher
end
klass.cached_attr(:myattr, :ttl => "5") { Time.now }
@@ -143,7 +143,7 @@ describe Puppet::Util::Cacher do
it "should fail helpfully if the ttl cannot be converted to an integer" do
klass = Class.new do
- include Puppet::Util::Cacher
+ include Puppet::Util::Cacher
end
lambda { klass.cached_attr(:myattr, :ttl => "yep") { Time.now } }.should raise_error(ArgumentError)
@@ -151,7 +151,7 @@ describe Puppet::Util::Cacher do
it "should not check for a ttl expiration if the class does not support that method" do
klass = Class.new do
- extend Puppet::Util::Cacher
+ extend Puppet::Util::Cacher
end
klass.metaclass.cached_attr(:myattr) { "eh" }
@@ -163,7 +163,7 @@ describe Puppet::Util::Cacher do
def self.to_s
"CacheTestClass"
end
- include Puppet::Util::Cacher
+ include Puppet::Util::Cacher
attr_accessor :value
end
diff --git a/spec/unit/util/package.rb b/spec/unit/util/package.rb
index 7d956efb5..45eef4643 100644
--- a/spec/unit/util/package.rb
+++ b/spec/unit/util/package.rb
@@ -14,8 +14,8 @@ describe Puppet::Util::Package, " versioncmp" do
ary = %w{ 1.1.6 2.3 1.1a 3.0 1.5 1 2.4 1.1-4 2.3.1 1.2 2.3.0 1.1-3 2.4b 2.4 2.40.2 2.3a.1 3.1 0002 1.1-5 1.1.a 1.06}
newary = ary.sort { |a, b| Puppet::Util::Package.versioncmp(a,b) }
-
+
newary.should == ["0002", "1", "1.06", "1.1-3", "1.1-4", "1.1-5", "1.1.6", "1.1.a", "1.1a", "1.2", "1.5", "2.3", "2.3.0", "2.3.1", "2.3a.1", "2.4", "2.4", "2.4b", "2.40.2", "3.0", "3.1"]
end
-
+
end
diff --git a/spec/unit/util/selinux.rb b/spec/unit/util/selinux.rb
index db3ee413a..d5ec6d2d4 100644
--- a/spec/unit/util/selinux.rb
+++ b/spec/unit/util/selinux.rb
@@ -49,7 +49,7 @@ describe Puppet::Util::SELinux do
it "should match a path on / to ext3" do
find_fs('/etc/puppet/testfile').should == "ext3"
end
-
+
it "should match a path on /mnt/nfs to nfs" do
find_fs('/mnt/nfs/testfile/foobar').should == "nfs"
end
@@ -112,7 +112,7 @@ describe Puppet::Util::SELinux do
self.expects(:find_fs).with("/foo").returns "nfs"
get_selinux_default_context("/foo").should be_nil
end
-
+
end
describe "parse_selinux_context" do
diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb
index 0bf2dbb19..c700c0c5f 100755
--- a/spec/unit/util/settings.rb
+++ b/spec/unit/util/settings.rb
@@ -2,7 +2,7 @@
require File.dirname(__FILE__) + '/../../spec_helper'
-describe Puppet::Util::Settings do
+describe Puppet::Util::Settings do
describe "when specifying defaults" do
before do
@settings = Puppet::Util::Settings.new
@@ -521,7 +521,7 @@ describe Puppet::Util::Settings do
# Now replace the value
text = "[main]\none = disk-replace\n"
-
+
# This is kinda ridiculous - the reason it parses twice is that
# it goes to parse again when we ask for the value, because the
# mock always says it should get reparsed.
diff --git a/spec/unit/util/storage.rb b/spec/unit/util/storage.rb
index 7fdc3650d..a7dea4001 100755
--- a/spec/unit/util/storage.rb
+++ b/spec/unit/util/storage.rb
@@ -95,7 +95,7 @@ describe Puppet::Util::Storage do
@path = transient.path()
transient.close!()
end
-
+
it "should not fail to load()" do
FileTest.exists?(@path).should be_false()
Puppet[:statedir] = @path
@@ -109,10 +109,10 @@ describe Puppet::Util::Storage do
Puppet::Util::Storage.cache(:yayness)
Puppet::Util::Storage.state().should == {:yayness=>{}}
-
+
Puppet[:statefile] = @path
proc { Puppet::Util::Storage.load() }.should_not raise_error()
-
+
Puppet::Util::Storage.state().should == {:yayness=>{}}
end
end
@@ -140,7 +140,7 @@ describe Puppet::Util::Storage do
proc { Puppet::Util::Storage.load() }.should_not raise_error()
Puppet::Util::Storage.state().should == test_yaml
end
-
+
it "should initialize with a clear internal state if the state file does not contain valid YAML" do
@state_file.write(:booness)
@state_file.flush()
@@ -184,7 +184,7 @@ describe Puppet::Util::Storage do
proc { Puppet::Util::Storage.load() }.should_not raise_error()
Puppet::Util::Storage.state().should == test_yaml
end
-
+
after(:each) do
@state_file.close!()
Puppet[:statefile] = @saved_statefile