Sha256: 9e301224505c1cd4061f3ef1d5553292c3e06e9635c97395f81a87a25e6b419f
Contents?: true
Size: 954 Bytes
Versions: 25
Compression:
Stored size: 954 Bytes
Contents
require 'spec_helper' # # Attributes describe Effective::OrderItem do let(:order) { FactoryGirl.create(:order) } let(:order_item) { FactoryGirl.create(:order_item) } describe 'validations' do it 'is invalid without required fields' do order_item = Effective::OrderItem.new() order_item.valid?.should eq false order_item.errors[:title].present?.should eq true order_item.errors[:quantity].present?.should eq true order_item.errors[:tax_exempt].present?.should eq true order_item.errors[:purchasable].present?.should eq true end end describe 'scopes' do it 'is included in the Sold scope when order is purchased' do order.purchase! (order.order_items.size > 0).should eq true sold_items = Effective::OrderItem.sold.to_a sold_items.size.should eq order.order_items.size order.order_items.each { |oi| sold_items.include?(oi).should eq true } end end end
Version data entries
25 entries across 25 versions & 1 rubygems