Sha256: 7eacc3f9b9fed53584c0d97e7888ed5dfa1099e2bc19a0fb00cf4e2d0c0a0559

Contents?: true

Size: 779 Bytes

Versions: 6

Compression:

Stored size: 779 Bytes

Contents

require "spec_helper"

describe Shipcloud::Request::Base do
  context "#perform" do
    it "checks for an api key" do
      Shipcloud.stub(:api_key).and_return(nil)

      expect{
        Shipcloud::Request::Base.new(nil).perform
      }.to raise_error Shipcloud::AuthenticationError
    end

    it "performs an https request" do
      Shipcloud.stub(:api_key).and_return("some key")
      connection = stub
      validator = stub
      Shipcloud::Request::Connection.stub(:new).and_return(connection)
      Shipcloud::Request::Validator.stub(:new).and_return(validator)

      connection.should_receive(:setup_https)
      connection.should_receive(:request)
      validator.should_receive(:validated_data_for)

      Shipcloud::Request::Base.new(nil).perform
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shipcloud-0.6.0 spec/shipcloud/request/base_spec.rb
shipcloud-0.5.0 spec/shipcloud/request/base_spec.rb
shipcloud-0.4.0 spec/shipcloud/request/base_spec.rb
shipcloud-0.3.0 spec/shipcloud/request/base_spec.rb
shipcloud-0.2.0 spec/shipcloud/request/base_spec.rb
shipcloud-0.1.0 spec/shipcloud/request/base_spec.rb