Sha256: de36689931906af42ab893e921668992ded099a2bf579baf6f7cabb26fa30fd5

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

module Kosher
  describe Seller do
    before do
      @seller = Seller.new
    end

    describe "#blacklisted?" do
      before do
        Kosher.seller_blacklist = ['foo']
      end

      it "returns true if the seller is blacklisted" do
        @seller.id = 'foo'
        @seller.should be_blacklisted
      end

      it "returns false if the seller is not blacklisted" do
        @seller.id = 'bar'
        @seller.should_not be_blacklisted
      end
    end

    describe "#kosher?" do
      before do
        Seller.threshold = 4.8
      end

      it "returns true if rating is 0.0" do
        @seller.rating = 0.0
        @seller.should be_kosher
      end

      it "returns true if rating is nil" do
        @seller.should be_kosher
      end

      it "returns true if rating is within threshold" do
        @seller.rating = 4.8
        @seller.should be_kosher
      end

      it "returns false if rating is not within threshold" do
        @seller.rating = 4.7
        @seller.should_not be_kosher
      end

      it "returns false if seller is blacklisted" do
        @seller.id = ['foo']
        Kosher.seller_blacklist = [@seller.id]
        @seller.should_not be_kosher
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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