require 'test_helper' class ClientTest < Totter::TestCase def test_initialization client = Totter::Client.new(:access_token => 'asdf1234') assert_equal 'asdf1234', client.access_token assert client.authenticated? client = Totter::Client.new('asdf1234') assert_equal 'asdf1234', client.access_token client = Totter::Client.new refute client.authenticated? end def test_base_url client = Totter::Client.new assert_equal 'https://api.seesaw.co/v1/', client.base_url client = Totter::Client.new(:api_scheme => 'http', :api_host => 'example.com', :api_version => 42) assert_equal 'http://example.com/v42/', client.base_url end def test_ssl? client = Totter::Client.new assert client.ssl? client = Totter::Client.new(:api_scheme => 'http') refute client.ssl? end def test_configuration Totter::Client.configure do |client| client.api_host = 'blah' client.api_scheme = 'gopher' client.result_format = :hash end assert_equal 'blah', Totter::Client.new.api_host assert_equal 'gopher', Totter::Client.new.api_scheme Totter::Client.new.result_format # forcibly reset the configuration Totter::Client.options = nil end end