Sha256: 572d98070a197823f2bde1439221ec44194e07ed14a35b590286d2d40621b33d

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

require 'minitest/autorun'
require_relative '../lib/kosher'

begin
  require 'pry'
rescue LoadError
end

include Kosher

class TestKosher < MiniTest::Unit::TestCase
  def test_new_condition
    condition = Condition.new

    condition.grade = 1
    assert condition.new?

    condition.grade = 2
    refute condition.new?
  end

  def test_fast_shipping
    shipping = Shipping.new
    refute shipping.fast?

    shipping.fast = true
    assert shipping.fast?
  end

  def test_kosher_offer
    condition = Condition.new
    seller = Seller.new
    shipping = Shipping.new
    offer = Offer.new(condition: condition,
                      seller:    seller,
                      shipping:  shipping)
    refute offer.kosher?

    condition.kosher = true
    seller.kosher = true
    shipping.available = true
    assert offer.kosher?
  end

  def test_offer_price
    unit = Unit.new(cents: 100, currency: 'USD')
    shipping = Shipping.new(cents: 100, currency: 'USD')
    offer = Offer.new(unit: unit, shipping: shipping)
    assert_equal 200, offer.price.cents
    assert_equal 'USD', offer.price.currency.iso_code
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kosher-0.17.2 test/kosher_test.rb
kosher-0.17.1 test/kosher_test.rb