Sha256: 8755e9009e43475e880f0fa080762bc2925da2f3861e08394bac90003822f86b

Contents?: true

Size: 930 Bytes

Versions: 3

Compression:

Stored size: 930 Bytes

Contents

require "spec_helper"

describe Sendle::Api do
  
  it "allows setting of the api_key" do
    api_key = "testing-api-key"

    Sendle::Api.api_key = api_key

    expect(Sendle::Api.api_key).to eq api_key
  end

  it "allows setting the sendle_id" do
    sendle_id = "testing-sendle-id"

    Sendle::Api.sendle_id = sendle_id

    expect(Sendle::Api.sendle_id).to eq sendle_id
  end

  it "turns off sandbox mode by default" do
    expect(Sendle::Api.sandbox).to eq false
  end

  it "allows turning on sandbox mode" do
    Sendle::Api.sandbox = true

    expect(Sendle::Api.sandbox).to eq true
  end

  it "uses sandbox api uri when in sandbox mode" do
    Sendle::Api.sandbox = true

    expect(Sendle::Api.base_url).to eq 'https://sandbox.sendle.com/api/'
  end

  it "uses live api uri when not in sandbox mode" do
    Sendle::Api.sandbox = false

    expect(Sendle::Api.base_url).to eq 'https://www.sendle.com/api/'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sendle-api-0.0.13 spec/sendle/api_spec.rb
sendle-api-0.0.12 spec/sendle/api_spec.rb
sendle-api-0.0.11 spec/sendle/api_spec.rb