Sha256: e60d07d57af34f9347283d8d25aeab28631da6e4a7c6e0b806e0ed56a76a493d
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
require 'spec/spec_helper' describe ShopLineItem do dataset :shop_line_items it 'should calculate a weight' do shop_line_items(:one).weight.should === 31.0 shop_line_items(:two).weight.should === 62.0 end it 'should calculate the price' do shop_line_items(:one).price.should === 11.0 shop_line_items(:two).price.should === 22.0 end it 'should have a set of standard parameters' do ShopLineItem.params.should === [ :id, :quantity ] end it 'should adjust quantity to 1 if less than' do s = ShopLineItem.new({ :item => shop_products(:crusty_bread), :quantity => 0 }) s.valid? s.quantity.should === 1 s = ShopLineItem.new({ :item => shop_products(:crusty_bread), :quantity => 1 }) s.valid? s.quantity.should === 1 s = ShopLineItem.new({ :item => shop_products(:crusty_bread), :quantity => -100 }) s.valid? s.quantity.should === 1 s = ShopLineItem.new({ :item => shop_products(:crusty_bread), :quantity => 100 }) s.valid? s.quantity.should === 100 end end
Version data entries
3 entries across 3 versions & 1 rubygems