Sha256: 0930c3681c133e2e6f37356181f983e6b6b462a6daa19ab3ab9377f6759ff9b2

Contents?: true

Size: 772 Bytes

Versions: 3

Compression:

Stored size: 772 Bytes

Contents

# -*- coding: utf-8 -*-
require File.expand_path('../../test_helper', __FILE__)

module Rainforest
  class AuthTest < ::Test::Unit::TestCase
    context "With a valid api token, any request" do
      should "not raise an exception" do
        response = test_response({}, 200)
        @mock.expects(:get).once.returns(response)
        Rainforest::Run.retrieve("1")
      end
    end

    context "With an invalid api token, any request" do
      should "raise an exception" do
        response = test_response({error:"Authentication required"}, 401)
        assert_raises AuthenticationError do
          @mock.expects(:get).once.raises(RestClient::ExceptionWithResponse.new(response, 401))
          Rainforest::Run.retrieve("1")
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rainforest-1.0.7 test/rainforest/auth_test.rb
rainforest-1.0.6 test/rainforest/auth_test.rb
rainforest-1.0.5 test/rainforest/auth_test.rb