Sha256: dd30b1b3239dc8d855f309554b572df11c39b211f860908663af0e99bdd6f955

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
totter-0.3.3 test/totter/client_test.rb
totter-0.3.2 test/totter/client_test.rb