Fix list unit and supplier main board acceptance specs

This commit is contained in:
2014-05-28 15:16:08 +02:00
parent 4855b2e8e0
commit e9554ea3e7
14 changed files with 133 additions and 121 deletions
+6 -6
View File
@@ -125,29 +125,29 @@ describe List do
describe '#place_order' do
it 'returns an order object' do
list.place_order(product.id => 7, user: user).should be_a Order
list.place_order(products: {product.id => 7}, user: user).should be_a Order
end
it 'creates an order' do
expect{ list.place_order(product.id => 7, user: user) }.to change{ Order.count }.by(1)
expect{ list.place_order(products: {product.id => 7}, user: user) }.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(product.id => 7, user: user)
list.place_order(products: {product.id => 7}, user: user)
expect{
list.place_order(product.id => 3, user: user)
list.place_order(products: {product.id => 3}, user: user)
}.to broadcast_to_user(user.id).message('orders_placed_count').with(count: 2)
expect{
list.place_order(product.id => 5, user: user)
list.place_order(products: {product.id => 5}, user: user)
}.to broadcast_to_supplier(supplier.id).message('orders_placed_count').with(count: 3)
end
end
it 'sets the list price as kind of caching' do
list.place_order(product.id => 7, user: user)
list.place_order(products: {product.id => 7}, user: user)
list.reload
list.price.should == 15.54
end