her 0.8.1 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,28 +8,27 @@ describe Her::Middleware::SecondLevelParseJSON do
8
8
  let(:body) { "{\"data\": 1, \"errors\": 2, \"metadata\": 3}" }
9
9
  it "parses body as json" do
10
10
  subject.parse(body).tap do |json|
11
- json[:data].should == 1
12
- json[:errors].should == 2
13
- json[:metadata].should == 3
11
+ expect(json[:data]).to eq(1)
12
+ expect(json[:errors]).to eq(2)
13
+ expect(json[:metadata]).to eq(3)
14
14
  end
15
15
  end
16
16
 
17
17
  it "parses :body key as json in the env hash" do
18
- env = { :body => body }
18
+ env = { body: body }
19
19
  subject.on_complete(env)
20
20
  env[:body].tap do |json|
21
- json[:data].should == 1
22
- json[:errors].should == 2
23
- json[:metadata].should == 3
21
+ expect(json[:data]).to eq(1)
22
+ expect(json[:errors]).to eq(2)
23
+ expect(json[:metadata]).to eq(3)
24
24
  end
25
25
  end
26
26
  end
27
27
 
28
28
  context "with invalid JSON body" do
29
29
  let(:body) { '"foo"' }
30
- it 'ensures that invalid JSON throws an exception' do
30
+ it "ensures that invalid JSON throws an exception" do
31
31
  expect { subject.parse(body) }.to raise_error(Her::Errors::ParseError, 'Response from the API must behave like a Hash or an Array (last JSON response was "\"foo\"")')
32
32
  end
33
33
  end
34
-
35
34
  end
@@ -8,8 +8,8 @@ describe Her::Model::Associations::AssociationProxy do
8
8
  builder.use Her::Middleware::FirstLevelParseJSON
9
9
  builder.use Faraday::Request::UrlEncoded
10
10
  builder.adapter :test do |stub|
11
- stub.get("/users/1") { |env| [200, {}, { :id => 1, :name => "Tobias Fünke" }.to_json ] }
12
- stub.get("/users/1/fish") { |env| [200, {}, { :id => 1, :name => "Tobias's Fish" }.to_json ] }
11
+ stub.get("/users/1") { [200, {}, { id: 1, name: "Tobias Fünke" }.to_json] }
12
+ stub.get("/users/1/fish") { [200, {}, { id: 1, name: "Tobias's Fish" }.to_json] }
13
13
  end
14
14
  end
15
15
  spawn_model "User" do
@@ -26,6 +26,3 @@ describe Her::Model::Associations::AssociationProxy do
26
26
  end
27
27
  end
28
28
  end
29
-
30
-
31
-