Sha256: 577a7328942fd9381f6094f7a84242b8eb3ded1d894d0c584a1fa38d78b546da

Contents?: true

Size: 1.46 KB

Versions: 2

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'

describe Carousel::Tracking do

  let(:tracking) { Carousel::Tracking.new('carousel', '123456')}
  
  describe '#initialize' do
    it 'sets the carrier and tracking number' do
      expect(tracking.instance_variable_get(:@carrier)).to eq("carousel")
      expect(tracking.instance_variable_get(:@tracking_number)).to eq("123456")
    end
  end

  describe '#carrier_destination' do
    context 'when carrier is FedEx' do
      it 'returns the FedEx tracking url' do
        tracking.carrier = "fedex"
        expect(tracking.url).to eq("http://www.fedexuk.net/accounts/QuickTrack.aspx?consignment=123456")
      end
    end
    context 'when carrier is Carousel' do
      it 'returns the Carousel tracking url' do
        expect(tracking.url).to eq("https://web.carousel.eu/easyweb/default.asp?action=clienttrack&type=Carousel&acct1=BEC01&reference=123456")
      end
    end
  end
  describe '#url' do
    context 'when carrier is FedEx' do
      it 'returns the FedEx tracking url including the tracking number' do
        tracking.carrier = "fedex"
        expect(tracking.url).to eq("http://www.fedexuk.net/accounts/QuickTrack.aspx?consignment=123456")
      end
    end
    context 'when carrier is Carousel' do
      it 'returns the Carousel tracking url including the tracking number' do
        expect(tracking.url).to eq("https://web.carousel.eu/easyweb/default.asp?action=clienttrack&type=Carousel&acct1=BEC01&reference=123456")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
carousel-ruby-api-0.0.4 spec/lib/tracking_spec.rb
carousel-ruby-api-0.0.3 spec/lib/tracking_spec.rb