summaryrefslogtreecommitdiff
path: root/spec/unit/api_client/registration_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/api_client/registration_spec.rb')
-rw-r--r--spec/unit/api_client/registration_spec.rb26
1 files changed, 10 insertions, 16 deletions
diff --git a/spec/unit/api_client/registration_spec.rb b/spec/unit/api_client/registration_spec.rb
index f41c5d8653..08dc6ed09f 100644
--- a/spec/unit/api_client/registration_spec.rb
+++ b/spec/unit/api_client/registration_spec.rb
@@ -22,7 +22,6 @@ require "tempfile"
require "chef/api_client/registration"
describe Chef::ApiClient::Registration do
-
let(:key_location) do
make_tmpname("client-registration-key")
end
@@ -32,7 +31,7 @@ describe Chef::ApiClient::Registration do
subject(:registration) { Chef::ApiClient::Registration.new(client_name, key_location) }
let(:private_key_data) do
- File.open(Chef::Config[:validation_key], "r") {|f| f.read.chomp }
+ File.open(Chef::Config[:validation_key], "r") { |f| f.read.chomp }
end
let(:http_mock) { double("Chef::ServerAPI mock") }
@@ -67,7 +66,6 @@ describe Chef::ApiClient::Registration do
let(:generated_private_key) { OpenSSL::PKey::RSA.new(generated_private_key_pem) }
let(:generated_public_key) { generated_private_key.public_key }
-
let(:create_with_pkey_response) do
{
"uri" => "",
@@ -78,12 +76,12 @@ describe Chef::ApiClient::Registration do
end
let(:update_with_pkey_response) do
- {"name"=>client_name,
- "admin"=>false,
- "public_key"=> generated_public_key,
- "validator"=>false,
- "private_key"=>false,
- "clientname"=>client_name}
+ { "name" => client_name,
+ "admin" => false,
+ "public_key" => generated_public_key,
+ "validator" => false,
+ "private_key" => false,
+ "clientname" => client_name }
end
before do
@@ -147,7 +145,6 @@ describe Chef::ApiClient::Registration do
end
context "when local key generation is disabled" do
-
let(:expected_post_data) do
{ :name => client_name, :admin => false }
end
@@ -217,7 +214,7 @@ describe Chef::ApiClient::Registration do
context "when the client key location is a symlink" do
it "does not follow the symlink", :unix_only do
- expected_flags = (File::CREAT|File::TRUNC|File::RDWR)
+ expected_flags = (File::CREAT | File::TRUNC | File::RDWR)
if defined?(File::NOFOLLOW)
expected_flags |= File::NOFOLLOW
@@ -232,14 +229,13 @@ describe Chef::ApiClient::Registration do
end
it "follows the symlink", :unix_only do
- expect(registration.file_flags).to eq(File::CREAT|File::TRUNC|File::RDWR)
+ expect(registration.file_flags).to eq(File::CREAT | File::TRUNC | File::RDWR)
end
end
end
end
describe "when registering a client" do
-
before do
allow(registration).to receive(:http_api).and_return(http_mock)
end
@@ -271,9 +267,7 @@ describe Chef::ApiClient::Registration do
expect(http_mock).to receive(:post).exactly(6).times.and_raise(exception_500)
- expect {registration.run}.to raise_error(Net::HTTPFatalError)
+ expect { registration.run }.to raise_error(Net::HTTPFatalError)
end
-
end
-
end