summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/application/resource_spec.rb4
-rwxr-xr-xspec/unit/file_bucket/dipper_spec.rb20
-rwxr-xr-xspec/unit/file_serving/metadata_spec.rb10
-rwxr-xr-xspec/unit/indirector/file_bucket_file/file_spec.rb2
-rwxr-xr-xspec/unit/indirector/indirection_spec.rb8
-rwxr-xr-xspec/unit/indirector/node/active_record_spec.rb2
-rwxr-xr-xspec/unit/indirector/report/rest_spec.rb6
-rwxr-xr-xspec/unit/indirector/yaml_spec.rb52
-rw-r--r--spec/unit/network/authstore_spec.rb284
-rwxr-xr-xspec/unit/network/format_handler_spec.rb2
-rwxr-xr-xspec/unit/network/formats_spec.rb2
-rw-r--r--spec/unit/network/handler/fileserver_spec.rb14
-rwxr-xr-xspec/unit/network/rest_authconfig_spec.rb4
-rwxr-xr-xspec/unit/network/server_spec.rb12
-rwxr-xr-xspec/unit/node/environment_spec.rb2
-rwxr-xr-xspec/unit/node/facts_spec.rb2
-rw-r--r--spec/unit/other/selinux_spec.rb15
-rwxr-xr-xspec/unit/parser/ast/casestatement_spec.rb8
-rwxr-xr-xspec/unit/parser/ast/comparison_operator_spec.rb18
-rwxr-xr-xspec/unit/parser/ast/vardef_spec.rb6
-rw-r--r--spec/unit/parser/ast_spec.rb6
-rwxr-xr-xspec/unit/parser/functions/defined_spec.rb2
-rwxr-xr-xspec/unit/parser/functions/regsubst_spec.rb134
-rwxr-xr-xspec/unit/parser/functions/shellquote_spec.rb51
-rwxr-xr-xspec/unit/parser/functions/split_spec.rb24
-rwxr-xr-xspec/unit/parser/functions/sprintf_spec.rb5
-rwxr-xr-xspec/unit/parser/lexer_spec.rb8
-rwxr-xr-xspec/unit/parser/parser_spec.rb48
-rwxr-xr-xspec/unit/parser/resource_spec.rb2
-rwxr-xr-xspec/unit/parser/scope_spec.rb15
-rwxr-xr-xspec/unit/parser/templatewrapper_spec.rb14
-rw-r--r--spec/unit/property/list_spec.rb2
-rwxr-xr-xspec/unit/provider/mount/parsed_spec.rb4
-rwxr-xr-xspec/unit/provider/package/apt_spec.rb2
-rwxr-xr-xspec/unit/provider/package/dpkg_spec.rb6
-rw-r--r--spec/unit/provider/package/hpux_spec.rb2
-rwxr-xr-xspec/unit/provider/package/nim_spec.rb2
-rw-r--r--spec/unit/provider/package/pkg_spec.rb26
-rwxr-xr-xspec/unit/provider/package/pkgdmg_spec.rb10
-rw-r--r--spec/unit/provider/package/zypper_spec.rb8
-rwxr-xr-xspec/unit/provider/selmodule_spec.rb2
-rwxr-xr-xspec/unit/provider/service/daemontools_spec.rb2
-rwxr-xr-xspec/unit/provider/service/debian_spec.rb10
-rwxr-xr-xspec/unit/provider/service/init_spec.rb16
-rwxr-xr-xspec/unit/provider/service/launchd_spec.rb14
-rwxr-xr-xspec/unit/provider/service/redhat_spec.rb12
-rwxr-xr-xspec/unit/provider/service/runit_spec.rb2
-rwxr-xr-xspec/unit/provider/service/src_spec.rb6
-rwxr-xr-xspec/unit/provider/ssh_authorized_key/parsed_spec.rb34
-rwxr-xr-xspec/unit/provider/sshkey/parsed_spec.rb12
-rw-r--r--spec/unit/provider/user/user_role_add_spec.rb24
-rwxr-xr-xspec/unit/rails_spec.rb6
-rwxr-xr-xspec/unit/run_spec.rb5
-rwxr-xr-xspec/unit/ssl/certificate_authority/interface_spec.rb2
-rwxr-xr-xspec/unit/transaction/report_spec.rb6
-rwxr-xr-xspec/unit/transaction_spec.rb2
-rwxr-xr-xspec/unit/type/computer_spec.rb5
-rwxr-xr-xspec/unit/type/exec_spec.rb4
-rwxr-xr-xspec/unit/type/file/content_spec.rb4
-rwxr-xr-xspec/unit/type/file/group_spec.rb2
-rwxr-xr-xspec/unit/type/file/owner_spec.rb4
-rwxr-xr-xspec/unit/type/file_spec.rb9
-rwxr-xr-xspec/unit/type/macauthorization_spec.rb4
-rwxr-xr-xspec/unit/type/maillist_spec.rb2
-rwxr-xr-xspec/unit/type/mount_spec.rb8
-rw-r--r--spec/unit/type/resources_spec.rb118
-rwxr-xr-xspec/unit/type/schedule_spec.rb4
-rwxr-xr-xspec/unit/type/ssh_authorized_key_spec.rb22
-rwxr-xr-xspec/unit/type/zone_spec.rb15
-rw-r--r--spec/unit/util/cache_accumulator_spec.rb18
-rwxr-xr-xspec/unit/util/file_locking_spec.rb6
-rwxr-xr-xspec/unit/util/log_spec.rb4
-rwxr-xr-xspec/unit/util/selinux_spec.rb18
-rwxr-xr-xspec/unit/util/settings/file_setting_spec.rb2
-rwxr-xr-xspec/unit/util/settings_spec.rb2
-rw-r--r--spec/unit/util/user_attr_spec.rb2
-rw-r--r--spec/unit/util/zaml_spec.rb4
77 files changed, 660 insertions, 596 deletions
diff --git a/spec/unit/application/resource_spec.rb b/spec/unit/application/resource_spec.rb
index 939042977..71e35dc18 100755
--- a/spec/unit/application/resource_spec.rb
+++ b/spec/unit/application/resource_spec.rb
@@ -50,8 +50,8 @@ describe Puppet::Application::Resource do
end
it "should load Facter facts" do
- Facter.expects(:loadfacts).once
- @resource.preinit
+ Facter.expects(:loadfacts).once
+ @resource.preinit
end
end
diff --git a/spec/unit/file_bucket/dipper_spec.rb b/spec/unit/file_bucket/dipper_spec.rb
index 06ed16c4d..08ca79cfd 100755
--- a/spec/unit/file_bucket/dipper_spec.rb
+++ b/spec/unit/file_bucket/dipper_spec.rb
@@ -37,9 +37,12 @@ describe Puppet::FileBucket::Dipper do
bucketfile.stubs(:checksum_data).returns("DIGEST123")
bucketfile.expects(:save).with('md5/DIGEST123')
- Puppet::FileBucket::File.stubs(:new).with(
+
+ Puppet::FileBucket::File.stubs(:new).with(
+
"my contents",
:bucket_path => '/my/bucket',
+
:path => '/my/file'
).returns(bucketfile)
@@ -65,8 +68,11 @@ describe Puppet::FileBucket::Dipper do
end
it "should backup files to a remote server" do
- @dipper = Puppet::FileBucket::Dipper.new(
+
+ @dipper = Puppet::FileBucket::Dipper.new(
+
:Server => "puppetmaster",
+
:Port => "31337"
)
@@ -78,9 +84,12 @@ describe Puppet::FileBucket::Dipper do
bucketfile.stubs(:checksum_data).returns("DIGEST123")
bucketfile.expects(:save).with('https://puppetmaster:31337/production/file_bucket_file/md5/DIGEST123')
- Puppet::FileBucket::File.stubs(:new).with(
+
+ Puppet::FileBucket::File.stubs(:new).with(
+
"my contents",
:bucket_path => nil,
+
:path => '/my/file'
).returns(bucketfile)
@@ -88,8 +97,11 @@ describe Puppet::FileBucket::Dipper do
end
it "should retrieve files from a remote server" do
- @dipper = Puppet::FileBucket::Dipper.new(
+
+ @dipper = Puppet::FileBucket::Dipper.new(
+
:Server => "puppetmaster",
+
:Port => "31337"
)
diff --git a/spec/unit/file_serving/metadata_spec.rb b/spec/unit/file_serving/metadata_spec.rb
index ef2b3b6f0..0e2e71284 100755
--- a/spec/unit/file_serving/metadata_spec.rb
+++ b/spec/unit/file_serving/metadata_spec.rb
@@ -22,15 +22,15 @@ describe Puppet::FileServing::Metadata do
end
it "should support pson serialization" do
- Puppet::FileServing::Metadata.new("/foo/bar").should respond_to(:to_pson)
+ Puppet::FileServing::Metadata.new("/foo/bar").should respond_to(:to_pson)
end
it "should support to_pson_data_hash" do
- Puppet::FileServing::Metadata.new("/foo/bar").should respond_to(:to_pson_data_hash)
+ Puppet::FileServing::Metadata.new("/foo/bar").should respond_to(:to_pson_data_hash)
end
it "should support pson deserialization" do
- Puppet::FileServing::Metadata.should respond_to(:from_pson)
+ Puppet::FileServing::Metadata.should respond_to(:from_pson)
end
describe "when serializing" do
@@ -42,7 +42,7 @@ describe Puppet::FileServing::Metadata do
pdh_as_pson = mock "data as pson"
@metadata.expects(:to_pson_data_hash).returns pdh
pdh.expects(:to_pson).returns pdh_as_pson
- @metadata.to_pson.should == pdh_as_pson
+ @metadata.to_pson.should == pdh_as_pson
end
it "should serialize as FileMetadata" do
@@ -221,7 +221,7 @@ describe Puppet::FileServing::Metadata, " when collecting attributes" do
@stat.stubs(:ftype).returns("link")
File.expects(:readlink).with("/my/file").returns("/path/to/link")
@metadata.collect
-
+
@checksum = Digest::MD5.hexdigest("some content\n") # Remove these when :managed links are no longer checksumed.
@file.stubs(:md5_file).returns(@checksum) #
end
diff --git a/spec/unit/indirector/file_bucket_file/file_spec.rb b/spec/unit/indirector/file_bucket_file/file_spec.rb
index f821ca45d..652da3df0 100755
--- a/spec/unit/indirector/file_bucket_file/file_spec.rb
+++ b/spec/unit/indirector/file_bucket_file/file_spec.rb
@@ -155,7 +155,7 @@ describe Puppet::FileBucketFile::File do
it "should use the bucketdir, the 8 sum character directories, the full filebucket, and 'contents' as the full file name" do
path = Puppet::FileBucketFile::File.new.send(:contents_path_for, @bucket)
path.should == ['/dev/null/bucketdir', @digest[0..7].split(""), @digest, "contents"].flatten.join(::File::SEPARATOR)
- end
+ end
end
describe "when saving files" do
diff --git a/spec/unit/indirector/indirection_spec.rb b/spec/unit/indirector/indirection_spec.rb
index 8e62e1525..872daad11 100755
--- a/spec/unit/indirector/indirection_spec.rb
+++ b/spec/unit/indirector/indirection_spec.rb
@@ -137,7 +137,7 @@ describe Puppet::Indirector::Indirection do
end
after do
- @indirection.delete if defined? @indirection
+ @indirection.delete if defined?(@indirection)
end
end
@@ -604,7 +604,7 @@ describe Puppet::Indirector::Indirection do
end
after do
- @indirection.delete if defined? @indirection
+ @indirection.delete if defined?(@indirection)
end
end
@@ -638,7 +638,7 @@ describe Puppet::Indirector::Indirection do
end
after do
- @indirection.delete if defined? @indirection
+ @indirection.delete if defined?(@indirection)
end
end
@@ -682,7 +682,7 @@ describe Puppet::Indirector::Indirection do
end
after do
- @indirection.delete if defined? @indirection
+ @indirection.delete if defined?(@indirection)
end
end
diff --git a/spec/unit/indirector/node/active_record_spec.rb b/spec/unit/indirector/node/active_record_spec.rb
index e33a4945f..8e7d1d6bd 100755
--- a/spec/unit/indirector/node/active_record_spec.rb
+++ b/spec/unit/indirector/node/active_record_spec.rb
@@ -10,7 +10,7 @@ describe "Puppet::Node::ActiveRecord" do
confine "Missing Rails" => Puppet.features.rails?
confine "Missing sqlite" => Puppet.features.sqlite?
- before do
+ before do
require 'puppet/indirector/node/active_record'
end
diff --git a/spec/unit/indirector/report/rest_spec.rb b/spec/unit/indirector/report/rest_spec.rb
index 1f71eb357..ce6188334 100755
--- a/spec/unit/indirector/report/rest_spec.rb
+++ b/spec/unit/indirector/report/rest_spec.rb
@@ -8,19 +8,19 @@ describe Puppet::Transaction::Report::Rest do
it "should be a subclass of Puppet::Indirector::REST" do
Puppet::Transaction::Report::Rest.superclass.should equal(Puppet::Indirector::REST)
end
-
+
it "should use the :report_server setting in preference to :reportserver" do
Puppet.settings[:reportserver] = "reportserver"
Puppet.settings[:report_server] = "report_server"
Puppet::Transaction::Report::Rest.server.should == "report_server"
end
-
+
it "should use the :report_server setting in preference to :server" do
Puppet.settings[:server] = "server"
Puppet.settings[:report_server] = "report_server"
Puppet::Transaction::Report::Rest.server.should == "report_server"
end
-
+
it "should have a value for report_server and report_port" do
Puppet::Transaction::Report::Rest.server.should_not be_nil
Puppet::Transaction::Report::Rest.port.should_not be_nil
diff --git a/spec/unit/indirector/yaml_spec.rb b/spec/unit/indirector/yaml_spec.rb
index 44ecf96d6..bd207a878 100755
--- a/spec/unit/indirector/yaml_spec.rb
+++ b/spec/unit/indirector/yaml_spec.rb
@@ -116,31 +116,31 @@ describe Puppet::Indirector::Yaml, " when choosing file location" do
end
describe Puppet::Indirector::Yaml, " when searching" do
- it "should return an array of fact instances with one instance for each file when globbing *" do
- @request = stub 'request', :key => "*", :instance => @subject
- @one = mock 'one'
- @two = mock 'two'
- @store.expects(:base).returns "/my/yaml/dir"
- Dir.expects(:glob).with(File.join("/my/yaml/dir", @store.class.indirection_name.to_s, @request.key)).returns(%w{one.yaml two.yaml})
- YAML.expects(:load_file).with("one.yaml").returns @one;
- YAML.expects(:load_file).with("two.yaml").returns @two;
- @store.search(@request).should == [@one, @two]
- end
-
- it "should return an array containing a single instance of fact when globbing 'one*'" do
- @request = stub 'request', :key => "one*", :instance => @subject
- @one = mock 'one'
- @store.expects(:base).returns "/my/yaml/dir"
- Dir.expects(:glob).with(File.join("/my/yaml/dir", @store.class.indirection_name.to_s, @request.key)).returns(%w{one.yaml})
- YAML.expects(:load_file).with("one.yaml").returns @one;
- @store.search(@request).should == [@one]
- end
-
- it "should return an empty array when the glob doesn't match anything" do
- @request = stub 'request', :key => "f*ilglobcanfail*", :instance => @subject
- @store.expects(:base).returns "/my/yaml/dir"
- Dir.expects(:glob).with(File.join("/my/yaml/dir", @store.class.indirection_name.to_s, @request.key)).returns([])
- @store.search(@request).should == []
- end
+ it "should return an array of fact instances with one instance for each file when globbing *" do
+ @request = stub 'request', :key => "*", :instance => @subject
+ @one = mock 'one'
+ @two = mock 'two'
+ @store.expects(:base).returns "/my/yaml/dir"
+ Dir.expects(:glob).with(File.join("/my/yaml/dir", @store.class.indirection_name.to_s, @request.key)).returns(%w{one.yaml two.yaml})
+ YAML.expects(:load_file).with("one.yaml").returns @one;
+ YAML.expects(:load_file).with("two.yaml").returns @two;
+ @store.search(@request).should == [@one, @two]
+ end
+
+ it "should return an array containing a single instance of fact when globbing 'one*'" do
+ @request = stub 'request', :key => "one*", :instance => @subject
+ @one = mock 'one'
+ @store.expects(:base).returns "/my/yaml/dir"
+ Dir.expects(:glob).with(File.join("/my/yaml/dir", @store.class.indirection_name.to_s, @request.key)).returns(%w{one.yaml})
+ YAML.expects(:load_file).with("one.yaml").returns @one;
+ @store.search(@request).should == [@one]
+ end
+
+ it "should return an empty array when the glob doesn't match anything" do
+ @request = stub 'request', :key => "f*ilglobcanfail*", :instance => @subject
+ @store.expects(:base).returns "/my/yaml/dir"
+ Dir.expects(:glob).with(File.join("/my/yaml/dir", @store.class.indirection_name.to_s, @request.key)).returns([])
+ @store.search(@request).should == []
+ end
end
end
diff --git a/spec/unit/network/authstore_spec.rb b/spec/unit/network/authstore_spec.rb
index 58eb92693..e3f819479 100644
--- a/spec/unit/network/authstore_spec.rb
+++ b/spec/unit/network/authstore_spec.rb
@@ -67,7 +67,7 @@ describe Puppet::Network::AuthStore::Declaration do
@declaration.should_not be_match('www.testsite.org',other.join('.'))
end
end
- }
+ }
}
describe "when the pattern is a numeric IP with a back reference" do
@@ -93,56 +93,56 @@ describe Puppet::Network::AuthStore::Declaration do
"3ffe:b00::1::a",
"1:2:3::4:5::7:8",
"12345::6:7:8",
- "1::5:400.2.3.4",
- "1::5:260.2.3.4",
- "1::5:256.2.3.4",
- "1::5:1.256.3.4",
- "1::5:1.2.256.4",
- "1::5:1.2.3.256",
- "1::5:300.2.3.4",
- "1::5:1.300.3.4",
- "1::5:1.2.300.4",
- "1::5:1.2.3.300",
- "1::5:900.2.3.4",
- "1::5:1.900.3.4",
- "1::5:1.2.900.4",
- "1::5:1.2.3.900",
- "1::5:300.300.300.300",
- "1::5:3000.30.30.30",
- "1::400.2.3.4",
- "1::260.2.3.4",
- "1::256.2.3.4",
- "1::1.256.3.4",
- "1::1.2.256.4",
- "1::1.2.3.256",
- "1::300.2.3.4",
- "1::1.300.3.4",
- "1::1.2.300.4",
- "1::1.2.3.300",
- "1::900.2.3.4",
- "1::1.900.3.4",
- "1::1.2.900.4",
- "1::1.2.3.900",
- "1::300.300.300.300",
- "1::3000.30.30.30",
- "::400.2.3.4",
- "::260.2.3.4",
- "::256.2.3.4",
- "::1.256.3.4",
- "::1.2.256.4",
- "::1.2.3.256",
- "::300.2.3.4",
- "::1.300.3.4",
- "::1.2.300.4",
- "::1.2.3.300",
- "::900.2.3.4",
- "::1.900.3.4",
- "::1.2.900.4",
- "::1.2.3.900",
- "::300.300.300.300",
- "::3000.30.30.30",
- "2001:DB8:0:0:8:800:200C:417A:221", # unicast, full
- "FF01::101::2" # multicast, compressed
+ "1::5:400.2.3.4",
+ "1::5:260.2.3.4",
+ "1::5:256.2.3.4",
+ "1::5:1.256.3.4",
+ "1::5:1.2.256.4",
+ "1::5:1.2.3.256",
+ "1::5:300.2.3.4",
+ "1::5:1.300.3.4",
+ "1::5:1.2.300.4",
+ "1::5:1.2.3.300",
+ "1::5:900.2.3.4",
+ "1::5:1.900.3.4",
+ "1::5:1.2.900.4",
+ "1::5:1.2.3.900",
+ "1::5:300.300.300.300",
+ "1::5:3000.30.30.30",
+ "1::400.2.3.4",
+ "1::260.2.3.4",
+ "1::256.2.3.4",
+ "1::1.256.3.4",
+ "1::1.2.256.4",
+ "1::1.2.3.256",
+ "1::300.2.3.4",
+ "1::1.300.3.4",
+ "1::1.2.300.4",
+ "1::1.2.3.300",
+ "1::900.2.3.4",
+ "1::1.900.3.4",
+ "1::1.2.900.4",
+ "1::1.2.3.900",
+ "1::300.300.300.300",
+ "1::3000.30.30.30",
+ "::400.2.3.4",
+ "::260.2.3.4",
+ "::256.2.3.4",
+ "::1.256.3.4",
+ "::1.2.256.4",
+ "::1.2.3.256",
+ "::300.2.3.4",
+ "::1.300.3.4",
+ "::1.2.300.4",
+ "::1.2.3.300",
+ "::900.2.3.4",
+ "::1.900.3.4",
+ "::1.2.900.4",
+ "::1.2.3.900",
+ "::300.300.300.300",
+ "::3000.30.30.30",
+ "2001:DB8:0:0:8:800:200C:417A:221", # unicast, full
+ "FF01::101::2" # multicast, compressed
].each { |invalid_ip|
describe "when the pattern is an invalid IPv6 address such as #{invalid_ip}" do
it "should raise an exception" do
@@ -152,97 +152,97 @@ describe Puppet::Network::AuthStore::Declaration do
}
[
- "1.2.3.4",
- "2001:0000:1234:0000:0000:C1C0:ABCD:0876",
- "3ffe:0b00:0000:0000:0001:0000:0000:000a",
- "FF02:0000:0000:0000:0000:0000:0000:0001",
- "0000:0000:0000:0000:0000:0000:0000:0001",
- "0000:0000:0000:0000:0000:0000:0000:0000",
- "::ffff:192.168.1.26",
- "2::10",
- "ff02::1",
- "fe80::",
- "2002::",
- "2001:db8::",
- "2001:0db8:1234::",
- "::ffff:0:0",
- "::1",
- "::ffff:192.168.1.1",
- "1:2:3:4:5:6:7:8",
- "1:2:3:4:5:6::8",
- "1:2:3:4:5::8",
- "1:2:3:4::8",
- "1:2:3::8",
- "1:2::8",
- "1::8",
- "1::2:3:4:5:6:7",
- "1::2:3:4:5:6",
- "1::2:3:4:5",
- "1::2:3:4",
- "1::2:3",
- "1::8",
- "::2:3:4:5:6:7:8",
- "::2:3:4:5:6:7",
- "::2:3:4:5:6",
- "::2:3:4:5",
- "::2:3:4",
- "::2:3",
- "::8",
- "1:2:3:4:5:6::",
- "1:2:3:4:5::",
- "1:2:3:4::",
- "1:2:3::",
- "1:2::",
- "1::",
- "1:2:3:4:5::7:8",
- "1:2:3:4::7:8",
- "1:2:3::7:8",
- "1:2::7:8",
- "1::7:8",
- "1:2:3:4:5:6:1.2.3.4",
- "1:2:3:4:5::1.2.3.4",
- "1:2:3:4::1.2.3.4",
- "1:2:3::1.2.3.4",
- "1:2::1.2.3.4",
- "1::1.2.3.4",
- "1:2:3:4::5:1.2.3.4",
- "1:2:3::5:1.2.3.4",
- "1:2::5:1.2.3.4",
- "1::5:1.2.3.4",
- "1::5:11.22.33.44",
- "fe80::217:f2ff:254.7.237.98",
- "fe80::217:f2ff:fe07:ed62",
- "2001:DB8:0:0:8:800:200C:417A", # unicast, full
- "FF01:0:0:0:0:0:0:101", # multicast, full
- "0:0:0:0:0:0:0:1", # loopback, full
- "0:0:0:0:0:0:0:0", # unspecified, full
- "2001:DB8::8:800:200C:417A", # unicast, compressed
- "FF01::101", # multicast, compressed
- "::1", # loopback, compressed, non-routable
- "::", # unspecified, compressed, non-routable
- "0:0:0:0:0:0:13.1.68.3", # IPv4-compatible IPv6 address, full, deprecated
- "0:0:0:0:0:FFFF:129.144.52.38", # IPv4-mapped IPv6 address, full
- "::13.1.68.3", # IPv4-compatible IPv6 address, compressed, deprecated
- "::FFFF:129.144.52.38", # IPv4-mapped IPv6 address, compressed
- "2001:0DB8:0000:CD30:0000:0000:0000:0000/60", # full, with prefix
- "2001:0DB8::CD30:0:0:0:0/60", # compressed, with prefix
- "2001:0DB8:0:CD30::/60", # compressed, with prefix #2
- "::/128", # compressed, unspecified address type, non-routable
- "::1/128", # compressed, loopback address type, non-routable
- "FF00::/8", # compressed, multicast address type
- "FE80::/10", # compressed, link-local unicast, non-routable
- "FEC0::/10", # compressed, site-local unicast, deprecated
- "127.0.0.1", # standard IPv4, loopback, non-routable
- "0.0.0.0", # standard IPv4, unspecified, non-routable
- "255.255.255.255", # standard IPv4
- "fe80:0000:0000:0000:0204:61ff:fe9d:f156",
- "fe80:0:0:0:204:61ff:fe9d:f156",
- "fe80::204:61ff:fe9d:f156",
- "fe80:0000:0000:0000:0204:61ff:254.157.241.086",
- "fe80:0:0:0:204:61ff:254.157.241.86",
- "fe80::204:61ff:254.157.241.86",
- "::1",
- "fe80::",
+ "1.2.3.4",
+ "2001:0000:1234:0000:0000:C1C0:ABCD:0876",
+ "3ffe:0b00:0000:0000:0001:0000:0000:000a",
+ "FF02:0000:0000:0000:0000:0000:0000:0001",
+ "0000:0000:0000:0000:0000:0000:0000:0001",
+ "0000:0000:0000:0000:0000:0000:0000:0000",
+ "::ffff:192.168.1.26",
+ "2::10",
+ "ff02::1",
+ "fe80::",
+ "2002::",
+ "2001:db8::",
+ "2001:0db8:1234::",
+ "::ffff:0:0",
+ "::1",
+ "::ffff:192.168.1.1",
+ "1:2:3:4:5:6:7:8",
+ "1:2:3:4:5:6::8",
+ "1:2:3:4:5::8",
+ "1:2:3:4::8",
+ "1:2:3::8",
+ "1:2::8",
+ "1::8",
+ "1::2:3:4:5:6:7",
+ "1::2:3:4:5:6",
+ "1::2:3:4:5",
+ "1::2:3:4",
+ "1::2:3",
+ "1::8",
+ "::2:3:4:5:6:7:8",
+ "::2:3:4:5:6:7",
+ "::2:3:4:5:6",
+ "::2:3:4:5",
+ "::2:3:4",
+ "::2:3",
+ "::8",
+ "1:2:3:4:5:6::",
+ "1:2:3:4:5::",
+ "1:2:3:4::",
+ "1:2:3::",
+ "1:2::",
+ "1::",
+ "1:2:3:4:5::7:8",
+ "1:2:3:4::7:8",
+ "1:2:3::7:8",
+ "1:2::7:8",
+ "1::7:8",
+ "1:2:3:4:5:6:1.2.3.4",
+ "1:2:3:4:5::1.2.3.4",
+ "1:2:3:4::1.2.3.4",
+ "1:2:3::1.2.3.4",
+ "1:2::1.2.3.4",
+ "1::1.2.3.4",
+ "1:2:3:4::5:1.2.3.4",
+ "1:2:3::5:1.2.3.4",
+ "1:2::5:1.2.3.4",
+ "1::5:1.2.3.4",
+ "1::5:11.22.33.44",
+ "fe80::217:f2ff:254.7.237.98",
+ "fe80::217:f2ff:fe07:ed62",
+ "2001:DB8:0:0:8:800:200C:417A", # unicast, full
+ "FF01:0:0:0:0:0:0:101", # multicast, full
+ "0:0:0:0:0:0:0:1", # loopback, full
+ "0:0:0:0:0:0:0:0", # unspecified, full
+ "2001:DB8::8:800:200C:417A", # unicast, compressed
+ "FF01::101", # multicast, compressed
+ "::1", # loopback, compressed, non-routable
+ "::", # unspecified, compressed, non-routable
+ "0:0:0:0:0:0:13.1.68.3", # IPv4-compatible IPv6 address, full, deprecated
+ "0:0:0:0:0:FFFF:129.144.52.38", # IPv4-mapped IPv6 address, full
+ "::13.1.68.3", # IPv4-compatible IPv6 address, compressed, deprecated
+ "::FFFF:129.144.52.38", # IPv4-mapped IPv6 address, compressed
+ "2001:0DB8:0000:CD30:0000:0000:0000:0000/60", # full, with prefix
+ "2001:0DB8::CD30:0:0:0:0/60", # compressed, with prefix
+ "2001:0DB8:0:CD30::/60", # compressed, with prefix #2
+ "::/128", # compressed, unspecified address type, non-routable
+ "::1/128", # compressed, loopback address type, non-routable
+ "FF00::/8", # compressed, multicast address type
+ "FE80::/10", # compressed, link-local unicast, non-routable
+ "FEC0::/10", # compressed, site-local unicast, deprecated
+ "127.0.0.1", # standard IPv4, loopback, non-routable
+ "0.0.0.0", # standard IPv4, unspecified, non-routable
+ "255.255.255.255", # standard IPv4
+ "fe80:0000:0000:0000:0204:61ff:fe9d:f156",
+ "fe80:0:0:0:204:61ff:fe9d:f156",
+ "fe80::204:61ff:fe9d:f156",
+ "fe80:0000:0000:0000:0204:61ff:254.157.241.086",
+ "fe80:0:0:0:204:61ff:254.157.241.86",
+ "fe80::204:61ff:254.157.241.86",
+ "::1",
+ "fe80::",
"fe80::1"
].each { |ip|
describe "when the pattern is a valid IP such as #{ip}" do
diff --git a/spec/unit/network/format_handler_spec.rb b/spec/unit/network/format_handler_spec.rb
index 622f7e5a1..13a9b8300 100755
--- a/spec/unit/network/format_handler_spec.rb
+++ b/spec/unit/network/format_handler_spec.rb
@@ -61,7 +61,7 @@ describe Puppet::Network::FormatHandler do
describe "that is supported" do
before do
Puppet.settings.expects(:value).with(:preferred_serialization_format).returns :one
- end
+ end
it "should return the preferred serialization format first" do
FormatTester.supported_formats.should == [:one, :two]
end
diff --git a/spec/unit/network/formats_spec.rb b/spec/unit/network/formats_spec.rb
index fd78ebf52..0811d61ce 100755
--- a/spec/unit/network/formats_spec.rb
+++ b/spec/unit/network/formats_spec.rb
@@ -141,7 +141,7 @@ describe "Puppet Network Format" do
end
it "use_zlib? should return false" do
- @yaml.use_zlib?.should == false
+ @yaml.use_zlib?.should == false
end
it "should refuse to encode" do
diff --git a/spec/unit/network/handler/fileserver_spec.rb b/spec/unit/network/handler/fileserver_spec.rb
index fbb5c8ae2..35da33278 100644
--- a/spec/unit/network/handler/fileserver_spec.rb
+++ b/spec/unit/network/handler/fileserver_spec.rb
@@ -64,15 +64,13 @@ describe Puppet::Network::Handler::FileServer do
it "should list the contents of a nested directory" do
create_nested_file()
list = @mount.list("/", true, false)
- list.sort.should == [ ["/aFile", "file"], ["/", "directory"] ,
- ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort
+ list.sort.should == [ ["/aFile", "file"], ["/", "directory"] , ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort
end
it "should list the contents of a directory ignoring files that match" do
create_nested_file()
list = @mount.list("/", true, "*File")
- list.sort.should == [ ["/", "directory"] ,
- ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort
+ list.sort.should == [ ["/", "directory"] , ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort
end
it "should list the contents of a directory ignoring directories that match" do
@@ -102,15 +100,13 @@ describe Puppet::Network::Handler::FileServer do
it "should list the base directory and files and nested directory to a depth of two" do
create_nested_file()
list = @mount.list("/", 2, false)
- list.sort.should == [ ["/aFile", "file"], ["/", "directory"] ,
- ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort
+ list.sort.should == [ ["/aFile", "file"], ["/", "directory"] , ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort
end
it "should list the base directory and files and nested directory to a depth greater than the directory structure" do
create_nested_file()
list = @mount.list("/", 42, false)
- list.sort.should == [ ["/aFile", "file"], ["/", "directory"] ,
- ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort
+ list.sort.should == [ ["/aFile", "file"], ["/", "directory"] , ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort
end
it "should list a valid symbolic link as a file when recursing base dir" do
@@ -156,7 +152,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
+ end
it "should return a merged view of all plugins for all modules" do
list = @mount.list("facter",true,false)
diff --git a/spec/unit/network/rest_authconfig_spec.rb b/spec/unit/network/rest_authconfig_spec.rb
index fe17d5626..2d41c3e5b 100755
--- a/spec/unit/network/rest_authconfig_spec.rb
+++ b/spec/unit/network/rest_authconfig_spec.rb
@@ -32,7 +32,7 @@ describe Puppet::Network::RestAuthConfig do
@authconfig.rights = @acl
@request = stub 'request', :indirection_name => "path", :key => "to/resource", :ip => "127.0.0.1",
- :node => "me", :method => :save, :environment => :env, :authenticated => true
+ :node => "me", :method => :save, :environment => :env, :authenticated => true
end
it "should use the puppet default rest authorization file" do
@@ -115,7 +115,7 @@ describe Puppet::Network::RestAuthConfig do
describe "when adding default ACLs" do
- DEFAULT_ACL.each do |acl|
+ DEFAULT_ACL.each do |acl|
it "should create a default right for #{acl[:acl]}" do
@authconfig.stubs(:mk_acl)
@authconfig.expects(:mk_acl).with(acl)
diff --git a/spec/unit/network/server_spec.rb b/spec/unit/network/server_spec.rb
index 2aeb99a8b..d981a7586 100755
--- a/spec/unit/network/server_spec.rb
+++ b/spec/unit/network/server_spec.rb
@@ -471,11 +471,11 @@ describe Puppet::Network::Server do
end
it "should pass the listening address to the HTTP server" do
- @server.stubs(:http_server).returns(@mock_http_server)
- @mock_http_server.expects(:listen).with do |args|
- args[:address] == '127.0.0.1'
- end
- @server.listen
+ @server.stubs(:http_server).returns(@mock_http_server)
+ @mock_http_server.expects(:listen).with do |args|
+ args[:address] == '127.0.0.1'
+ end
+ @server.listen
end
it "should pass the listening port to the HTTP server" do
@@ -505,7 +505,7 @@ describe Puppet::Network::Server do
it "should pass a list of protocols to the HTTP server" do
@server.stubs(:http_server).returns(@mock_http_server)
@mock_http_server.expects(:listen).with do |args|
- args[:protocols] == [ :rest, :xmlrpc ]
+ args[:protocols] == [ :rest, :xmlrpc ]
end
@server.listen
end
diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb
index d0db2504c..11f1c9ce1 100755
--- a/spec/unit/node/environment_spec.rb
+++ b/spec/unit/node/environment_spec.rb
@@ -63,7 +63,7 @@ describe Puppet::Node::Environment do
it "should reuse any existing resource type collection" do
@env.known_resource_types.should equal(@env.known_resource_types)
end
-
+
it "should perform the initial import when creating a new collection" do
@collection.expects(:perform_initial_import)
Puppet::Resource::TypeCollection.expects(:new).returns @collection
diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb
index 43532cc53..d276de28d 100755
--- a/spec/unit/node/facts_spec.rb
+++ b/spec/unit/node/facts_spec.rb
@@ -18,7 +18,7 @@ describe Puppet::Node::Facts, "when indirecting" do
it "should add the node's certificate name as the 'clientcert' fact when adding local facts" do
@facts.add_local_facts
@facts.values["clientcert"].should == Puppet.settings[:certname]
- end
+ end
it "should add the Puppet version as a 'clientversion' fact when adding local facts" do
@facts.add_local_facts
diff --git a/spec/unit/other/selinux_spec.rb b/spec/unit/other/selinux_spec.rb
index 2287570e7..46e07b8af 100644
--- a/spec/unit/other/selinux_spec.rb
+++ b/spec/unit/other/selinux_spec.rb
@@ -7,11 +7,14 @@ require 'puppet/type/selmodule'
describe Puppet::Type.type(:file), " when manipulating file contexts" do
before :each do
- @file = Puppet::Type::File.new(
+
+ @file = Puppet::Type::File.new(
+
:name => "/tmp/foo",
:ensure => "file",
:seluser => "user_u",
:selrole => "role_r",
+
:seltype => "type_t" )
end
it "should use :seluser to get/set an SELinux user file context attribute" do
@@ -30,9 +33,12 @@ describe Puppet::Type.type(:selboolean), " when manipulating booleans" do
provider_class = Puppet::Type::Selboolean.provider(Puppet::Type::Selboolean.providers[0])
Puppet::Type::Selboolean.stubs(:defaultprovider).returns provider_class
- @bool = Puppet::Type::Selboolean.new(
+
+ @bool = Puppet::Type::Selboolean.new(
+
:name => "foo",
:value => "on",
+
:persistent => true )
end
it "should be able to access :name" do
@@ -59,10 +65,13 @@ describe Puppet::Type.type(:selmodule), " when checking policy modules" do
provider_class = Puppet::Type::Selmodule.provider(Puppet::Type::Selmodule.providers[0])
Puppet::Type::Selmodule.stubs(:defaultprovider).returns provider_class
- @module = Puppet::Type::Selmodule.new(
+
+ @module = Puppet::Type::Selmodule.new(
+
:name => "foo",
:selmoduledir => "/some/path",
:selmodulepath => "/some/path/foo.pp",
+
:syncversion => true)
end
it "should be able to access :name" do
diff --git a/spec/unit/parser/ast/casestatement_spec.rb b/spec/unit/parser/ast/casestatement_spec.rb
index 240d3bfea..187dd5822 100755
--- a/spec/unit/parser/ast/casestatement_spec.rb
+++ b/spec/unit/parser/ast/casestatement_spec.rb
@@ -136,11 +136,13 @@ describe Puppet::Parser::AST::CaseStatement do
}
options = tests.collect do |result, values|
values = values.collect { |v| AST::Leaf.new :value => v }
- AST::CaseOpt.new(:value => AST::ASTArray.new(:children => values),
+
+ AST::CaseOpt.new(
+ :value => AST::ASTArray.new(:children => values),
+
:statements => AST::Leaf.new(:value => result))
end
- options << AST::CaseOpt.new(:value => AST::Default.new(:value => "default"),
- :statements => AST::Leaf.new(:value => "default"))
+ options << AST::CaseOpt.new(:value => AST::Default.new(:value => "default"), :statements => AST::Leaf.new(:value => "default"))
ast = nil
param = AST::Variable.new(:value => "testparam")
diff --git a/spec/unit/parser/ast/comparison_operator_spec.rb b/spec/unit/parser/ast/comparison_operator_spec.rb
index 97402433f..51f4cc516 100755
--- a/spec/unit/parser/ast/comparison_operator_spec.rb
+++ b/spec/unit/parser/ast/comparison_operator_spec.rb
@@ -54,11 +54,11 @@ describe Puppet::Parser::AST::ComparisonOperator do
end
%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
+ 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
+ operator.evaluate(@scope).should == 1.send(oper,2)
+ end
end
it "should return the result of using '!=' to compare the left and right sides" do
@@ -81,12 +81,12 @@ describe Puppet::Parser::AST::ComparisonOperator do
# see ticket #1759
%w{< > <= >=}.each do |oper|
it "should return the correct result of using '#{oper}' to compare 10 and 9" do
- ten = stub 'one', :safeevaluate => "10"
- nine = stub 'two', :safeevaluate => "9"
- operator = Puppet::Parser::AST::ComparisonOperator.new :lval => ten, :operator => oper, :rval => nine
+ 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
+ operator.evaluate(@scope).should == 10.send(oper,9)
+ end
end
end
diff --git a/spec/unit/parser/ast/vardef_spec.rb b/spec/unit/parser/ast/vardef_spec.rb
index a6863e75f..369a9f847 100755
--- a/spec/unit/parser/ast/vardef_spec.rb
+++ b/spec/unit/parser/ast/vardef_spec.rb
@@ -17,7 +17,7 @@ describe Puppet::Parser::AST::VarDef do
value.expects(:safeevaluate).with(@scope)
vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
- :line => nil
+ :line => nil
vardef.evaluate(@scope)
end
@@ -28,7 +28,7 @@ describe Puppet::Parser::AST::VarDef do
@scope.expects(:setvar).with { |name,value,options| options[:append] == nil }
vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
- :line => nil
+ :line => nil
vardef.evaluate(@scope)
end
@@ -39,7 +39,7 @@ describe Puppet::Parser::AST::VarDef do
@scope.expects(:setvar).with { |name,value,options| options[:append] == true }
vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil,
- :line => nil, :append => true
+ :line => nil, :append => true
vardef.evaluate(@scope)
end
diff --git a/spec/unit/parser/ast_spec.rb b/spec/unit/parser/ast_spec.rb
index ca6f8080a..cd271af98 100644
--- a/spec/unit/parser/ast_spec.rb
+++ b/spec/unit/parser/ast_spec.rb
@@ -21,9 +21,9 @@ describe Puppet::Parser::AST do
end
[ Puppet::Parser::AST::Collection, Puppet::Parser::AST::Else,
- Puppet::Parser::AST::Function, Puppet::Parser::AST::IfStatement,
- Puppet::Parser::AST::Resource, Puppet::Parser::AST::ResourceDefaults,
- Puppet::Parser::AST::ResourceOverride, Puppet::Parser::AST::VarDef
+ Puppet::Parser::AST::Function, Puppet::Parser::AST::IfStatement,
+ Puppet::Parser::AST::Resource, Puppet::Parser::AST::ResourceDefaults,
+ Puppet::Parser::AST::ResourceOverride, Puppet::Parser::AST::VarDef
].each do |k|
it "#{k}.use_docs should return true" do
ast = k.new({})
diff --git a/spec/unit/parser/functions/defined_spec.rb b/spec/unit/parser/functions/defined_spec.rb
index 03b0ef9dd..90f2f5239 100755
--- a/spec/unit/parser/functions/defined_spec.rb
+++ b/spec/unit/parser/functions/defined_spec.rb
@@ -18,7 +18,7 @@ describe "the 'defined' function" do
@scope.known_resource_types.add Puppet::Resource::Type.new(:hostclass, "yayness")
@scope.function_defined("yayness").should be_true
end
-
+
it "should be true when the name is defined as a definition" do
@scope.known_resource_types.add Puppet::Resource::Type.new(:definition, "yayness")
@scope.function_defined("yayness").should be_true
diff --git a/spec/unit/parser/functions/regsubst_spec.rb b/spec/unit/parser/functions/regsubst_spec.rb
index 5a533efb1..6ff619f8d 100755
--- a/spec/unit/parser/functions/regsubst_spec.rb
+++ b/spec/unit/parser/functions/regsubst_spec.rb
@@ -13,29 +13,24 @@ describe "the regsubst function" do
end
it "should raise a ParseError if there is less than 3 arguments" do
- lambda { @scope.function_regsubst(["foo", "bar"]) }.should(
- raise_error(Puppet::ParseError))
+ lambda { @scope.function_regsubst(["foo", "bar"]) }.should( raise_error(Puppet::ParseError))
end
it "should raise a ParseError if there is more than 5 arguments" do
- lambda { @scope.function_regsubst(["foo", "bar", "gazonk", "del", "x", "y"]) }.should(
- raise_error(Puppet::ParseError))
+ lambda { @scope.function_regsubst(["foo", "bar", "gazonk", "del", "x", "y"]) }.should( raise_error(Puppet::ParseError))
end
it "should raise a ParseError when given a bad flag" do
- lambda { @scope.function_regsubst(["foo", "bar", "gazonk", "X"]) }.should(
- raise_error(Puppet::ParseError))
+ lambda { @scope.function_regsubst(["foo", "bar", "gazonk", "X"]) }.should( raise_error(Puppet::ParseError))
end
it "should raise a ParseError for non-string and non-array target" do
- lambda { @scope.function_regsubst([4711, "bar", "gazonk"]) }.should(
- raise_error(Puppet::ParseError))
+ lambda { @scope.function_regsubst([4711, "bar", "gazonk"]) }.should( raise_error(Puppet::ParseError))
end
it "should raise a ParseError for array target with non-string element" do
- lambda { @scope.function_regsubst([["x", ["y"], "z"], "bar", "gazonk"]) }.should(
- raise_error(Puppet::ParseError))
+ lambda { @scope.function_regsubst([["x", ["y"], "z"], "bar", "gazonk"]) }.should( raise_error(Puppet::ParseError))
end
it "should raise a ParseError for a bad regular expression" do
@@ -44,63 +39,80 @@ describe "the regsubst function" do
end
it "should raise a ParseError for a non-string regular expression" do
- lambda { @scope.function_regsubst(["foo", ["bar"], "gazonk"]) }.should(
- raise_error(Puppet::ParseError))
+ lambda { @scope.function_regsubst(["foo", ["bar"], "gazonk"]) }.should( raise_error(Puppet::ParseError))
end
it "should handle groups" do
+
result = @scope.function_regsubst(
+
[ '130.236.254.10',
- '^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)$',
- '\4-\3-\2-\1'
+
+ '^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)$',
+ '\4-\3-\2-\1'
])
result.should(eql("10-254-236-130"))
end
it "should handle simple regexps" do
+
result = @scope.function_regsubst(
+
[ "the monkey breaks banana trees",
- "b[an]*a",
- "coconut"
+ "b[an]*a",
+
+ "coconut"
])
result.should(eql("the monkey breaks coconut trees"))
end
it "should handle case-sensitive regexps" do
+
result = @scope.function_regsubst(
+
[ "the monkey breaks baNAna trees",
- "b[an]+a",
- "coconut"
+ "b[an]+a",
+
+ "coconut"
])
result.should(eql("the monkey breaks baNAna trees"))
end
it "should handle case-insensitive regexps" do
+
result = @scope.function_regsubst(
+
[ "the monkey breaks baNAna trees",
- "b[an]+a",
- "coconut",
- "I"
+ "b[an]+a",
+ "coconut",
+
+ "I"
])
result.should(eql("the monkey breaks coconut trees"))
end
it "should handle global substitutions" do
+
result = @scope.function_regsubst(
+
[ "the monkey breaks\tbanana trees",
- "[ \t]",
- "--",
- "G"
+ "[ \t]",
+ "--",
+
+ "G"
])
result.should(eql("the--monkey--breaks--banana--trees"))
end
it "should handle global substitutions with groups" do
+
result = @scope.function_regsubst(
+
[ '130.236.254.10',
- '([0-9]+)',
- '<\1>',
- 'G'
+
+ '([0-9]+)',
+ '<\1>',
+ 'G'
])
result.should(eql('<130>.<236>.<254>.<10>'))
end
@@ -108,59 +120,71 @@ describe "the regsubst function" do
it "should apply on all elements of an array" do
data = ['130.236.254.10', 'foo.example.com', 'coconut', '10.20.30.40']
result = @scope.function_regsubst([ data, '[.]', '-'])
- result.should(eql(
- ['130-236.254.10', 'foo-example.com', 'coconut', '10-20.30.40']))
+ result.should(eql( ['130-236.254.10', 'foo-example.com', 'coconut', '10-20.30.40']))
end
it "should apply global substitutions on all elements of an array" do
data = ['130.236.254.10', 'foo.example.com', 'coconut', '10.20.30.40']
result = @scope.function_regsubst([ data, '[.]', '-', 'G'])
- result.should(eql(
- ['130-236-254-10', 'foo-example-com', 'coconut', '10-20-30-40']))
+ result.should(eql( ['130-236-254-10', 'foo-example-com', 'coconut', '10-20-30-40']))
end
it "should handle groups on all elements of an array" do
data = ['130.236.254.10', 'foo.example.com', 'coconut', '10.20.30.40']
- result = @scope.function_regsubst(
- [ data,
- '^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)$',
- '\4-\3-\2-\1'
+
+ result = @scope.function_regsubst(
+
+ [ data,
+
+ '^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)$',
+ '\4-\3-\2-\1'
])
- result.should(eql(
- ['10-254-236-130', 'foo.example.com', 'coconut', '40-30-20-10']))
+ result.should(eql( ['10-254-236-130', 'foo.example.com', 'coconut', '40-30-20-10']))
end
it "should handle global substitutions with groups on all elements of an array" do
data = ['130.236.254.10', 'foo.example.com', 'coconut', '10.20.30.40']
- result = @scope.function_regsubst(
- [ data,
- '([^.]+)',
- '<\1>',
- 'G'
+
+ result = @scope.function_regsubst(
+
+ [ data,
+
+ '([^.]+)',
+ '<\1>',
+ 'G'
])
- result.should(eql(
- ['<130>.<236>.<254>.<10>', '<foo>.<example>.<com>',
- '<coconut>', '<10>.<20>.<30>.<40>']))
+
+ result.should(eql(
+
+ ['<130>.<236>.<254>.<10>', '<foo>.<example>.<com>',
+
+ '<coconut>', '<10>.<20>.<30>.<40>']))
end
it "should return an array (not a string) for a single element array parameter" do
data = ['130.236.254.10']
- result = @scope.function_regsubst(
- [ data,
- '([^.]+)',
- '<\1>',
- 'G'
+
+ result = @scope.function_regsubst(
+
+ [ data,
+
+ '([^.]+)',
+ '<\1>',
+ 'G'
])
result.should(eql(['<130>.<236>.<254>.<10>']))
end
it "should return a string (not a one element array) for a simple string parameter" do
data = '130.236.254.10'
- result = @scope.function_regsubst(
- [ data,
- '([^.]+)',
- '<\1>',
- 'G'
+
+ result = @scope.function_regsubst(
+
+ [ data,
+
+ '([^.]+)',
+ '<\1>',
+ 'G'
])
result.should(eql('<130>.<236>.<254>.<10>'))
end
diff --git a/spec/unit/parser/functions/shellquote_spec.rb b/spec/unit/parser/functions/shellquote_spec.rb
index 283a4de1e..8286be32e 100755
--- a/spec/unit/parser/functions/shellquote_spec.rb
+++ b/spec/unit/parser/functions/shellquote_spec.rb
@@ -19,74 +19,63 @@ describe "the shellquote function" do
end
it "should handle several simple arguments" do
- result = @scope.function_shellquote(
- ['foo', 'bar@example.com', 'localhost:/dev/null', 'xyzzy+-4711,23'])
- result.should(eql(
- 'foo bar@example.com localhost:/dev/null xyzzy+-4711,23'))
+ result = @scope.function_shellquote( ['foo', 'bar@example.com', 'localhost:/dev/null', 'xyzzy+-4711,23'])
+ result.should(eql( 'foo bar@example.com localhost:/dev/null xyzzy+-4711,23'))
end
it "should handle array arguments" do
+
result = @scope.function_shellquote(
+
['foo', ['bar@example.com', 'localhost:/dev/null'],
- 'xyzzy+-4711,23'])
+
+ 'xyzzy+-4711,23'])
result.should(eql(
'foo bar@example.com localhost:/dev/null xyzzy+-4711,23'))
end
it "should quote unsafe characters" do
- result = @scope.function_shellquote(
- ['/etc/passwd ', '(ls)', '*', '[?]', "'&'"])
- result.should(eql(
- '"/etc/passwd " "(ls)" "*" "[?]" "\'&\'"'))
+ result = @scope.function_shellquote( ['/etc/passwd ', '(ls)', '*', '[?]', "'&'"])
+ result.should(eql( '"/etc/passwd " "(ls)" "*" "[?]" "\'&\'"'))
end
it "should deal with double quotes" do
result = @scope.function_shellquote(
- ['"foo"bar"'])
+ ['"foo"bar"'])
result.should(eql(
'\'"foo"bar"\''))
end
it "should cope with dollar signs" do
- result = @scope.function_shellquote(
- ['$PATH', 'foo$bar', '"x$"'])
- result.should(eql(
- "'$PATH' 'foo$bar' '\"x$\"'"))
+ result = @scope.function_shellquote( ['$PATH', 'foo$bar', '"x$"'])
+ result.should(eql( "'$PATH' 'foo$bar' '\"x$\"'"))
end
it "should deal with apostrophes (single quotes)" do
result = @scope.function_shellquote(
- ["'foo'bar'", "`$'EDITOR'`"])
+ ["'foo'bar'", "`$'EDITOR'`"])
result.should(eql(
'"\'foo\'bar\'" "\\`\\$\'EDITOR\'\\`"'))
end
it "should cope with grave accents (backquotes)" do
- result = @scope.function_shellquote(
- ['`echo *`', '`ls "$MAILPATH"`'])
- result.should(eql(
- "'`echo *`' '`ls \"$MAILPATH\"`'"))
+ result = @scope.function_shellquote( ['`echo *`', '`ls "$MAILPATH"`'])
+ result.should(eql( "'`echo *`' '`ls \"$MAILPATH\"`'"))
end
it "should deal with both single and double quotes" do
- result = @scope.function_shellquote(
- ['\'foo"bar"xyzzy\'', '"foo\'bar\'xyzzy"'])
- result.should(eql(
- '"\'foo\\"bar\\"xyzzy\'" "\\"foo\'bar\'xyzzy\\""'))
+ result = @scope.function_shellquote( ['\'foo"bar"xyzzy\'', '"foo\'bar\'xyzzy"'])
+ result.should(eql( '"\'foo\\"bar\\"xyzzy\'" "\\"foo\'bar\'xyzzy\\""'))
end
it "should handle multiple quotes *and* dollars and backquotes" do
- result = @scope.function_shellquote(
- ['\'foo"$x`bar`"xyzzy\''])
- result.should(eql(
- '"\'foo\\"\\$x\\`bar\\`\\"xyzzy\'"'))
+ result = @scope.function_shellquote( ['\'foo"$x`bar`"xyzzy\''])
+ result.should(eql( '"\'foo\\"\\$x\\`bar\\`\\"xyzzy\'"'))
end
it "should handle linefeeds" do
- result = @scope.function_shellquote(
- ["foo \n bar"])
- result.should(eql(
- "\"foo \n bar\""))
+ result = @scope.function_shellquote( ["foo \n bar"])
+ result.should(eql( "\"foo \n bar\""))
end
end
diff --git a/spec/unit/parser/functions/split_spec.rb b/spec/unit/parser/functions/split_spec.rb
index 8aa031d19..3d0240af4 100755
--- a/spec/unit/parser/functions/split_spec.rb
+++ b/spec/unit/parser/functions/split_spec.rb
@@ -13,39 +13,37 @@ describe "the split function" do
end
it "should raise a ParseError if there is less than 2 arguments" do
- lambda { @scope.function_split(["foo"]) }.should(
- raise_error(Puppet::ParseError))
+ lambda { @scope.function_split(["foo"]) }.should( raise_error(Puppet::ParseError))
end
it "should raise a ParseError if there is more than 2 arguments" do
- lambda { @scope.function_split(["foo", "bar", "gazonk"]) }.should(
- raise_error(Puppet::ParseError))
+ lambda { @scope.function_split(["foo", "bar", "gazonk"]) }.should( raise_error(Puppet::ParseError))
end
it "should raise a RegexpError if the regexp is malformed" do
lambda { @scope.function_split(["foo", "("]) }.should(
- raise_error(RegexpError))
+ raise_error(RegexpError))
end
it "should handle simple string without metacharacters" do
- result = @scope.function_split([ "130;236;254;10", ";"])
- result.should(eql(["130", "236", "254", "10"]))
+ result = @scope.function_split([ "130;236;254;10", ";"])
+ result.should(eql(["130", "236", "254", "10"]))
end
it "should handle simple regexps" do
- result = @scope.function_split([ "130.236;254.;10", "[.;]+"])
- result.should(eql(["130", "236", "254", "10"]))
+ result = @scope.function_split([ "130.236;254.;10", "[.;]+"])
+ result.should(eql(["130", "236", "254", "10"]))
end
it "should handle groups" do
- result = @scope.function_split([ "130.236;254.;10", "([.;]+)"])
- result.should(eql(["130", ".", "236", ";", "254", ".;", "10"]))
+ result = @scope.function_split([ "130.236;254.;10", "([.;]+)"])
+ result.should(eql(["130", ".", "236", ";", "254", ".;", "10"]))
end
it "should handle simple string without metacharacters" do
- result = @scope.function_split([ "130.236.254.10", ";"])
- result.should(eql(["130.236.254.10"]))
+ result = @scope.function_split([ "130.236.254.10", ";"])
+ result.should(eql(["130.236.254.10"]))
end
end
diff --git a/spec/unit/parser/functions/sprintf_spec.rb b/spec/unit/parser/functions/sprintf_spec.rb
index 949dc3fcc..71921e0e0 100755
--- a/spec/unit/parser/functions/sprintf_spec.rb
+++ b/spec/unit/parser/functions/sprintf_spec.rb
@@ -13,8 +13,7 @@ describe "the sprintf function" do
end
it "should raise a ParseError if there is less than 1 argument" do
- lambda { @scope.function_sprintf([]) }.should(
- raise_error(Puppet::ParseError))
+ lambda { @scope.function_sprintf([]) }.should( raise_error(Puppet::ParseError))
end
it "should format integers" do
@@ -35,7 +34,7 @@ describe "the sprintf function" do
it "should perform more complex formatting" do
result = @scope.function_sprintf(
[ "<%.8s:%#5o %#8X (%-8s)>",
- "overlongstring", "23", "48879", "foo" ])
+ "overlongstring", "23", "48879", "foo" ])
result.should(eql("<overlong: 027 0XBEEF (foo )>"))
end
diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb
index c437034a4..47a768469 100755
--- a/spec/unit/parser/lexer_spec.rb
+++ b/spec/unit/parser/lexer_spec.rb
@@ -357,8 +357,8 @@ describe Puppet::Parser::Lexer::TOKENS[:MLCOMMENT] do
it "should match multiple lines enclosed with '/*' and '*/'" do
@token.regex.should =~ """/*
- this is a comment
- */"""
+ this is a comment
+ */"""
end
it "should increase the lexer current line number by the amount of lines spanned by the comment" do
@@ -480,8 +480,8 @@ describe Puppet::Parser::Lexer::TOKENS[:REGEX] do
:CASE,:VARIABLE,:LBRACE,:STRING,:COLON,:LBRACE,:VARIABLE,:EQUALS,:NAME,:DIV,:NAME,:RBRACE,[:REGEX,/regex/],:COLON,:LBRACE,:NAME,:LPAREN,:STRING,:RPAREN,:RBRACE,:RBRACE
)
end
-
- end
+
+ end
it "should return the REGEX token and a Regexp" do
diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb
index 2cbb80f9b..53a16e62a 100755
--- a/spec/unit/parser/parser_spec.rb
+++ b/spec/unit/parser/parser_spec.rb
@@ -32,7 +32,7 @@ describe Puppet::Parser do
parser = Puppet::Parser::Parser.new "development"
parser.known_resource_types.should equal(rtc)
end
-
+
it "should delegate importing to the known resource type loader" do
parser = Puppet::Parser::Parser.new "development"
parser.known_resource_types.loader.expects(:import).with("newfile", "current_file")
@@ -100,32 +100,32 @@ describe Puppet::Parser do
end
it "comparison operation, it should create the correct ast objects" do
- 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 }")
+ 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 }")
end
end
describe "when parsing if complex expressions" do
- it "should create a correct ast tree" do
- aststub = stub_everything 'ast'
- 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 {
- |h| h[:rval].is_a?(ast::Name) and h[:lval].is_a?(ast::Name) and h[:operator]=="=="
- }.returns(aststub)
- ast::BooleanOperator.expects(:new).with {
- |h| h[:rval]==aststub and h[:lval]==aststub and h[:operator]=="and"
- }
- @parser.parse("if (1 > 2) and (1 == 2) { $var = 1 }")
- end
-
- it "should raise an error on incorrect expression" do
- lambda { @parser.parse("if (1 > 2 > ) or (1 == 2) { $var = 1 }") }.should raise_error
+ it "should create a correct ast tree" do
+ aststub = stub_everything 'ast'
+ 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 {
+ |h| h[:rval].is_a?(ast::Name) and h[:lval].is_a?(ast::Name) and h[:operator]=="=="
+ }.returns(aststub)
+ ast::BooleanOperator.expects(:new).with {
+ |h| h[:rval]==aststub and h[:lval]==aststub and h[:operator]=="and"
+ }
+ @parser.parse("if (1 > 2) and (1 == 2) { $var = 1 }")
+ end
+
+ it "should raise an error on incorrect expression" do
+ lambda { @parser.parse("if (1 > 2 > ) or (1 == 2) { $var = 1 }") }.should raise_error
end
end
@@ -194,7 +194,7 @@ describe Puppet::Parser do
it "should build a chain of 'ifs' if there's an 'elsif'" do
ast = @parser.parse(<<-PP)
- if true { notice('test') } elsif true {} else { }
+ if true { notice('test') } elsif true {} else { }
PP
end
@@ -398,12 +398,12 @@ describe Puppet::Parser do
@krt.add(Puppet::Resource::Type.new(:hostclass, "foobar", :arguments => {"biz" => nil}))
lambda { @parser.parse("class { foobar: biz => stuff }") }.should_not raise_error
end
-
+
it "should correctly mark exported resources as exported" do
@parser.parse("@@file { '/file': }")
@krt.hostclass("").code[0].exported.should be_true
end
-
+
it "should correctly mark virtual resources as virtual" do
@parser.parse("@file { '/file': }")
@krt.hostclass("").code[0].virtual.should be_true
diff --git a/spec/unit/parser/resource_spec.rb b/spec/unit/parser/resource_spec.rb
index 9d407c0e7..31bde27dd 100755
--- a/spec/unit/parser/resource_spec.rb
+++ b/spec/unit/parser/resource_spec.rb
@@ -496,7 +496,7 @@ describe Puppet::Parser::Resource do
end
it "should fail if the same param is declared twice" do
- lambda do
+ lambda do
@parser_resource = mkresource :source => @source, :parameters => [
Puppet::Parser::Resource::Param.new(
:name => :foo, :value => "bar", :source => @source
diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb
index 29dca38f4..94192a693 100755
--- a/spec/unit/parser/scope_spec.rb
+++ b/spec/unit/parser/scope_spec.rb
@@ -11,7 +11,7 @@ describe Puppet::Parser::Scope do
@scope.compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("foo"))
@scope.parent = @topscope
end
-
+
it "should be able to store references to class scopes" do
lambda { @scope.class_set "myname", "myscope" }.should_not raise_error
end
@@ -500,8 +500,7 @@ describe Puppet::Parser::Scope do
assert_equal("value", scope.lookupvar("::test"), "did not look up qualified value correctly")
tests.each do |input, output|
assert_nothing_raised("Failed to scan %s" % input.inspect) do
- assert_equal(output, scope.strinterp(input),
- 'did not parserret %s correctly' % input.inspect)
+ assert_equal(output, scope.strinterp(input), 'did not parserret %s correctly' % input.inspect)
end
end
@@ -513,11 +512,17 @@ describe Puppet::Parser::Scope do
%w{d f h l w z}.each do |l|
string = "\\" + l
assert_nothing_raised do
- assert_equal(string, scope.strinterp(string),
+
+ assert_equal(
+ string, scope.strinterp(string),
+
'did not parserret %s correctly' % string)
end
- assert(logs.detect { |m| m.message =~ /Unrecognised escape/ },
+
+ assert(
+ logs.detect { |m| m.message =~ /Unrecognised escape/ },
+
"Did not get warning about escape sequence with %s" % string)
logs.clear
end
diff --git a/spec/unit/parser/templatewrapper_spec.rb b/spec/unit/parser/templatewrapper_spec.rb
index 1b4121643..9a16666fd 100755
--- a/spec/unit/parser/templatewrapper_spec.rb
+++ b/spec/unit/parser/templatewrapper_spec.rb
@@ -120,18 +120,18 @@ describe Puppet::Parser::TemplateWrapper do
@tw.result("template contents")
@tw.instance_variable_get("@one").should == "foo"
- end
+ end
- it "should not error out if one of the variables is a symbol" do
+ it "should not error out if one of the variables is a symbol" do
template_mock = mock("template", :result => "woot!")
ERB.expects(:new).with("template contents", 0, "-").returns(template_mock)
@scope.expects(:to_hash).returns(:_timestamp => "1234")
@tw.result("template contents")
- end
+ end
- %w{! . ; :}.each do |badchar|
- it "should translate #{badchar} to _ when setting the instance variables" do
+ %w{! . ; :}.each do |badchar|
+ it "should translate #{badchar} to _ when setting the instance variables" do
template_mock = mock("template", :result => "woot!")
ERB.expects(:new).with("template contents", 0, "-").returns(template_mock)
@@ -139,6 +139,6 @@ describe Puppet::Parser::TemplateWrapper do
@tw.result("template contents")
@tw.instance_variable_get("@one_").should == "foo"
- end
- end
+ end
+ end
end
diff --git a/spec/unit/property/list_spec.rb b/spec/unit/property/list_spec.rb
index 84d14478b..588e71ce1 100644
--- a/spec/unit/property/list_spec.rb
+++ b/spec/unit/property/list_spec.rb
@@ -118,7 +118,7 @@ describe list_class do
end
end
- describe "when calling insync?" do
+ describe "when calling insync?" do
it "should return true unless @should is defined and not nil" do
@property.must be_insync("foo")
end
diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb
index 0cf206d4b..4dc33708e 100755
--- a/spec/unit/provider/mount/parsed_spec.rb
+++ b/spec/unit/provider/mount/parsed_spec.rb
@@ -29,7 +29,7 @@ module ParsedMountTesting
def mkmountargs
mount = nil
- if defined? @pcount
+ if defined?(@pcount)
@pcount += 1
else
@pcount = 1
@@ -151,7 +151,7 @@ describe provider_class do
it "should write the mount to disk when :flush is called" do
old_text = @provider_class.target_object(@provider_class.default_target).read
-
+
@mount.flush
text = @provider_class.target_object(@provider_class.default_target).read
diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb
index 861029838..54f2c0771 100755
--- a/spec/unit/provider/package/apt_spec.rb
+++ b/spec/unit/provider/package/apt_spec.rb
@@ -39,7 +39,7 @@ describe provider do
Installed: 1:1.0
Candidate: 1:1.1
Version table:
- 1:1.0
+1:1.0
650 http://ftp.osuosl.org testing/main Packages
*** 1:1.1
100 /var/lib/dpkg/status"
diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb
index d0c1d2622..68ffb19a4 100755
--- a/spec/unit/provider/package/dpkg_spec.rb
+++ b/spec/unit/provider/package/dpkg_spec.rb
@@ -163,9 +163,9 @@ describe provider do
describe "when holding or unholding" do
before do
- @tempfile = stub 'tempfile', :print => nil, :close => nil, :flush => nil, :path => "/other/file"
- @tempfile.stubs(:write)
- Tempfile.stubs(:new).returns @tempfile
+ @tempfile = stub 'tempfile', :print => nil, :close => nil, :flush => nil, :path => "/other/file"
+ @tempfile.stubs(:write)
+ Tempfile.stubs(:new).returns @tempfile
end
it "should install first if holding" do
diff --git a/spec/unit/provider/package/hpux_spec.rb b/spec/unit/provider/package/hpux_spec.rb
index 32eae5189..8343c6052 100644
--- a/spec/unit/provider/package/hpux_spec.rb
+++ b/spec/unit/provider/package/hpux_spec.rb
@@ -49,4 +49,4 @@ describe provider_class do
@provider.uninstall
end
end
- end
+end
diff --git a/spec/unit/provider/package/nim_spec.rb b/spec/unit/provider/package/nim_spec.rb
index 2018f6506..5d9083b70 100755
--- a/spec/unit/provider/package/nim_spec.rb
+++ b/spec/unit/provider/package/nim_spec.rb
@@ -39,4 +39,4 @@ describe provider_class do
@provider.install
end
end
- end
+end
diff --git a/spec/unit/provider/package/pkg_spec.rb b/spec/unit/provider/package/pkg_spec.rb
index d0d933d5e..b29405e26 100644
--- a/spec/unit/provider/package/pkg_spec.rb
+++ b/spec/unit/provider/package/pkg_spec.rb
@@ -19,36 +19,36 @@ describe provider do
end
end
end
-
+
it_should_respond_to :install, :uninstall, :update, :query, :latest
-
+
it "should be versionable" do
provider.should_not be_versionable
end
-
+
it "should use :install to update" do
@provider.expects(:install)
@provider.update
end
-
+
it "should parse a line correctly" do
result = provider.parse_line("dummy 1.0@1.0-1.0 installed ----")
result.should == {:name => "dummy", :version => "1.0@1.0-1.0",
- :ensure => :present, :status => "installed",
- :provider => :pkg, :error => "ok"}
+ :ensure => :present, :status => "installed",
+ :provider => :pkg, :error => "ok"}
end
-
+
it "should fail to parse an incorrect line" do
- result = provider.parse_line("foo")
- result.should be_nil
+ result = provider.parse_line("foo")
+ result.should be_nil
end
it "should fail to list a missing package" do
@provider.expects(:pkg).with(:list, "-H", "dummy").returns "1"
@provider.query.should == {:status=>"missing", :ensure=>:absent,
- :name=>"dummy", :error=>"ok"}
+ :name=>"dummy", :error=>"ok"}
end
-
+
it "should fail to list a package when it can't parse the output line" do
@provider.expects(:pkg).with(:list, "-H", "dummy").returns "failed"
@provider.query.should == {:status=>"missing", :ensure=>:absent, :name=>"dummy", :error=>"ok"}
@@ -57,7 +57,7 @@ describe provider do
it "should list package correctly" do
@provider.expects(:pkg).with(:list, "-H", "dummy").returns "dummy 1.0@1.0-1.0 installed ----"
@provider.query.should == {:name => "dummy", :version => "1.0@1.0-1.0",
- :ensure => :present, :status => "installed",
- :provider => :pkg, :error => "ok"}
+ :ensure => :present, :status => "installed",
+ :provider => :pkg, :error => "ok"}
end
end
diff --git a/spec/unit/provider/package/pkgdmg_spec.rb b/spec/unit/provider/package/pkgdmg_spec.rb
index 3f007e01b..d4c5a9287 100755
--- a/spec/unit/provider/package/pkgdmg_spec.rb
+++ b/spec/unit/provider/package/pkgdmg_spec.rb
@@ -15,7 +15,7 @@ describe provider do
@fakehdiutilplist = Plist::Emit.dump(@fakehdiutilinfo)
@hdiutilmountargs = ["mount", "-plist", "-nobrowse", "-readonly",
- "-noidme", "-mountrandom", "/tmp"]
+ "-noidme", "-mountrandom", "/tmp"]
end
it "should not be versionable" do
@@ -76,9 +76,9 @@ describe provider do
it "should call installpkg if a flat pkg file is found instead of a .dmg image" do
@resource.stubs(:[]).with(:source).returns "/tmp/test.pkg"
@resource.stubs(:[]).with(:name).returns "testpkg"
- @provider.class.expects(:installpkgdmg).with("#{@fakepkgfile}", "testpkg").returns ""
- @provider.install
- end
+ @provider.class.expects(:installpkgdmg).with("#{@fakepkgfile}", "testpkg").returns ""
+ @provider.install
+ end
end
-
+
end
diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb
index be45a4cc7..b7f3687c6 100644
--- a/spec/unit/provider/package/zypper_spec.rb
+++ b/spec/unit/provider/package/zypper_spec.rb
@@ -68,14 +68,14 @@ describe provider_class do
fake_data = "Loading repository data...
Reading installed packages...
-S | Repository | Name | Version | Arch
+S | Repository | Name | Version | Arch
--+----------------+-----------------------+-----------------+-------
v | SLES11-Updates | cups | 1.1.1 | x86_64
v | SLES11-Updates | mypackage | 1.3.9h-8.20.1 | x86_64"
- @provider.expects(:zypper).with("list-updates").returns fake_data
- @provider.latest.should == "1.3.9h-8.20.1"
+ @provider.expects(:zypper).with("list-updates").returns fake_data
+ @provider.latest.should == "1.3.9h-8.20.1"
end
end
- end
+end
diff --git a/spec/unit/provider/selmodule_spec.rb b/spec/unit/provider/selmodule_spec.rb
index 5f60322d8..ed20ea97f 100755
--- a/spec/unit/provider/selmodule_spec.rb
+++ b/spec/unit/provider/selmodule_spec.rb
@@ -61,6 +61,6 @@ describe provider_class do
@provider.syncversion.should == :false
end
- end
+ end
end
diff --git a/spec/unit/provider/service/daemontools_spec.rb b/spec/unit/provider/service/daemontools_spec.rb
index a2198bb9d..2d61d2322 100755
--- a/spec/unit/provider/service/daemontools_spec.rb
+++ b/spec/unit/provider/service/daemontools_spec.rb
@@ -163,4 +163,4 @@ describe provider_class do
end
end
- end
+end
diff --git a/spec/unit/provider/service/debian_spec.rb b/spec/unit/provider/service/debian_spec.rb
index ea87c375d..08cf50c27 100755
--- a/spec/unit/provider/service/debian_spec.rb
+++ b/spec/unit/provider/service/debian_spec.rb
@@ -57,25 +57,25 @@ describe provider_class do
@provider.disable
end
end
-
+
describe "when checking whether it is enabled" do
it "should call Kernel.system() with the appropriate parameters" do
@provider.expects(:system).with("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start").once
@provider.enabled?
end
-
+
it "should return true when invoke-rc.d exits with 104 status" do
@provider.stubs(:system)
$?.stubs(:exitstatus).returns(104)
@provider.enabled?.should == :true
end
-
+
it "should return true when invoke-rc.d exits with 106 status" do
@provider.stubs(:system)
$?.stubs(:exitstatus).returns(106)
@provider.enabled?.should == :true
end
-
+
# pick a range of non-[104.106] numbers, strings and booleans to test with.
[-100, -1, 0, 1, 100, "foo", "", :true, :false].each do |exitstatus|
it "should return false when invoke-rc.d exits with #{exitstatus} status" do
@@ -86,4 +86,4 @@ describe provider_class do
end
end
- end
+end
diff --git a/spec/unit/provider/service/init_spec.rb b/spec/unit/provider/service/init_spec.rb
index 6dd42f54c..a685cc0d0 100755
--- a/spec/unit/provider/service/init_spec.rb
+++ b/spec/unit/provider/service/init_spec.rb
@@ -18,13 +18,13 @@ describe provider_class do
@resource.stubs(:[]).with(:path).returns ["/service/path","/alt/service/path"]
# @resource.stubs(:ref).returns "Service[myservice]"
File.stubs(:directory?).returns(true)
-
+
@provider = provider_class.new
@provider.resource = @resource
end
describe "when getting all service instances" do
- before :each do
+ before :each do
@services = ['one', 'two', 'three', 'four']
Dir.stubs(:entries).returns @services
FileTest.stubs(:directory?).returns(true)
@@ -59,14 +59,14 @@ describe provider_class do
@class.expects(:new).with{|hash| hash[:path] == @class.defpath}.returns("#{inst}_instance")
end
results = @services.sort.collect {|x| "#{x}_instance"}
- @class.instances.sort.should == results
+ @class.instances.sort.should == results
end
it "should set hasstatus to true for providers" do
@services.each do |inst|
@class.expects(:new).with{|hash| hash[:name] == inst && hash[:hasstatus] == true}.returns("#{inst}_instance")
end
results = @services.collect {|x| "#{x}_instance"}
- @class.instances.should == results
+ @class.instances.should == results
end
end
@@ -95,18 +95,18 @@ describe provider_class do
lambda { @provider.initscript }.should raise_error(Puppet::Error, "Could not find init script for 'myservice'")
end
end
-
+
describe "if the init script is present" do
before :each do
File.stubs(:stat).with("/service/path/myservice").returns true
end
-
+
[:start, :stop, :status, :restart].each do |method|
it "should have a #{method} method" do
@provider.should respond_to(method)
end
describe "when running #{method}" do
-
+
it "should use any provided explicit command" do
@resource.stubs(:[]).with(method).returns "/user/specified/command"
@provider.expects(:execute).with { |command, *args| command == ["/user/specified/command"] }
@@ -117,7 +117,7 @@ describe provider_class do
@resource.stubs(:[]).with("has#{method}".intern).returns :true
@provider.expects(:execute).with { |command, *args| command == ["/service/path/myservice",method]}
@provider.send(method)
- end
+ end
end
end
diff --git a/spec/unit/provider/service/launchd_spec.rb b/spec/unit/provider/service/launchd_spec.rb
index fa86a21a5..62570e2a8 100755
--- a/spec/unit/provider/service/launchd_spec.rb
+++ b/spec/unit/provider/service/launchd_spec.rb
@@ -33,10 +33,10 @@ describe provider_class do
@provider.stubs(:plist_from_label).returns([@joblabel, @jobplist])
@provider.stubs(:execute).returns("")
@provider.stubs(:resource).returns @resource
-
+
# We stub this out for the normal case as 10.6 is "special".
provider_class.stubs(:get_macosx_version_major).returns("10.5")
-
+
end
it "should have a start method for #{@provider.object_id}" do
@@ -78,7 +78,7 @@ describe provider_class do
@provider.status.should == :running
end
end
-
+
describe "when checking whether the service is enabled" do
it "should return true if the job plist says disabled is false" do
@provider.stubs(:plist_from_label).returns(["foo", {"Disabled" => false}])
@@ -93,7 +93,7 @@ describe provider_class do
@provider.enabled?.should == :false
end
end
-
+
describe "when checking whether the service is enabled on OS X 10.6" do
it "should return true if the job plist says disabled is true and the global overrides says disabled is false" do
provider_class.stubs(:get_macosx_version_major).returns("10.6")
@@ -178,7 +178,7 @@ describe provider_class do
@provider.stop
end
end
-
+
describe "when enabling the service on OS X 10.6" do
it "should write to the global launchd overrides file once" do
provider_class.stubs(:get_macosx_version_major).returns("10.6")
@@ -187,7 +187,7 @@ describe provider_class do
@provider.enable
end
end
-
+
describe "when disabling the service on OS X 10.6" do
it "should write to the global launchd overrides file once" do
provider_class.stubs(:get_macosx_version_major).returns("10.6")
@@ -197,4 +197,4 @@ describe provider_class do
end
end
- end
+end
diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb
index 591ef2d96..0f919ac84 100755
--- a/spec/unit/provider/service/redhat_spec.rb
+++ b/spec/unit/provider/service/redhat_spec.rb
@@ -20,10 +20,10 @@ describe provider_class do
FileTest.stubs(:file?).with('/sbin/service').returns true
FileTest.stubs(:executable?).with('/sbin/service').returns true
end
-
+
# test self.instances
describe "when getting all service instances" do
- before :each do
+ before :each do
@services = ['one', 'two', 'three', 'four', 'kudzu', 'functions', 'halt', 'killall', 'single', 'linuxconf']
@not_services = ['functions', 'halt', 'killall', 'single', 'linuxconf']
Dir.stubs(:entries).returns @services
@@ -62,7 +62,7 @@ describe provider_class do
@provider.should respond_to(method)
end
describe "when running #{method}" do
-
+
it "should use any provided explicit command" do
@resource.stubs(:[]).with(method).returns "/user/specified/command"
@provider.expects(:execute).with { |command, *args| command == ["/user/specified/command"] }
@@ -73,7 +73,7 @@ describe provider_class do
@resource.stubs(:[]).with("has#{method}".intern).returns :true
@provider.expects(:execute).with { |command, *args| command == ['/sbin/service', 'myservice', method.to_s]}
@provider.send(method)
- end
+ end
end
end
@@ -105,8 +105,8 @@ describe provider_class do
@provider.status.should == :running
end
it "should consider the service :stopped if it doesn't have a pid" do
- @provider.expects(:getpid).returns nil
- @provider.status.should == :stopped
+ @provider.expects(:getpid).returns nil
+ @provider.status.should == :stopped
end
end
end
diff --git a/spec/unit/provider/service/runit_spec.rb b/spec/unit/provider/service/runit_spec.rb
index dd8d0dac1..42309ee5f 100755
--- a/spec/unit/provider/service/runit_spec.rb
+++ b/spec/unit/provider/service/runit_spec.rb
@@ -137,4 +137,4 @@ describe provider_class do
end
end
- end
+end
diff --git a/spec/unit/provider/service/src_spec.rb b/spec/unit/provider/service/src_spec.rb
index 76a6cf850..eaa968f6e 100755
--- a/spec/unit/provider/service/src_spec.rb
+++ b/spec/unit/provider/service/src_spec.rb
@@ -34,12 +34,12 @@ describe provider_class do
end
end
- it "should execute the startsrc command" do
+ it "should execute the startsrc command" do
@provider.expects(:execute).with(['/usr/bin/startsrc', '-s', "myservice"], {:squelch => true, :failonfail => true})
@provider.start
- end
+ end
- it "should execute the stopsrc command" do
+ it "should execute the stopsrc command" do
@provider.expects(:execute).with(['/usr/bin/stopsrc', '-s', "myservice"], {:squelch => true, :failonfail => true})
@provider.stop
end
diff --git a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb
index 9fdd7f499..3b14ad3d7 100755
--- a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb
+++ b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb
@@ -56,24 +56,30 @@ describe provider_class do
}
it "should be able to generate a basic authorized_keys file" do
- key = mkkey({
- :name => "Just Testing",
- :key => "AAAAfsfddsjldjgksdflgkjsfdlgkj",
- :type => "ssh-dss",
- :ensure => :present,
- :options => [:absent]
+
+ key = mkkey(
+ {
+ :name => "Just Testing",
+ :key => "AAAAfsfddsjldjgksdflgkjsfdlgkj",
+ :type => "ssh-dss",
+ :ensure => :present,
+
+ :options => [:absent]
})
genkey(key).should == "ssh-dss AAAAfsfddsjldjgksdflgkjsfdlgkj Just Testing\n"
end
it "should be able to generate a authorized_keys file with options" do
- key = mkkey({
- :name => "root@localhost",
- :key => "AAAAfsfddsjldjgksdflgkjsfdlgkj",
- :type => "ssh-rsa",
- :ensure => :present,
- :options => ['from="192.168.1.1"', "no-pty", "no-X11-forwarding"]
+
+ key = mkkey(
+ {
+ :name => "root@localhost",
+ :key => "AAAAfsfddsjldjgksdflgkjsfdlgkj",
+ :type => "ssh-rsa",
+ :ensure => :present,
+
+ :options => ['from="192.168.1.1"', "no-pty", "no-X11-forwarding"]
})
genkey(key).should == "from=\"192.168.1.1\",no-pty,no-X11-forwarding ssh-rsa AAAAfsfddsjldjgksdflgkjsfdlgkj root@localhost\n"
@@ -117,7 +123,7 @@ describe provider_class do
@resource.stubs(:should).with(:user).returns "random_bob"
target = "/tmp/.ssh_dir/place_to_put_authorized_keys"
@resource.stubs(:should).with(:target).returns target
- end
+ end
it "should create the directory" do
File.stubs(:exist?).with("/tmp/.ssh_dir").returns false
@@ -147,7 +153,7 @@ describe provider_class do
before :each do
@resource.stubs(:should).with(:user).returns "nobody"
@resource.stubs(:should).with(:target).returns nil
- #
+ #
# I'd like to use random_bob here and something like
#
# File.stubs(:expand_path).with("~random_bob/.ssh").returns "/users/r/random_bob/.ssh"
diff --git a/spec/unit/provider/sshkey/parsed_spec.rb b/spec/unit/provider/sshkey/parsed_spec.rb
index fc6c85dbd..4180ffbaf 100755
--- a/spec/unit/provider/sshkey/parsed_spec.rb
+++ b/spec/unit/provider/sshkey/parsed_spec.rb
@@ -11,27 +11,27 @@ describe provider_class do
@key = 'AAAAB3NzaC1yc2EAAAABIwAAAQEAzwHhxXvIrtfIwrudFqc8yQcIfMudrgpnuh1F3AV6d2BrLgu/yQE7W5UyJMUjfj427sQudRwKW45O0Jsnr33F4mUw+GIMlAAmp9g24/OcrTiB8ZUKIjoPy/cO4coxGi8/NECtRzpD/ZUPFh6OEpyOwJPMb7/EC2Az6Otw4StHdXUYw22zHazBcPFnv6zCgPx1hA7QlQDWTu4YcL0WmTYQCtMUb3FUqrcFtzGDD0ytosgwSd+JyN5vj5UwIABjnNOHPZ62EY1OFixnfqX/+dUwrFSs5tPgBF/KkC6R7tmbUfnBON6RrGEmu+ajOTOLy23qUZB4CQ53V7nyAWhzqSK+hw=='
end
- it "should parse the name from the first field" do
+ it "should parse the name from the first field" do
@provider_class.parse_line('test ssh-rsa '+@key)[:name].should == "test"
end
- it "should parse the first component of the first field as the name" do
+ it "should parse the first component of the first field as the name" do
@provider_class.parse_line('test,alias ssh-rsa '+@key)[:name].should == "test"
end
- it "should parse host_aliases from the remaining components of the first field" do
+ it "should parse host_aliases from the remaining components of the first field" do
@provider_class.parse_line('test,alias ssh-rsa '+@key)[:host_aliases].should == ["alias"]
end
- it "should parse multiple host_aliases" do
+ it "should parse multiple host_aliases" do
@provider_class.parse_line('test,alias1,alias2,alias3 ssh-rsa '+@key)[:host_aliases].should == ["alias1","alias2","alias3"]
end
- it "should not drop an empty host_alias" do
+ it "should not drop an empty host_alias" do
@provider_class.parse_line('test,alias, ssh-rsa '+@key)[:host_aliases].should == ["alias",""]
end
- it "should recognise when there are no host aliases" do
+ it "should recognise when there are no host aliases" do
@provider_class.parse_line('test ssh-rsa '+@key)[:host_aliases].should == []
end
diff --git a/spec/unit/provider/user/user_role_add_spec.rb b/spec/unit/provider/user/user_role_add_spec.rb
index 781eba428..4dbfb83be 100644
--- a/spec/unit/provider/user/user_role_add_spec.rb
+++ b/spec/unit/provider/user/user_role_add_spec.rb
@@ -68,40 +68,40 @@ describe provider_class do
end
end
- describe "when calling destroy" do
- it "should use the delete command if the user exists and is not a role" do
+ describe "when calling destroy" do
+ it "should use the delete command if the user exists and is not a role" do
@provider.stubs(:exists?).returns(true)
@provider.stubs(:is_role?).returns(false)
@provider.expects(:deletecmd)
@provider.expects(:run)
@provider.destroy
- end
+ end
- it "should use the delete command if the user is a role" do
+ it "should use the delete command if the user is a role" do
@provider.stubs(:exists?).returns(true)
@provider.stubs(:is_role?).returns(true)
@provider.expects(:deletecmd)
@provider.expects(:run)
@provider.destroy
- end
- end
+ end
+ end
- describe "when calling create_role" do
- it "should use the transition(role) if the user exists" do
+ describe "when calling create_role" do
+ it "should use the transition(role) if the user exists" do
@provider.stubs(:exists?).returns(true)
@provider.stubs(:is_role?).returns(false)
@provider.expects(:transition).with("role")
@provider.expects(:run)
@provider.create_role
- end
+ end
- it "should use the add command when role doesn't exists" do
+ it "should use the add command when role doesn't exists" do
@provider.stubs(:exists?).returns(false)
@provider.expects(:addcmd)
@provider.expects(:run)
@provider.create_role
- end
- end
+ end
+ end
describe "when allow duplicate is enabled" do
before do
diff --git a/spec/unit/rails_spec.rb b/spec/unit/rails_spec.rb
index dd8d7def4..f9c68ca37 100755
--- a/spec/unit/rails_spec.rb
+++ b/spec/unit/rails_spec.rb
@@ -176,7 +176,7 @@ describe Puppet::Rails, "when initializing a 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.settings.stubs(:value).with(:dbconnections).returns(1)
+ Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
Puppet::Rails.database_arguments.should == {
:adapter => "postgresql",
@@ -226,7 +226,7 @@ describe Puppet::Rails, "when initializing an Oracle connection" do
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
- Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
+ Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
Puppet::Rails.database_arguments.should == {
:adapter => "oracle_enhanced",
@@ -252,7 +252,7 @@ describe Puppet::Rails, "when initializing an Oracle connection" do
:username => "testuser",
:password => "testpassword",
:database => "testname",
- :pool => 1
+ :pool => 1
}
end
end
diff --git a/spec/unit/run_spec.rb b/spec/unit/run_spec.rb
index 4c5f6b1af..4b654ea42 100755
--- a/spec/unit/run_spec.rb
+++ b/spec/unit/run_spec.rb
@@ -123,9 +123,12 @@ describe Puppet::Run do
"background" => true,
}
- Puppet::Run.expects(:new).with({
+
+ Puppet::Run.expects(:new).with(
+ {
:tags => "whatever",
:background => true,
+
})
Puppet::Run.from_pson(options)
diff --git a/spec/unit/ssl/certificate_authority/interface_spec.rb b/spec/unit/ssl/certificate_authority/interface_spec.rb
index f3b9107c5..4d76b7e70 100755
--- a/spec/unit/ssl/certificate_authority/interface_spec.rb
+++ b/spec/unit/ssl/certificate_authority/interface_spec.rb
@@ -215,7 +215,7 @@ describe Puppet::SSL::CertificateAuthority::Interface do
end
end
- describe "and :signed was provided" do
+ describe "and :signed was provided" do
it "should print a string containing all signed certificate requests and certificates" do
@ca.expects(:list).returns %w{host1 host2}
diff --git a/spec/unit/transaction/report_spec.rb b/spec/unit/transaction/report_spec.rb
index 4b9e06cad..1ce68b3c5 100755
--- a/spec/unit/transaction/report_spec.rb
+++ b/spec/unit/transaction/report_spec.rb
@@ -165,13 +165,13 @@ describe Puppet::Transaction::Report do
describe "for times" do
it "should provide the total amount of time for each resource type" do
add_statuses(3, :file) do |status|
- status.evaluation_time = 1
+ status.evaluation_time = 1
end
add_statuses(3, :exec) do |status|
- status.evaluation_time = 2
+ status.evaluation_time = 2
end
add_statuses(3, :mount) do |status|
- status.evaluation_time = 3
+ status.evaluation_time = 3
end
@report.calculate_metrics
diff --git a/spec/unit/transaction_spec.rb b/spec/unit/transaction_spec.rb
index 999dc77e1..f0e311371 100755
--- a/spec/unit/transaction_spec.rb
+++ b/spec/unit/transaction_spec.rb
@@ -85,7 +85,7 @@ describe Puppet::Transaction do
@transaction.add_resource_status(status)
@transaction.should be_any_failed
end
-
+
it "should not consider there to be failed resources if no statuses are marked failed" do
resource = Puppet::Type.type(:notify).new :name => "yayness"
status = Puppet::Resource::Status.new(resource)
diff --git a/spec/unit/type/computer_spec.rb b/spec/unit/type/computer_spec.rb
index c81ee45ee..7522b9599 100755
--- a/spec/unit/type/computer_spec.rb
+++ b/spec/unit/type/computer_spec.rb
@@ -8,9 +8,12 @@ describe Puppet::Type.type(:computer), " when checking computer objects" do
before do
provider_class = Puppet::Type::Computer.provider(Puppet::Type::Computer.providers[0])
Puppet::Type::Computer.expects(:defaultprovider).returns provider_class
- @resource = Puppet::Type::Computer.new(
+
+ @resource = Puppet::Type::Computer.new(
+
:name => "puppetcomputertest",
:en_address => "aa:bb:cc:dd:ee:ff",
+
:ip_address => "1.2.3.4")
@properties = {}
@ensure = Puppet::Type::Computer.attrclass(:ensure).new(:resource => @resource)
diff --git a/spec/unit/type/exec_spec.rb b/spec/unit/type/exec_spec.rb
index 1eaf80390..2a3408fc8 100755
--- a/spec/unit/type/exec_spec.rb
+++ b/spec/unit/type/exec_spec.rb
@@ -58,13 +58,13 @@ describe Puppet::Type.type(:exec) do
proc { @execer.refresh }.should raise_error(Puppet::Error)
end
-
+
it "should not report a failure if the exit status is specified in a returns array" do
command = "false"
create_resource(command, "", 1, [0,1])
proc { @execer.refresh }.should_not raise_error(Puppet::Error)
end
-
+
it "should report a failure if the exit status is not specified in a returns array" do
command = "false"
create_resource(command, "", 1, [0,100])
diff --git a/spec/unit/type/file/content_spec.rb b/spec/unit/type/file/content_spec.rb
index 2c00e50dc..a07fcba2f 100755
--- a/spec/unit/type/file/content_spec.rb
+++ b/spec/unit/type/file/content_spec.rb
@@ -173,7 +173,7 @@ describe content do
Puppet[:show_diff] = true
end
- it "should display a diff if the current contents are different from the desired content" do
+ it "should display a diff if the current contents are different from the desired content" do
@content.should = "some content"
@content.expects(:diff).returns("my diff").once
@content.expects(:print).with("my diff").once
@@ -181,7 +181,7 @@ describe content do
@content.insync?("other content")
end
- it "should not display a diff if the sum for the current contents is the same as the sum for the desired content" do
+ it "should not display a diff if the sum for the current contents is the same as the sum for the desired content" do
@content.should = "some content"
@content.expects(:diff).never
diff --git a/spec/unit/type/file/group_spec.rb b/spec/unit/type/file/group_spec.rb
index 93d09adb4..0062f0345 100755
--- a/spec/unit/type/file/group_spec.rb
+++ b/spec/unit/type/file/group_spec.rb
@@ -70,7 +70,7 @@ describe property do
@group.must be_insync(10)
end
-
+
it "should not validate that groups exist when a group is specified as an integer" do
@group.expects(:gid).never
@group.validgroup?(10)
diff --git a/spec/unit/type/file/owner_spec.rb b/spec/unit/type/file/owner_spec.rb
index a077ccec2..8b58505bd 100755
--- a/spec/unit/type/file/owner_spec.rb
+++ b/spec/unit/type/file/owner_spec.rb
@@ -7,7 +7,7 @@ property = Puppet::Type.type(:file).attrclass(:owner)
describe property do
before do
# FIXME: many of these tests exercise the provider rather than `owner`
- # and should be moved into provider tests. ~JW
+ # and should be moved into provider tests. ~JW
@provider = Puppet::Type.type(:file).provider(:posix).new
@provider.stubs(:uid).with("one").returns(1)
@@ -96,7 +96,7 @@ describe property do
@owner.must be_insync(10)
end
-
+
it "should not validate that users exist when a user is specified as an integer" do
@provider.expects(:uid).never
@provider.validuser?(10)
diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb
index 327044db6..5388dc237 100755
--- a/spec/unit/type/file_spec.rb
+++ b/spec/unit/type/file_spec.rb
@@ -195,7 +195,7 @@ describe Puppet::Type.type(:file) do
file[:path].should == "/"
end
end
-
+
describe "on Microsoft Windows systems" do
before do
Puppet.features.stubs(:posix?).returns(false)
@@ -379,8 +379,11 @@ describe Puppet::Type.type(:file) do
File.open(@file, "w", 0644) { |f| f.puts "yayness"; f.flush }
File.symlink(@file, @link)
- @resource = Puppet::Type.type(:file).new(
+
+ @resource = Puppet::Type.type(:file).new(
+
:path => @link,
+
:mode => "755"
)
@catalog.add_resource @resource
@@ -406,7 +409,7 @@ describe Puppet::Type.type(:file) do
else # @real_posix
# should recode tests using expectations instead of using the filesystem
end
-
+
describe "on Microsoft Windows systems" do
before do
Puppet.features.stubs(:posix?).returns(false)
diff --git a/spec/unit/type/macauthorization_spec.rb b/spec/unit/type/macauthorization_spec.rb
index 8785984fe..cc9f6783b 100755
--- a/spec/unit/type/macauthorization_spec.rb
+++ b/spec/unit/type/macauthorization_spec.rb
@@ -20,8 +20,8 @@ describe Puppet::Type.type(:macauthorization), "when checking macauthorization o
parameters = [:name,]
properties = [:auth_type, :allow_root, :authenticate_user, :auth_class,
- :comment, :group, :k_of_n, :mechanisms, :rule,
- :session_owner, :shared, :timeout, :tries]
+ :comment, :group, :k_of_n, :mechanisms, :rule,
+ :session_owner, :shared, :timeout, :tries]
parameters.each do |parameter|
it "should have a %s parameter" % parameter do
diff --git a/spec/unit/type/maillist_spec.rb b/spec/unit/type/maillist_spec.rb
index 585336665..5dac0519f 100755
--- a/spec/unit/type/maillist_spec.rb
+++ b/spec/unit/type/maillist_spec.rb
@@ -14,7 +14,7 @@ describe maillist do
@provider_class.stubs(:new).returns(@provider)
Puppet::Type.type(:maillist).stubs(:defaultprovider).returns(@provider_class)
-
+
@maillist = Puppet::Type.type(:maillist).new( :name => 'test' )
@catalog = Puppet::Resource::Catalog.new
diff --git a/spec/unit/type/mount_spec.rb b/spec/unit/type/mount_spec.rb
index 0cf52e8d7..30c3aafef 100755
--- a/spec/unit/type/mount_spec.rb
+++ b/spec/unit/type/mount_spec.rb
@@ -120,7 +120,7 @@ describe Puppet::Type.type(:mount)::Ensure do
@ensure.should = :defined
@ensure.sync
end
-
+
it "should not unmount itself if it is mounted and should be defined" do
@provider.stubs(:ensure).returns(:mounted)
@provider.stubs(:mounted?).returns(true)
@@ -131,7 +131,7 @@ describe Puppet::Type.type(:mount)::Ensure do
@ensure.should = :defined
@ensure.sync
end
-
+
it "should not mount itself if it is unmounted and should be defined" do
@provider.stubs(:ensure).returns(:unmounted)
@provider.stubs(:mounted?).returns(false)
@@ -186,7 +186,7 @@ describe Puppet::Type.type(:mount)::Ensure do
@ensure.should = :defined
@ensure.insync?(:mounted).should == true
end
-
+
it "should be insync if it is unmounted and should be defined" do
@ensure.should = :defined
@ensure.insync?(:unmounted).should == true
@@ -196,7 +196,7 @@ describe Puppet::Type.type(:mount)::Ensure do
@ensure.should = :present
@ensure.insync?(:mounted).should == true
end
-
+
it "should be insync if it is unmounted and should be present" do
@ensure.should = :present
@ensure.insync?(:unmounted).should == true
diff --git a/spec/unit/type/resources_spec.rb b/spec/unit/type/resources_spec.rb
index 3e65aec14..2e1cb3a55 100644
--- a/spec/unit/type/resources_spec.rb
+++ b/spec/unit/type/resources_spec.rb
@@ -23,80 +23,80 @@ describe resources do
end
describe "#generate" do
- before do
- @host1 = Puppet::Type.type(:host).new(:name => 'localhost', :ip => '127.0.0.1')
- @catalog = Puppet::Resource::Catalog.new
- @context = Puppet::Transaction.new(@catalog)
- end
-
- describe "when dealing with non-purging resources" do
- before do
- @resources = Puppet::Type.type(:resources).new(:name => 'host')
- end
-
- it "should not generate any resource" do
- @resources.generate.should be_empty
- end
+ before do
+ @host1 = Puppet::Type.type(:host).new(:name => 'localhost', :ip => '127.0.0.1')
+ @catalog = Puppet::Resource::Catalog.new
+ @context = Puppet::Transaction.new(@catalog)
end
- describe "when the catalog contains a purging resource" do
- before do
- @resources = Puppet::Type.type(:resources).new(:name => 'host', :purge => true)
- @purgeable_resource = Puppet::Type.type(:host).new(:name => 'localhost', :ip => '127.0.0.1')
- @catalog.add_resource @resources
- end
+ describe "when dealing with non-purging resources" do
+ before do
+ @resources = Puppet::Type.type(:resources).new(:name => 'host')
+ end
- it "should not generate a duplicate of that resource" do
- Puppet::Type.type(:host).stubs(:instances).returns [@host1]
- @catalog.add_resource @host1
- @resources.generate.collect { |r| r.ref }.should_not include(@host1.ref)
+ it "should not generate any resource" do
+ @resources.generate.should be_empty
+ end
end
- it "should not include the skipped users" do
- res = Puppet::Type.type(:resources).new :name => :user, :purge => true
- res.catalog = Puppet::Resource::Catalog.new
+ describe "when the catalog contains a purging resource" do
+ before do
+ @resources = Puppet::Type.type(:resources).new(:name => 'host', :purge => true)
+ @purgeable_resource = Puppet::Type.type(:host).new(:name => 'localhost', :ip => '127.0.0.1')
+ @catalog.add_resource @resources
+ end
+
+ it "should not generate a duplicate of that resource" do
+ Puppet::Type.type(:host).stubs(:instances).returns [@host1]
+ @catalog.add_resource @host1
+ @resources.generate.collect { |r| r.ref }.should_not include(@host1.ref)
+ end
- users = [
- Puppet::Type.type(:user).new(:name => "root")
- ]
- Puppet::Type.type(:user).expects(:instances).returns users
- list = res.generate
+ it "should not include the skipped users" do
+ res = Puppet::Type.type(:resources).new :name => :user, :purge => true
+ res.catalog = Puppet::Resource::Catalog.new
- names = list.collect { |r| r[:name] }
- names.should_not be_include("root")
- end
+ users = [
+ Puppet::Type.type(:user).new(:name => "root")
+ ]
+ Puppet::Type.type(:user).expects(:instances).returns users
+ list = res.generate
- describe "when generating a purgeable resource" do
- it "should be included in the generated resources" do
- Puppet::Type.type(:host).stubs(:instances).returns [@purgeable_resource]
- @resources.generate.collect { |r| r.ref }.should include(@purgeable_resource.ref)
+ names = list.collect { |r| r[:name] }
+ names.should_not be_include("root")
end
- end
- describe "when the instance's do not have an ensure property" do
- it "should not be included in the generated resources" do
- @no_ensure_resource = Puppet::Type.type(:exec).new(:name => '/usr/bin/env echo')
- Puppet::Type.type(:host).stubs(:instances).returns [@no_ensure_resource]
- @resources.generate.collect { |r| r.ref }.should_not include(@no_ensure_resource.ref)
+ describe "when generating a purgeable resource" do
+ it "should be included in the generated resources" do
+ Puppet::Type.type(:host).stubs(:instances).returns [@purgeable_resource]
+ @resources.generate.collect { |r| r.ref }.should include(@purgeable_resource.ref)
+ end
end
- end
- describe "when the instance's ensure property does not accept absent" do
- it "should not be included in the generated resources" do
- @no_absent_resource = Puppet::Type.type(:service).new(:name => 'foobar')
- Puppet::Type.type(:host).stubs(:instances).returns [@no_absent_resource]
- @resources.generate.collect { |r| r.ref }.should_not include(@no_absent_resource.ref)
+ describe "when the instance's do not have an ensure property" do
+ it "should not be included in the generated resources" do
+ @no_ensure_resource = Puppet::Type.type(:exec).new(:name => '/usr/bin/env echo')
+ Puppet::Type.type(:host).stubs(:instances).returns [@no_ensure_resource]
+ @resources.generate.collect { |r| r.ref }.should_not include(@no_ensure_resource.ref)
+ end
+ end
+
+ describe "when the instance's ensure property does not accept absent" do
+ it "should not be included in the generated resources" do
+ @no_absent_resource = Puppet::Type.type(:service).new(:name => 'foobar')
+ Puppet::Type.type(:host).stubs(:instances).returns [@no_absent_resource]
+ @resources.generate.collect { |r| r.ref }.should_not include(@no_absent_resource.ref)
+ end
end
- end
- describe "when checking the instance fails" do
- it "should not be included in the generated resources" do
- @purgeable_resource = Puppet::Type.type(:host).new(:name => 'foobar')
- Puppet::Type.type(:host).stubs(:instances).returns [@purgeable_resource]
- @resources.expects(:check).with(@purgeable_resource).returns(false)
- @resources.generate.collect { |r| r.ref }.should_not include(@purgeable_resource.ref)
+ describe "when checking the instance fails" do
+ it "should not be included in the generated resources" do
+ @purgeable_resource = Puppet::Type.type(:host).new(:name => 'foobar')
+ Puppet::Type.type(:host).stubs(:instances).returns [@purgeable_resource]
+ @resources.expects(:check).with(@purgeable_resource).returns(false)
+ @resources.generate.collect { |r| r.ref }.should_not include(@purgeable_resource.ref)
+ end
end
end
- end
end
end
diff --git a/spec/unit/type/schedule_spec.rb b/spec/unit/type/schedule_spec.rb
index 8807d0fa0..c81930873 100755
--- a/spec/unit/type/schedule_spec.rb
+++ b/spec/unit/type/schedule_spec.rb
@@ -41,9 +41,9 @@ end
describe Puppet::Type.type(:schedule) do
before :each do
- Puppet.settings.stubs(:value).with(:ignoreschedules).returns(false)
+ Puppet.settings.stubs(:value).with(:ignoreschedules).returns(false)
- @schedule = Puppet::Type.type(:schedule).new(:name => "testing")
+ @schedule = Puppet::Type.type(:schedule).new(:name => "testing")
end
describe Puppet::Type.type(:schedule) do
diff --git a/spec/unit/type/ssh_authorized_key_spec.rb b/spec/unit/type/ssh_authorized_key_spec.rb
index 2fc34d318..e2262df4a 100755
--- a/spec/unit/type/ssh_authorized_key_spec.rb
+++ b/spec/unit/type/ssh_authorized_key_spec.rb
@@ -92,20 +92,26 @@ describe ssh_authorized_key do
describe "when neither user nor target is specified" do
it "should raise an error" do
proc do
+
@class.create(
- :name => "Test",
- :key => "AAA",
- :type => "ssh-rsa",
- :ensure => :present)
+
+ :name => "Test",
+ :key => "AAA",
+ :type => "ssh-rsa",
+
+ :ensure => :present)
end.should raise_error(Puppet::Error)
end
end
describe "when both target and user are specified" do
it "should use target" do
+
resource = @class.create(
+
:name => "Test",
:user => "root",
+
:target => "/tmp/blah")
resource.should(:target).should == "/tmp/blah"
end
@@ -114,8 +120,11 @@ describe ssh_authorized_key do
describe "when user is specified" do
it "should determine target" do
+
resource = @class.create(
+
:name => "Test",
+
:user => "root")
target = File.expand_path("~root/.ssh/authorized_keys")
resource.should(:target).should == target
@@ -127,12 +136,15 @@ describe ssh_authorized_key do
target = File.expand_path("~root/.ssh/authorized_keys")
resource.property(:target).insync?(target).should == true
end
- end
+ end
describe "when calling validate" do
it "should not crash on a non-existant user" do
+
resource = @class.create(
+
:name => "Test",
+
:user => "ihopesuchuserdoesnotexist")
proc { resource.validate }.should_not raise_error
end
diff --git a/spec/unit/type/zone_spec.rb b/spec/unit/type/zone_spec.rb
index 679141ee9..746d62a5c 100755
--- a/spec/unit/type/zone_spec.rb
+++ b/spec/unit/type/zone_spec.rb
@@ -6,10 +6,10 @@ zone = Puppet::Type.type(:zone)
describe zone do
before do
- zone = Puppet::Type.type(:zone)
+ zone = Puppet::Type.type(:zone)
provider = stub 'provider'
- provider.stubs(:name).returns(:solaris)
- zone.stubs(:defaultprovider).returns(provider)
+ provider.stubs(:name).returns(:solaris)
+ zone.stubs(:defaultprovider).returns(provider)
resource = stub 'resource', :resource => nil, :provider => provider, :line => nil, :file => nil
end
@@ -38,13 +38,11 @@ describe zone do
end
it "should be invalid when :ip has a \":\" and iptype is :exclusive" do
- lambda { zone.new(:name => "dummy", :ip => "if:1.2.3.4",
- :iptype => :exclusive) }.should raise_error
+ lambda { zone.new(:name => "dummy", :ip => "if:1.2.3.4", :iptype => :exclusive) }.should raise_error
end
it "should be invalid when :ip has two \":\" and iptype is :exclusive" do
- lambda { zone.new(:name => "dummy", :ip => "if:1.2.3.4:2.3.4.5",
- :iptype => :exclusive) }.should raise_error
+ lambda { zone.new(:name => "dummy", :ip => "if:1.2.3.4:2.3.4.5", :iptype => :exclusive) }.should raise_error
end
it "should be valid when :iptype is :shared and using interface and ip" do
@@ -56,8 +54,7 @@ describe zone do
end
it "should be valid when :iptype is :exclusive and using interface" do
- zone.new(:name => "dummy", :path => "/dummy", :ip => "if",
- :iptype => :exclusive)
+ zone.new(:name => "dummy", :path => "/dummy", :ip => "if", :iptype => :exclusive)
end
end
diff --git a/spec/unit/util/cache_accumulator_spec.rb b/spec/unit/util/cache_accumulator_spec.rb
index 2d976d0b1..3b5d68118 100644
--- a/spec/unit/util/cache_accumulator_spec.rb
+++ b/spec/unit/util/cache_accumulator_spec.rb
@@ -25,16 +25,22 @@ describe Puppet::Util::CacheAccumulator do
end
it 'should delegate bulk lookups to find with appropriate arguments and returning result count' do
- @test_class.expects(:find).with(:all,
- :conditions => {:name => ['a', 'b', 'c']}
- ).returns(['a','b','c'].collect {|n| @test_class.new(n)}).once
+
+ @test_class.expects(:find).with(
+ :all,
+
+ :conditions => {:name => ['a', 'b', 'c']}
+ ).returns(['a','b','c'].collect {|n| @test_class.new(n)}).once
@test_class.accumulate_by_name('a', 'b', 'c').should == 3
end
it 'should only need find_or_create_by_name lookup for missing bulk entries' do
- @test_class.expects(:find).with(:all,
- :conditions => {:name => ['a', 'b']}
- ).returns([ @test_class.new('a') ]).once
+
+ @test_class.expects(:find).with(
+ :all,
+
+ :conditions => {:name => ['a', 'b']}
+ ).returns([ @test_class.new('a') ]).once
@test_class.expects(:find_or_create_by_name).with('b').returns(@test_class.new('b')).once
@test_class.expects(:find_or_create_by_name).with('a').never
@test_class.accumulate_by_name('a','b').should == 1
diff --git a/spec/unit/util/file_locking_spec.rb b/spec/unit/util/file_locking_spec.rb
index 35e7f781e..9a8fad1f2 100755
--- a/spec/unit/util/file_locking_spec.rb
+++ b/spec/unit/util/file_locking_spec.rb
@@ -30,7 +30,7 @@ describe Puppet::Util::FileLocking do
File.stubs(:exists?).with('/file').returns true
File.stubs(:file?).with('/file').returns true
end
-
+
it "should use a global shared mutex" do
@sync = mock 'sync'
@sync.expects(:synchronize).with(Sync::SH).once
@@ -66,7 +66,7 @@ describe Puppet::Util::FileLocking do
File.expects(:exists?).with('/file').returns false
File.expects(:open).with('/file').once
- Puppet::Util::FileLocking.readlock('/file')
+ Puppet::Util::FileLocking.readlock('/file')
end
end
@@ -150,7 +150,7 @@ describe Puppet::Util::FileLocking do
File.expects(:exists?).with('/file').returns false
File.expects(:open).with('/file', 'w', 0600).once
- Puppet::Util::FileLocking.writelock('/file')
+ Puppet::Util::FileLocking.writelock('/file')
end
end
end
diff --git a/spec/unit/util/log_spec.rb b/spec/unit/util/log_spec.rb
index 917ad7dab..6414a37ff 100755
--- a/spec/unit/util/log_spec.rb
+++ b/spec/unit/util/log_spec.rb
@@ -15,7 +15,7 @@ describe Puppet::Util::Log do
describe Puppet::Util::Log::DestConsole do
before do
- @console = Puppet::Util::Log::DestConsole.new
+ @console = Puppet::Util::Log::DestConsole.new
end
it "should colorize if Puppet[:color] is :ansi" do
@@ -173,7 +173,7 @@ describe Puppet::Util::Log do
it "should use the source_descriptors" do
source = stub "source"
source.stubs(:source_descriptors).returns(:tags => ["tag","tag2"], :path => "path", :version => 100)
-
+
log = Puppet::Util::Log.new(:level => "notice", :message => :foo)
log.expects(:tag).with("tag")
log.expects(:tag).with("tag2")
diff --git a/spec/unit/util/selinux_spec.rb b/spec/unit/util/selinux_spec.rb
index 88f4ac809..3e10b59ed 100755
--- a/spec/unit/util/selinux_spec.rb
+++ b/spec/unit/util/selinux_spec.rb
@@ -19,20 +19,20 @@ describe Puppet::Util::SELinux do
before do
end
it "should return :true if this system has SELinux enabled" do
- Selinux.expects(:is_selinux_enabled).returns 1
- selinux_support?.should be_true
+ Selinux.expects(:is_selinux_enabled).returns 1
+ selinux_support?.should be_true
end
it "should return :false if this system lacks SELinux" do
- Selinux.expects(:is_selinux_enabled).returns 0
- selinux_support?.should be_false
+ Selinux.expects(:is_selinux_enabled).returns 0
+ selinux_support?.should be_false
end
-
+
it "should return nil if /proc/mounts does not exist" do
File.stubs(:open).with("/proc/mounts").raises("No such file or directory - /proc/mounts")
read_mounts.should == nil
end
- end
+ end
describe "filesystem detection" do
before :each do
@@ -77,7 +77,7 @@ describe Puppet::Util::SELinux do
describe "realpath" do
it "should handle files that don't exist" do
- # Since I'm stubbing Pathname.new for this test,
+ # Since I'm stubbing Pathname.new for this test,
# I need to also stub the internal calls to Pathname.new,
# which happen in Pathname.dirname and Parthname.basename
# I want those to return real Pathname objects,
@@ -194,7 +194,7 @@ describe Puppet::Util::SELinux do
end
describe "set_selinux_context" do
- before :each do
+ before :each do
fh = stub 'fh', :close => nil
File.stubs(:open).with("/proc/mounts").returns fh
fh.stubs(:read_nonblock).returns(
@@ -206,7 +206,7 @@ describe Puppet::Util::SELinux do
).then.raises EOFError
end
- it "should return nil if there is no SELinux support" do
+ it "should return nil if there is no SELinux support" do
self.expects(:selinux_support?).returns false
set_selinux_context("/foo", "user_u:role_r:type_t:s0").should be_nil
end
diff --git a/spec/unit/util/settings/file_setting_spec.rb b/spec/unit/util/settings/file_setting_spec.rb
index 55ad2df8e..1fe372ccf 100755
--- a/spec/unit/util/settings/file_setting_spec.rb
+++ b/spec/unit/util/settings/file_setting_spec.rb
@@ -61,7 +61,7 @@ describe Puppet::Util::Settings::FileSetting do
describe "when reading the owner" do
it "should be root when the setting specifies root" do
- setting = FileSetting.new(:settings => mock("settings"), :owner => "root", :desc => "a setting")
+ setting = FileSetting.new(:settings => mock("settings"), :owner => "root", :desc => "a setting")
setting.owner.should == "root"
end
diff --git a/spec/unit/util/settings_spec.rb b/spec/unit/util/settings_spec.rb
index 56769af71..d7925101c 100755
--- a/spec/unit/util/settings_spec.rb
+++ b/spec/unit/util/settings_spec.rb
@@ -122,7 +122,7 @@ describe Puppet::Util::Settings do
@settings[:bool].should == true
end
- it "should not consider a cli setting of a non boolean with a boolean as an argument to be a boolean" do
+ it "should not consider a cli setting of a non boolean with a boolean as an argument to be a boolean" do
# Turn it off first
@settings[:myval] = "bob"
@settings.handlearg("--no-myval", "")
diff --git a/spec/unit/util/user_attr_spec.rb b/spec/unit/util/user_attr_spec.rb
index 57787b1a6..88f538bb8 100644
--- a/spec/unit/util/user_attr_spec.rb
+++ b/spec/unit/util/user_attr_spec.rb
@@ -20,7 +20,7 @@ describe UserAttr do
end
it "should return a hash with the name value from /etc/user_attr" do
- UserAttr.get_attributes_by_name('foo')[:name].should == 'foo'
+ UserAttr.get_attributes_by_name('foo')[:name].should == 'foo'
end
#this test is contrived
diff --git a/spec/unit/util/zaml_spec.rb b/spec/unit/util/zaml_spec.rb
index 1f21c4e29..e39dbdf99 100644
--- a/spec/unit/util/zaml_spec.rb
+++ b/spec/unit/util/zaml_spec.rb
@@ -12,7 +12,7 @@ describe "Pure ruby yaml implementation" do
[] => "--- []",
:symbol => "--- !ruby/sym symbol",
{:a => "A"} => "--- \n !ruby/sym a: A"
- }.each { |o,y|
+ }.each { |o,y|
it "should convert the #{o.class} #{o.inspect} to yaml" do
o.to_yaml.should == y
end
@@ -26,7 +26,7 @@ describe "Pure ruby yaml implementation" do
Object.new => "--- !ruby/object {}",
[Object.new] => "--- \n - !ruby/object {}",
{Object.new => Object.new} => "--- \n ? !ruby/object {}\n : !ruby/object {}"
- }.each { |o,y|
+ }.each { |o,y|
it "should convert the #{o.class} #{o.inspect} to yaml" do
o.to_yaml.should == y
end