Sha256: 2a1ad6aa8d34cf71468bd7bc22e59113fbe68e8b9663d0054ba7970d2e086169

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe RRD do
  
  it "tracks shipped packages" do

    rrd_tracking_xml = File.read("#{Dir.pwd}/spec/rrd_api_responses/shipment_shipped.xml")

    WebMock.stub_request(:get, "http://www.ppxtrack.com/api/ParcelTracking?id=2043XXXXXX1513").
            with(headers: {'User-Agent'=>'Typhoeus - https://github.com/typhoeus/typhoeus'}).
            to_return(status: 200, body: rrd_tracking_xml)

    result = RRD::track('2043XXXXXX1513')

    expect(result).to   be_kind_of(RRD::Response::Tracking)
  end


  it "tracks shipped packages with two events" do

    rrd_tracking_xml = File.read("#{Dir.pwd}/spec/rrd_api_responses/shipment_shipped.xml")

    WebMock.stub_request(:get, "http://www.ppxtrack.com/api/ParcelTracking?id=2043XXXXXX1513").
            with(headers: {'User-Agent'=>'Typhoeus - https://github.com/typhoeus/typhoeus'}).
            to_return(status: 200, body: rrd_tracking_xml)

    result = RRD::track('2043XXXXXX1513')

    expect(result.tracking_events.count).to       eq(11)
    expect(result.tracking_events.first).to       be_kind_of(RRD::Response::TrackDetail)
  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rrd-track-1.0.1 spec/rrd-track/track_spec.rb