test/zeppelin_test.rb in zeppelin-0.4.0 vs test/zeppelin_test.rb in zeppelin-0.5.0

- old
+ new

@@ -10,10 +10,11 @@ assert_instance_of Faraday::Connection, @client.connection assert_equal 'https', @client.connection.scheme assert_equal 'go.urbanairship.com', @client.connection.host assert_includes @client.connection.builder.handlers, Faraday::Adapter::NetHttp assert_includes @client.connection.builder.handlers, Faraday::Request::JSON + assert_includes @client.connection.builder.handlers, Zeppelin::JsonParserMiddleware assert_equal 'Basic YXBwIGtleTphcHAgbWFzdGVyIHNlY3JldA==', @client.connection.headers['Authorization'] end test '#initialize with custom options' do ssl_options = { :ca_path => '/dev/null' } @@ -68,11 +69,11 @@ test '#device_token with valid device token' do response_body = { 'foo' => 'bar' } stub_requests @client.connection do |stub| stub.get("/api/device_tokens/#{@device_token}") do - [200, {}, Yajl::Encoder.encode(response_body)] + [200, { 'Content-Type' => 'application/json' }, Yajl::Encoder.encode(response_body)] end end response = @client.device_token(@device_token) assert_equal response_body, response @@ -158,11 +159,11 @@ test '#apid' do response_body = { 'foo' => 'bar' } stub_requests @client.connection do |stub| stub.get("/api/apids/#{@apid}") do - [200, {}, Yajl::Encoder.encode(response_body)] + [200, { 'Content-Type' => 'application/json' }, Yajl::Encoder.encode(response_body)] end end response = @client.apid(@apid) assert_equal response_body, response @@ -287,11 +288,11 @@ response_body = { 'foo' => 'bar' } since = Time.at(0) stub_requests @client.connection do |stub| stub.get('/api/device_tokens/feedback/?since=1970-01-01T00%3A00%3A00Z') do - [200, {}, Yajl::Encoder.encode(response_body)] + [200, { 'Content-Type' => 'application/json' }, Yajl::Encoder.encode(response_body)] end end response = @client.feedback(since) assert_equal response_body, response @@ -313,11 +314,11 @@ test '#tags' do response_body = { 'tags' => ['green', 'eggs'] } stub_requests @client.connection do |stub| stub.get('/api/tags/') do - [200, {}, Yajl::Encoder.encode(response_body)] + [200, { 'Content-Type' => 'application/json' }, Yajl::Encoder.encode(response_body)] end end response = @client.tags assert_equal response_body, response @@ -380,10 +381,10 @@ device_token = 'CAFEBABE' response_body = { 'tags' => ['tag1', 'some_tag'] } stub_requests @client.connection do |stub| stub.get("/api/device_tokens/#{device_token}/tags/") do - [200, {}, Yajl::Encoder.encode(response_body)] + [200, { 'Content-Type' => 'application/json' }, Yajl::Encoder.encode(response_body)] end end response = @client.device_tags(device_token) assert_equal response_body, response