Sha256: 55914db00f9178ffd5fead7d4b3bc60f5ee5dd8a9dea4e153bd9e6e80f35405a

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

module Kosher
  describe Item do
    before do
      @item = Item.new
      @item.condition = Condition.new(:grade => 1)
    end

    describe "#kosher?" do
      context "when condition is kosher" do
        context "when description is kosher" do
          before do
            @item.description = Description.new
          end

          it "returns true" do
            @item.should be_kosher
          end
        end

        context "when description is not kosher" do
          before do
            @item.description = Description.new(
              :text => 'Withdrawn library book')
          end

          it "returns false" do
            @item.should_not be_kosher
          end
        end
      end

      context "when condition is not kosher" do
        before do
          @item.condition.grade = 5
        end

        it "returns false" do
          @item.should_not be_kosher
        end
      end
    end

    describe "#price" do
      context "when no cents are specified" do
        it "raises an error" do
          expect do
            @item.price
          end.to raise_error TypeError
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kosher-0.6.2 spec/kosher/item_spec.rb
kosher-0.6.1 spec/kosher/item_spec.rb
kosher-0.6.0 spec/kosher/item_spec.rb
kosher-0.5.0 spec/kosher/item_spec.rb
kosher-0.4.0 spec/kosher/item_spec.rb
kosher-0.3.0 spec/kosher/item_spec.rb