Sha256: ef4f7fbec3414632d64b249389f97bac4b39b4b9ab3288c84f20fbba2af4bbb7

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

require "spec_helper"

module ShipCompliant
  describe ShipmentCompliance do

    context "compliant?" do
      it "check is a shipment was compliant" do
        subject.compliant?.should be_true
      end
    end

    context "shipment_key" do
      it "returns the shipment key" do
        subject.shipment_key.should == 'AN-ORDER-KEY'
      end
    end

    context "rules" do
      it "returns an array of ComplianceRule" do
        subject.rules.should == [
          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
        })

        shipment.rules.should == []
      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

4 entries across 4 versions & 1 rubygems

Version Path
ship_compliant-0.2.0 spec/lib/ship_compliant/shipment_compliance_spec.rb
ship_compliant-0.1.2 spec/lib/ship_compliant/shipment_compliance_spec.rb
ship_compliant-0.1.1 spec/lib/ship_compliant/shipment_compliance_spec.rb
ship_compliant-0.1.0 spec/lib/ship_compliant/shipment_compliance_spec.rb