Add couchbase with modifications, formalize broadcaster and make testable and some other stuff

This commit is contained in:
2014-03-06 18:08:39 +01:00
parent 3f117c76b0
commit 0e7a39b819
28 changed files with 456 additions and 35 deletions
+32
View File
@@ -122,4 +122,36 @@ describe List do
end
end
describe '#place_order' do
it 'returns an order object' do
list.place_order(user, product.id => 7).should be_a Order
end
it 'creates an order' do
expect{ list.place_order(user, product.id => 7) }.to change{ Order.count }.by(1)
end
describe 'broadcasting' do
it 'broadcasts to the user and the supplier the active order counter' do
list.place_order(user, product.id => 7)
expect{
list.place_order(user, product.id => 3)
}.to broadcast_to_user(user.id).message('orders_in_process_count').with(count: 2)
expect{
list.place_order(user, product.id => 5)
}.to broadcast_to_supplier(supplier.id).message('orders_in_process_count').with(count: 3)
end
end
it 'sets the list price as kind of caching' do
list.place_order(user, product.id => 7)
list.reload
list.price.should == 3
end
describe 'product order creation'
end
end