summaryrefslogtreecommitdiff
path: root/spec/unit/http/json_input_spec.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-02-04 08:35:04 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-02-04 08:35:04 -0800
commit938c37c2dd5bff3b888540ae1ae4d2e51b3208d8 (patch)
tree2ee587d74840857a1aaffc09692781d64ebd85ef /spec/unit/http/json_input_spec.rb
parentdfeb0a2f8888ea8e1f1860e3da7ad7a1a4dac56f (diff)
downloadchef-lcg/whitespace-style.tar.gz
whitespace fixeslcg/whitespace-style
5533 Style/SpaceInsideHashLiteralBraces 2619 Style/SpaceAroundOperators 2288 Style/EmptyLinesAroundBlockBody 2012 Style/SpaceInsideBlockBraces 1444 Style/AlignHash 1395 Style/SpaceAfterComma 1382 Style/SpaceAroundEqualsInParameterDefault 800 Style/EmptyLinesAroundClassBody 396 Style/IndentationConsistency 354 Style/ExtraSpacing 310 Style/SpaceBeforeBlockBraces 309 Style/EmptyLines 304 Style/TrailingWhitespace 241 Style/MultilineOperationIndentation 230 Style/TrailingBlankLines 219 Style/EmptyLinesAroundModuleBody 212 Style/IndentHash 147 Style/IndentationWidth 120 Style/EmptyLineBetweenDefs 107 Style/SpaceAroundBlockParameters 63 Style/EmptyLinesAroundMethodBody 29 Style/EmptyLinesAroundAccessModifier 1 Style/RescueEnsureAlignment
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