Sha256: e16327b8e44e7a9aeba7ba7b815474d4ad3712da160bd0c63fc0424e83eb728a

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

require 'test_helper'

class ClientIntegrationTest < ChilloutTestCase
  def test_check_api_connection_with_200_ok_response
    @_api_key = "xyz123"
    url = api_url("check")
    stub_request(:get, url).to_return(:body => "OK", :status => 200)

    client = Chillout::Client.new(@_api_key)
    check_result = client.check_api_connection
    assert check_result.successful?, "Check was not successful"
  end

  def test_check_api_connection_with_other_response
    @_api_key = "xyz123"
    url = api_url("check")
    stub_request(:get, url).to_return(:body => "Not Found", :status => 404)

    client = Chillout::Client.new(@_api_key)
    check_result = client.check_api_connection
    refute check_result.successful?, "Check was successful"
  end

  def test_check_api_connection_with_raised_exception_on_request
    @_api_key = "xyz123"
    url = api_url("check")
    stub_request(:get, url).to_raise(StandardError)

    client = Chillout::Client.new(@_api_key)
    check_result = client.check_api_connection
    refute check_result.successful?, "Check was successful"
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
chillout-0.6.0 test/integration/client_test.rb
chillout-0.5.4 test/integration/client_test.rb
chillout-0.5.3 test/integration/client_test.rb
chillout-0.5.2 test/integration/client_test.rb
chillout-0.5.1 test/integration/client_test.rb
chillout-0.5.0 test/integration/client_test.rb
chillout-0.4.1 test/integration/client_test.rb