Sha256: 0ab661e5b21f306d59cc842d3827e52e86d4a14d6bacfee43e5b004ba3a0bd5d

Contents?: true

Size: 746 Bytes

Versions: 3

Compression:

Stored size: 746 Bytes

Contents

require "spec_helper"

module Kosher
  describe Condition do
    describe "#to_i" do
      def this(str)
        Condition.new(str).to_i
      end

      it "casts as integer" do
        this("new").should eql 1
        this("mint").should eql 2
        this("verygood").should eql 3
        this("good").should eql 4
        this("acceptable").should eql 5
      end

      it "casts unrecognized conditions as 6" do
        this("refurbished").should eql 6
      end
    end

    describe "#kosher?" do
      it "returns true if condition is good or better" do
        Condition.new("verygood").should be_kosher
        Condition.new("good").should be_kosher
        Condition.new("acceptable").should_not be_kosher
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kosher-0.1.2 spec/kosher/condition_spec.rb
kosher-0.1.1 spec/kosher/condition_spec.rb
kosher-0.1.0 spec/kosher/condition_spec.rb