Sha256: f8d78f5f1e52a155f5c2b830cd0b786b6f5e6e7e4d06cbd6308967432e7ab0df

Contents?: true

Size: 758 Bytes

Versions: 3

Compression:

Stored size: 758 Bytes

Contents

require "test_helper"
require "russianpost/parcel"

class ParcelTest < MiniTest::Unit::TestCase
  def test_returns_array_of_operations
    VCR.use_cassette :valid_barcode do
      parcel = RussianPost::Parcel.new("RD025500807SE")
      assert_kind_of Array, parcel.operations
      assert_kind_of RussianPost::Operation, parcel.operations[0]
    end
  end

  def test_returns_empty_array_on_nonexistent_parcel
    VCR.use_cassette("nonexistent_parcel") do
      parcel = RussianPost::Parcel.new("RR123456789EE")
      assert_kind_of Array, parcel.operations
      assert parcel.operations.empty?
    end
  end

  def test_raises_error_on_invalid_barcode
    assert_raises RussianPost::InvalidBarcode do
      RussianPost::Parcel.new("123")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
russianpost-0.3.0 test/russianpost/parcel_test.rb
russianpost-0.2.1 test/russianpost/parcel_test.rb
russianpost-0.2.0 test/russianpost/parcel_test.rb