Sha256: 7c61158db551cd4b562bce79c24e9b7d2eb9b0f3e4a9b676138b69bef7072068
Contents?: true
Size: 1.35 KB
Versions: 7
Compression:
Stored size: 1.35 KB
Contents
require 'helper' class TestHttp < Test::Unit::TestCase def setup @client = Whatser.client end def test_request_options_default @client.oauth_token = '123' expected = {:query => {:oauth_token => '123'}, :body => nil} assert_equal expected, @client.send(:request_options) end def test_request_options_with_query @client.oauth_token = '123' expected = {:query => {:oauth_token => '123', :extra => 1}, :body => nil} assert_equal expected, @client.send(:request_options, {:query => {:extra => 1} }) end def test_request_options_with_body @client.oauth_token = '123' expected = {:query => {:oauth_token => '123'}, :body => {:extra => 1}} assert_equal expected, @client.send(:request_options, {:body => {:extra => 1} }) end def test_request_options_with_client_auth @client.api_key = '123' expected = {:query => {:client_id => '123'}, :body => nil} assert_equal expected, @client.send(:request_options, {}, {:auth => :key}) end def test_base_uri_on_included assert_equal @client.api_uri, Whatser::Http.base_uri end def test_request response = @client.request(:get, '/', {}) assert response.is_a?(Whatser::Response) end def test_compose_url path = '/api/endpoint' uri = @client.api_uri assert_equal "#{uri}#{path}", @client.send(:compose_url, path) end end
Version data entries
7 entries across 7 versions & 1 rubygems