summaryrefslogtreecommitdiffstats
path: root/spec/unit/network
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-07-09 18:07:15 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-09 18:07:15 -0700
commit543225970225de5697734bfaf0a6eee996802c04 (patch)
treeecc6f639c43cf1812e64f9c6ce7eacc0922b57ff /spec/unit/network
parent8f15707251cdb58d53e82c4bbd332a38c2d31b4c (diff)
downloadpuppet-543225970225de5697734bfaf0a6eee996802c04.tar.gz
puppet-543225970225de5697734bfaf0a6eee996802c04.tar.xz
puppet-543225970225de5697734bfaf0a6eee996802c04.zip
Code smell: Avoid needless decorations
* Replaced 704 occurances of (.*)\b([a-z_]+)\(\) with \1\2 3 Examples: The code: ctx = OpenSSL::SSL::SSLContext.new() becomes: ctx = OpenSSL::SSL::SSLContext.new The code: skip() becomes: skip The code: path = tempfile() becomes: path = tempfile * Replaced 31 occurances of ^( *)end *#.* with \1end 3 Examples: The code: becomes: The code: end # Dir.foreach becomes: end The code: end # def becomes: end
Diffstat (limited to 'spec/unit/network')
-rw-r--r--spec/unit/network/handler/fileserver_spec.rb20
-rw-r--r--spec/unit/network/http/compression_spec.rb4
-rwxr-xr-xspec/unit/network/http/rack/rest_spec.rb2
-rwxr-xr-xspec/unit/network/http/rack/xmlrpc_spec.rb16
-rwxr-xr-xspec/unit/network/http_pool_spec.rb2
-rwxr-xr-xspec/unit/network/rest_authconfig_spec.rb2
-rwxr-xr-xspec/unit/network/server_spec.rb2
7 files changed, 24 insertions, 24 deletions
diff --git a/spec/unit/network/handler/fileserver_spec.rb b/spec/unit/network/handler/fileserver_spec.rb
index 35da33278..371e75d24 100644
--- a/spec/unit/network/handler/fileserver_spec.rb
+++ b/spec/unit/network/handler/fileserver_spec.rb
@@ -12,7 +12,7 @@ describe Puppet::Network::Handler::FileServer do
File.open(filename, "w") { |f| f.puts filename}
end
- def create_nested_file()
+ def create_nested_file
dirname = File.join(@basedir, "nested_dir")
Dir.mkdir(dirname)
file = File.join(dirname, "nested_dir_file")
@@ -20,7 +20,7 @@ describe Puppet::Network::Handler::FileServer do
end
before do
- @basedir = File.join(Dir.tmpdir(), "test_network_handler")
+ @basedir = File.join(Dir.tmpdir, "test_network_handler")
Dir.mkdir(@basedir)
@file = File.join(@basedir, "aFile")
@link = File.join(@basedir, "aLink")
@@ -62,49 +62,49 @@ describe Puppet::Network::Handler::FileServer do
end
it "should list the contents of a nested directory" do
- create_nested_file()
+ create_nested_file
list = @mount.list("/", true, false)
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()
+ create_nested_file
list = @mount.list("/", true, "*File")
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
- create_nested_file()
+ create_nested_file
list = @mount.list("/", true, "*nested_dir")
list.sort.should == [ ["/aFile", "file"], ["/", "directory"] ].sort
end
it "should list the contents of a directory ignoring all ignore patterns that match" do
- create_nested_file()
+ create_nested_file
list = @mount.list("/", true, ["*File" , "*nested_dir"])
list.should == [ ["/", "directory"] ]
end
it "should list the directory when recursing to a depth of zero" do
- create_nested_file()
+ create_nested_file
list = @mount.list("/", 0, false)
list.should == [["/", "directory"]]
end
it "should list the base directory and files and nested directory to a depth of one" do
- create_nested_file()
+ create_nested_file
list = @mount.list("/", 1, false)
list.sort.should == [ ["/aFile", "file"], ["/nested_dir", "directory"], ["/", "directory"] ].sort
end
it "should list the base directory and files and nested directory to a depth of two" do
- create_nested_file()
+ create_nested_file
list = @mount.list("/", 2, false)
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()
+ create_nested_file
list = @mount.list("/", 42, false)
list.sort.should == [ ["/aFile", "file"], ["/", "directory"] , ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort
end
diff --git a/spec/unit/network/http/compression_spec.rb b/spec/unit/network/http/compression_spec.rb
index 63fd9e715..ace1f353a 100644
--- a/spec/unit/network/http/compression_spec.rb
+++ b/spec/unit/network/http/compression_spec.rb
@@ -175,13 +175,13 @@ describe "http compression" do
@inflater.expects(:inflate).raises(Zlib::DataError.new("not a zlib stream"))
inflater = stub_everything 'inflater2'
inflater.expects(:inflate).with("chunk").returns("uncompressed")
- Zlib::Inflate.expects(:new).with().returns(inflater)
+ Zlib::Inflate.expects(:new).with.returns(inflater)
@adapter.uncompress("chunk")
end
it "should raise the error the second time" do
@inflater.expects(:inflate).raises(Zlib::DataError.new("not a zlib stream"))
- Zlib::Inflate.expects(:new).with().returns(@inflater)
+ Zlib::Inflate.expects(:new).with.returns(@inflater)
lambda { @adapter.uncompress("chunk") }.should raise_error
end
diff --git a/spec/unit/network/http/rack/rest_spec.rb b/spec/unit/network/http/rack/rest_spec.rb
index b9d835284..fb4917d41 100755
--- a/spec/unit/network/http/rack/rest_spec.rb
+++ b/spec/unit/network/http/rack/rest_spec.rb
@@ -26,7 +26,7 @@ describe "Puppet::Network::HTTP::RackREST" do
end
before :each do
- @response = Rack::Response.new()
+ @response = Rack::Response.new
end
def mk_req(uri, opts = {})
diff --git a/spec/unit/network/http/rack/xmlrpc_spec.rb b/spec/unit/network/http/rack/xmlrpc_spec.rb
index abfe84ba6..f91f48390 100755
--- a/spec/unit/network/http/rack/xmlrpc_spec.rb
+++ b/spec/unit/network/http/rack/xmlrpc_spec.rb
@@ -39,7 +39,7 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do
end
before :each do
- @response = Rack::Response.new()
+ @response = Rack::Response.new
end
def mk_req(opts = {})
@@ -86,13 +86,13 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do
it "should set 'authenticated' to false if no certificate is present" do
req = mk_req
- Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| authenticated == false }
+ Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| authenticated == false }
@handler.process(req, @response)
end
it "should use the client's ip address" do
req = mk_req 'REMOTE_ADDR' => 'ipaddress'
- Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| ip == 'ipaddress' }
+ Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| ip == 'ipaddress' }
@handler.process(req, @response)
end
@@ -108,7 +108,7 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do
it "should retrieve the hostname by matching the certificate parameter" do
Puppet.settings.stubs(:value).returns "eh"
Puppet.settings.expects(:value).with(:ssl_client_header).returns "myheader"
- Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| node == "host.domain.com" }
+ Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| node == "host.domain.com" }
req = mk_req "myheader" => "/CN=host.domain.com"
@handler.process(req, @response)
end
@@ -123,7 +123,7 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do
it "should consider the host authenticated if the validity parameter contains 'SUCCESS'" do
Puppet.settings.stubs(:value).with(:ssl_client_header).returns "certheader"
Puppet.settings.stubs(:value).with(:ssl_client_verify_header).returns "myheader"
- Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| authenticated == true }
+ Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| authenticated == true }
req = mk_req "myheader" => "SUCCESS", "certheader" => "/CN=host.domain.com"
@handler.process(req, @response)
end
@@ -131,7 +131,7 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do
it "should consider the host unauthenticated if the validity parameter does not contain 'SUCCESS'" do
Puppet.settings.stubs(:value).with(:ssl_client_header).returns "certheader"
Puppet.settings.stubs(:value).with(:ssl_client_verify_header).returns "myheader"
- Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| authenticated == false }
+ Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| authenticated == false }
req = mk_req "myheader" => "whatever", "certheader" => "/CN=host.domain.com"
@handler.process(req, @response)
end
@@ -139,7 +139,7 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do
it "should consider the host unauthenticated if no certificate information is present" do
Puppet.settings.stubs(:value).with(:ssl_client_header).returns "certheader"
Puppet.settings.stubs(:value).with(:ssl_client_verify_header).returns "myheader"
- Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| authenticated == false }
+ Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| authenticated == false }
req = mk_req "myheader" => nil, "certheader" => "/CN=host.domain.com"
@handler.process(req, @response)
end
@@ -148,7 +148,7 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do
Puppet.settings.stubs(:value).returns "eh"
Puppet.settings.expects(:value).with(:ssl_client_header).returns "myheader"
Resolv.any_instance.expects(:getname).returns("host.domain.com")
- Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| node == "host.domain.com" }
+ Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| node == "host.domain.com" }
req = mk_req "myheader" => nil
@handler.process(req, @response)
end
diff --git a/spec/unit/network/http_pool_spec.rb b/spec/unit/network/http_pool_spec.rb
index 7fe55c5fa..1d64f9c9c 100755
--- a/spec/unit/network/http_pool_spec.rb
+++ b/spec/unit/network/http_pool_spec.rb
@@ -19,7 +19,7 @@ describe Puppet::Network::HttpPool do
it "should use the global SSL::Host instance to get its certificate information" do
host = mock 'host'
- Puppet::SSL::Host.expects(:localhost).with().returns host
+ Puppet::SSL::Host.expects(:localhost).with.returns host
Puppet::Network::HttpPool.ssl_host.should equal(host)
end
diff --git a/spec/unit/network/rest_authconfig_spec.rb b/spec/unit/network/rest_authconfig_spec.rb
index 2d41c3e5b..79fa968e8 100755
--- a/spec/unit/network/rest_authconfig_spec.rb
+++ b/spec/unit/network/rest_authconfig_spec.rb
@@ -81,7 +81,7 @@ describe Puppet::Network::RestAuthConfig do
@authconfig.expects(:insert_default_acl)
- @authconfig.parse()
+ @authconfig.parse
end
end
diff --git a/spec/unit/network/server_spec.rb b/spec/unit/network/server_spec.rb
index d981a7586..4ebbe0846 100755
--- a/spec/unit/network/server_spec.rb
+++ b/spec/unit/network/server_spec.rb
@@ -357,7 +357,7 @@ describe Puppet::Network::Server do
end
it "should require at least one namespace" do
- lambda { @server.register_xmlrpc() }.should raise_error(ArgumentError)
+ lambda { @server.register_xmlrpc }.should raise_error(ArgumentError)
end
it "should allow multiple namespaces to be registered at once" do