summaryrefslogtreecommitdiff
path: root/spec/unit/http/json_input_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/http/json_input_spec.rb')
-rw-r--r--spec/unit/http/json_input_spec.rb16
1 files changed, 3 insertions, 13 deletions
diff --git a/spec/unit/http/json_input_spec.rb b/spec/unit/http/json_input_spec.rb
index e26e030737..3f547c0b48 100644
--- a/spec/unit/http/json_input_spec.rb
+++ b/spec/unit/http/json_input_spec.rb
@@ -20,7 +20,6 @@ require "spec_helper"
require "chef/http/json_input"
describe Chef::HTTP::JSONInput do
-
let(:json_encoder) { described_class.new() }
let(:url) { URI.parse("http://example.com") }
@@ -54,7 +53,6 @@ describe Chef::HTTP::JSONInput do
end
context "when handling a request with no body" do
-
let(:http_method) { :get }
let(:data) { nil }
@@ -64,13 +62,11 @@ describe Chef::HTTP::JSONInput do
end
context "when the request should be serialized" do
-
let(:http_method) { :put }
- let(:data) { {foo: "bar"} }
+ let(:data) { { foo: "bar" } }
let(:expected_data) { %q[{"foo":"bar"}] }
context "and the request has a ruby object as the body and no explicit content-type" do
-
it "serializes the body to json" do
# Headers Hash get mutated, so we start by asserting it's empty:
expect(headers).to be_empty
@@ -84,7 +80,6 @@ describe Chef::HTTP::JSONInput do
end
context "ant the request has an explicit content type of json" do
-
it "serializes the body to json when content-type is all lowercase" do
headers["content-type"] = "application/json"
@@ -95,13 +90,10 @@ describe Chef::HTTP::JSONInput do
expect(headers).to have_key("Content-Type")
expect(headers["Content-Type"]).to eq("application/json")
end
-
end
-
end
context "when handling a request with an explicit content type other than json" do
-
let(:http_method) { :put }
let(:data) { "some arbitrary bytes" }
@@ -111,7 +103,7 @@ describe Chef::HTTP::JSONInput do
expect(handle_request).to eq([http_method, url, headers, data])
# not normalized
- expect(headers).to eq({"content-type" => "application/x-binary"})
+ expect(headers).to eq({ "content-type" => "application/x-binary" })
end
it "does not serialize the body to json when content type is given in capitalized form" do
@@ -120,9 +112,7 @@ describe Chef::HTTP::JSONInput do
expect(handle_request).to eq([http_method, url, headers, data])
# not normalized
- expect(headers).to eq({"Content-Type" => "application/x-binary"})
+ expect(headers).to eq({ "Content-Type" => "application/x-binary" })
end
-
end
-
end