Sha256: 0c15024c345498659a2314e532e0da2901fa7dbce4a4e6dfa9e506258148bb62

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

require 'test_helper'

class ClientTest < ChilloutTestCase

  def test_initialize_with_config
    config = Chillout::Config.new("xyz123")
    client = Chillout::Client.new(config)
    assert_equal config, client.config
  end

  def test_initialize_with_options_hash
    client = Chillout::Client.new("xyz123", platform: 'rack')
    assert_equal "xyz123", client.config.api_key
    assert_equal "rack", client.config.platform
  end

  def test_initialize_with_block
    client = Chillout::Client.new("xyz") do |config|
      config.platform = "rack"
    end
    assert_equal "xyz", client.config.api_key
    assert_equal "rack", client.config.platform
  end

  def test_initialize_with_options_hash_and_block
    client = Chillout::Client.new("xyz", platform: 'rack') do |config|
      config.port = 443
    end
    assert_equal "xyz", client.config.api_key
    assert_equal "rack", client.config.platform
    assert_equal 443, client.config.port
  end

  def test_initialize_with_unsupported_type_raises_an_error
    assert_raises(ArgumentError) do
      Chillout::Client.new(123)
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
chillout-0.4.0 test/client_test.rb
chillout-0.3.0 test/client_test.rb
chillout-0.2.3 test/client_test.rb
chillout-0.2.2 test/client_test.rb
chillout-0.2.1 test/client_test.rb
chillout-0.2.0 test/client_test.rb