Skip to content

Instantly share code, notes, and snippets.

@wanderingmatt
Created February 8, 2009 06:45
Show Gist options
  • Save wanderingmatt/60276 to your computer and use it in GitHub Desktop.
Save wanderingmatt/60276 to your computer and use it in GitHub Desktop.
require 'test_helper'
class CartItemTest < ActiveSupport::TestCase
def test_initialize
cart_item = CartItem.new(products(:one))
assert_equal 1, cart_item.quantity
end
def test_increment_quantity
cart_item = CartItem.new(products(:one))
cart_item.increment_quantity
assert_equal 2, cart_item.quantity
end
def test_title
cart_item = CartItem.new(products(:one))
assert_equal 'Pragmatic Project Automation', cart_item.title
end
def test_price
cart_item = CartItem.new(products(:one))
assert_equal 29.00, cart_item.price.to_i
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment