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_stub! client = Totter::Client.new Totter::Client.stub! assert Totter::Client.stubbed? expected = {} assert_equal expected, client.create_decision(1) Totter::Client.unstub! end end