Qwaiter supplier on Ember 1.0
This commit is contained in:
+21
-10
@@ -3,10 +3,15 @@ require 'spec_helper'
|
||||
|
||||
describe List do
|
||||
let(:supplier) { create :supplier }
|
||||
let(:supplier_password){'secret1'}
|
||||
let(:supplier) { create :supplier, email: 'supplier@qwaiter.com', password: supplier_password, confirmation_token: 'abc', confirmed_at: Time.now.utc, open: true }
|
||||
let(:user) { create :user }
|
||||
let(:section) { create :section, supplier: supplier}
|
||||
let(:table) { create :table, supplier: supplier}
|
||||
let(:list){ create :list, supplier: supplier, table: table, user_ids: [user.id] }
|
||||
let(:list){ create :list, supplier: supplier, table: table, section: section, user_ids: [user.id] }
|
||||
let(:product){ create :product, price: 2.22, supplier: supplier }
|
||||
let(:order) { create :order, user: user, list: list, supplier: supplier, section: section }
|
||||
let(:product_order ){ create :product_order, order: order, product: product, quantity: 3, price: 2.11 }
|
||||
subject { list }
|
||||
describe :as_json do
|
||||
it 'should include _id in as_json serialization' do
|
||||
@@ -17,16 +22,22 @@ describe List do
|
||||
end
|
||||
end
|
||||
|
||||
describe :mark_as_payed do
|
||||
it "should set payed_at to a time" do
|
||||
list.payed_at.should be_nil
|
||||
list.mark_as_payed
|
||||
list.payed_at.should be_kind_of Time
|
||||
describe :mark_as_paid do
|
||||
it "should set paid_at to a time" do
|
||||
list.paid_at.should be_nil
|
||||
list.is_paid!
|
||||
list.paid_at.should be_kind_of Time
|
||||
end
|
||||
it "should set is_payed to true" do
|
||||
list.is_payed.should be_false
|
||||
list.mark_as_payed
|
||||
list.is_payed.should be_true
|
||||
it "should set is_paid to true" do
|
||||
list.is_paid.should be_false
|
||||
list.is_paid!
|
||||
list.is_paid.should be_true
|
||||
end
|
||||
end
|
||||
|
||||
describe '#set_price' do
|
||||
it 'takes the product_order price in stead of the product price' do
|
||||
product_order and list.set_price.should == 6.33
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user