Sha256: 0240b6b5fb121cb2575019d78e5faca178086487670c64885678c867cf0d35a0

Contents?: true

Size: 1.17 KB

Versions: 24

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

module Kosher
  describe Shipping do
    before do
      @shipping = Shipping.new
    end

    describe "#free?" do
      context "when shipping costs 0" do
        it "returns true" do
          @shipping.cents = 0
          @shipping.should be_free
        end
      end

      context "when shipping costs nil" do
        it "returns true" do
          @shipping.cents = nil
          @shipping.should be_free
        end
      end

      context "when shipping is not free" do
        it "returns false" do
          @shipping.cents = 1
          @shipping.should_not be_free
        end
      end
    end

    describe "#kosher?" do
      context "when available" do
        it "returns true" do
          @shipping.availability = Availability.new(0)
          @shipping.should be_kosher
        end
      end

      context "when not available" do
        it "returns false" do
          @shipping.availability = Availability.new(96)
          @shipping.should_not be_kosher
        end
      end
    end

    describe "#cost" do
      it "returns 0 if no cents given" do
        @shipping.cents = nil
        @shipping.cost.cents.should eql 0
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
kosher-0.2.24 spec/kosher/shipping_spec.rb
kosher-0.2.23 spec/kosher/shipping_spec.rb
kosher-0.2.22 spec/kosher/shipping_spec.rb
kosher-0.2.21 spec/kosher/shipping_spec.rb
kosher-0.2.20 spec/kosher/shipping_spec.rb
kosher-0.2.19 spec/kosher/shipping_spec.rb
kosher-0.2.18 spec/kosher/shipping_spec.rb
kosher-0.2.17 spec/kosher/shipping_spec.rb
kosher-0.2.16 spec/kosher/shipping_spec.rb
kosher-0.2.15 spec/kosher/shipping_spec.rb
kosher-0.2.14 spec/kosher/shipping_spec.rb
kosher-0.2.13 spec/kosher/shipping_spec.rb
kosher-0.2.12 spec/kosher/shipping_spec.rb
kosher-0.2.11 spec/kosher/shipping_spec.rb
kosher-0.2.10 spec/kosher/shipping_spec.rb
kosher-0.2.9 spec/kosher/shipping_spec.rb
kosher-0.2.8 spec/kosher/shipping_spec.rb
kosher-0.2.7 spec/kosher/shipping_spec.rb
kosher-0.2.6 spec/kosher/shipping_spec.rb
kosher-0.2.5 spec/kosher/shipping_spec.rb