Sha256: 89e6e9535adabf564bc51ea5a692ca8c08bc8701e042b566d305f8b38e0715d7

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

require "spec_helper"

module Kosher
  describe Description do
    def this(value)
      Description.new(value)
    end

    it "inherits from String" do
      Description.ancestors.should include String
    end

    it "validates a blank description" do
      this("").should be_kosher
    end

    it "validates a non-blank description" do
      this("foo").should be_kosher
    end

    it "does not validate advance review copies" do
      this("Uncorrected review copy").should_not be_kosher
      this("arc").should_not be_kosher
      this("arc.").should_not be_kosher

      this("marc").should be_kosher
    end

    it "does not validate marked books" do
      this("Some highlighting").should_not be_kosher
      this("Underlining.").should_not be_kosher
      this("Good. Hiliting.").should_not be_kosher

      this("No highlighting.").should be_kosher
    end

    it "does not validate books with missing volumes" do
      this("First vol only.").should_not be_kosher
    end

    it "does not validate damaged or worn books" do
      this("Different").should be_kosher
      this("Rental").should_not be_kosher
      this("Torn pages").should_not be_kosher
    end

    it "does not validate withdrawn library copies" do
      this("xlib").should_not be_kosher
      this("ex-library").should_not be_kosher
      this("retired library copy").should_not be_kosher

      this("Not an ex-library").should be_kosher
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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