Sha256: 672c2b7ec833b62650703233276b973bff5f096e12a852a8e733be430b17767d

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require "spec_helper"

module ShipCompliant
  describe ShipmentCompliance do

    context "compliant?" do
      it "check is a shipment was compliant" do
        expect(subject.compliant?).to be_truthy
      end
    end

    context "shipment_key" do
      it "returns the shipment key" do
        expect(subject.shipment_key).to eq('AN-ORDER-KEY')
      end
    end

    context "rules" do
      it "returns an array of ComplianceRule" do
        expect(subject.rules).to eq([
          ComplianceRule.new(compliance_description: "You're clear for take off ghost rider")
        ])
      end

      it "returns an empty array when none found" do
        shipment = ShipmentCompliance.new({
          rules: nil
        })

        expect(shipment.rules).to eq([])
      end
    end

    subject do
      ShipmentCompliance.new(
        is_compliant: true,
        key: 'AN-ORDER-KEY',
        rules: {
          rule_compliance_response: {
            compliance_description: "You're clear for take off ghost rider"
          }
        }
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ship_compliant-0.2.1 spec/lib/ship_compliant/shipment_compliance_spec.rb