esa 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7461ca15a88d20109816db2ac644209d7d8164fb
4
- data.tar.gz: b9b6056c8cf9ae876ee75577a870427b0cb3970d
3
+ metadata.gz: 2b50bf1ea2984c2e282f9b7afc4f0f1927f91f3e
4
+ data.tar.gz: 219f7cd0de527986a35c0e5374f5d962a0a80e56
5
5
  SHA512:
6
- metadata.gz: bc5cd7475cb4803fe3bae4eadf00aae626c72288a35d594cbfe8a897eebd182b41098df15c3536c63878bbc45cdfcf063d16ee5cbc7dab5a5d4d8ba9da7a73cd
7
- data.tar.gz: cd33861faa8dc5f6680a73ae6db7a42f8555ce257dce2e2524da730f4b8d8aa91f69aaaf0f289c331e5d2808e7ef8c4610f8400590bcaf187e683da827ab47bf
6
+ metadata.gz: 3f588ce3f76712777c9d44e0463a1578dd782c441e32a59fe139d88618153a1497b8e5bc08a0088350097d45abaa8bcae5e3a6506e062d9a3d52c2771ef5a4a3
7
+ data.tar.gz: 2231108c9643d5043fe135e53e9c939e7fec636bfcc934c4422f4dc6cfa85212165b492c19afe2bc337a0a00608c57fab78dd0dab21f9734c0a1316a15d4ff2a
@@ -0,0 +1,2 @@
1
+ ## 0.0.4 (2015-05-14)
2
+ - [Fix Esa::Response#headers and implement its spec by yasaichi · Pull Request #7 · esaio/esa-ruby](https://github.com/esaio/esa-ruby/pull/7)
@@ -11,7 +11,7 @@ module Esa
11
11
  end
12
12
 
13
13
  def headers
14
- @headers ||= @raw_headers.headers.inject({}) do |result, (key, value)|
14
+ @headers ||= @raw_headers.inject({}) do |result, (key, value)|
15
15
  result.merge(key.split("-").map(&:capitalize).join("-") => value)
16
16
  end
17
17
  end
@@ -1,3 +1,3 @@
1
1
  module Esa
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Esa::Response do
4
+ let(:response_status) { 401 }
5
+ let(:response_body) { '{"error":"unauthorized", "message":"Unauthorized"}' }
6
+ let(:response_headers) do
7
+ {
8
+ 'server' => 'Cowboy',
9
+ 'content-type' => 'application/json; charset=utf-8',
10
+ }
11
+ end
12
+ let(:connection) do
13
+ Faraday.new do |c|
14
+ c.adapter :test, Faraday::Adapter::Test::Stubs.new do |stub|
15
+ stub.get('/test') { [response_status, response_headers, response_body] }
16
+ end
17
+ end
18
+ end
19
+ let(:response) { described_class.new(connection.get('/test')) }
20
+
21
+ describe '#body' do
22
+ subject { response.body }
23
+ it { is_expected.to eq response_body }
24
+ end
25
+
26
+ describe '#headers' do
27
+ subject { response.headers }
28
+ let(:expectation) do
29
+ {
30
+ 'Server' => 'Cowboy',
31
+ 'Content-Type' => 'application/json; charset=utf-8',
32
+ }
33
+ end
34
+
35
+ it { is_expected.to eq expectation }
36
+ end
37
+
38
+ describe '#status' do
39
+ subject { response.status }
40
+ it { is_expected.to eq response_status }
41
+ end
42
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - fukayatsu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-10 00:00:00.000000000 Z
11
+ date: 2015-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -173,6 +173,7 @@ extra_rdoc_files: []
173
173
  files:
174
174
  - ".gitignore"
175
175
  - ".rspec"
176
+ - CHANGELOG.md
176
177
  - Gemfile
177
178
  - Guardfile
178
179
  - LICENSE.txt
@@ -186,6 +187,7 @@ files:
186
187
  - lib/esa/response.rb
187
188
  - lib/esa/version.rb
188
189
  - spec/esa/client_spec.rb
190
+ - spec/esa/response_spec.rb
189
191
  - spec/spec_helper.rb
190
192
  homepage: https://github.com/esaio/esa-ruby/
191
193
  licenses:
@@ -213,5 +215,6 @@ specification_version: 4
213
215
  summary: "[WIP] esa API v1 client library, written in Ruby"
214
216
  test_files:
215
217
  - spec/esa/client_spec.rb
218
+ - spec/esa/response_spec.rb
216
219
  - spec/spec_helper.rb
217
220
  has_rdoc: