summaryrefslogtreecommitdiff
path: root/spec/unit/api_client_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/api_client_spec.rb')
-rw-r--r--spec/unit/api_client_spec.rb24
1 files changed, 9 insertions, 15 deletions
diff --git a/spec/unit/api_client_spec.rb b/spec/unit/api_client_spec.rb
index 398181bfd0..c5feec3a4e 100644
--- a/spec/unit/api_client_spec.rb
+++ b/spec/unit/api_client_spec.rb
@@ -82,7 +82,6 @@ describe Chef::ApiClient do
expect { @client.public_key Hash.new }.to raise_error(ArgumentError)
end
-
it "has a private key attribute" do
@client.private_key("super private")
expect(@client.private_key).to eq("super private")
@@ -215,13 +214,13 @@ describe Chef::ApiClient do
before(:each) do
client = {
- "name" => "black",
- "clientname" => "black",
- "public_key" => "crowes",
- "private_key" => "monkeypants",
- "admin" => true,
- "validator" => true,
- "json_class" => "Chef::ApiClient",
+ "name" => "black",
+ "clientname" => "black",
+ "public_key" => "crowes",
+ "private_key" => "monkeypants",
+ "admin" => true,
+ "validator" => true,
+ "json_class" => "Chef::ApiClient",
}
@http_client = double("Chef::ServerAPI mock")
allow(Chef::ServerAPI).to receive(:new).and_return(@http_client)
@@ -252,7 +251,6 @@ describe Chef::ApiClient do
it "includes the private key if present" do
expect(@client.private_key).to eq("monkeypants")
end
-
end
describe "with correctly configured API credentials" do
@@ -267,12 +265,10 @@ describe Chef::ApiClient do
end
let :private_key_data do
- File.open(Chef::Config[:client_key], "r") {|f| f.read.chomp }
+ File.open(Chef::Config[:client_key], "r") { |f| f.read.chomp }
end
-
end
-
describe "when requesting a new key" do
before do
@http_client = double("Chef::ServerAPI mock")
@@ -299,7 +295,6 @@ describe Chef::ApiClient do
expect(@http_client).to receive(:get).with("clients/lost-my-key").and_return(@api_client_without_key)
end
-
context "and the client exists on a Chef 11-like server" do
before do
@api_client_with_key = Chef::ApiClient.new
@@ -322,7 +317,7 @@ describe Chef::ApiClient do
context "and the client exists on a Chef 10-like server" do
before do
- @api_client_with_key = {"name" => "lost-my-key", "private_key" => "the new private key"}
+ @api_client_with_key = { "name" => "lost-my-key", "private_key" => "the new private key" }
expect(@http_client).to receive(:put).
with("clients/lost-my-key", :name => "lost-my-key", :admin => false, :validator => false, :private_key => true).
and_return(@api_client_with_key)
@@ -338,7 +333,6 @@ describe Chef::ApiClient do
expect(response.validator).to be_falsey
end
end
-
end
end
end