Fix list unit and supplier main board acceptance specs
This commit is contained in:
@@ -9,12 +9,14 @@ Feature: Supplier main board
|
||||
Then the supplier dashboard should display the active list
|
||||
And the supplier dashboard should display the active order
|
||||
|
||||
When I click on translation 'supplier.order.being_processed'
|
||||
#When I click on translation 'supplier.order.being_processed'
|
||||
When I click on selector '.active-orders-table .mark_order_active'
|
||||
# waiting here only needed in old style implementation
|
||||
And I wait 1 second
|
||||
Then the supplier order row should be marked as active
|
||||
|
||||
When I click on translation 'supplier.order.being_served'
|
||||
#When I click on translation 'supplier.order.being_served'
|
||||
When I click on selector '.active-orders-table .mark_order_delivered'
|
||||
And I wait 1 second
|
||||
Then the order in the supplier dashboard should not be displayed anymore
|
||||
And the order should be marked as delivered
|
||||
|
||||
@@ -23,7 +23,7 @@ step 'a new order on a table in another section is created' do
|
||||
@new_section = create :section, title: 'Terrace', supplier: @supplier
|
||||
@new_table = create :table, number: 59, section: @new_section, supplier: @supplier
|
||||
@new_list = create :list, section: @new_section, table: @new_table, supplier: @supplier, user_ids: [@user.id]
|
||||
@new_order = @new_list.place_order @user, {@product.id => 3}
|
||||
@new_order = @new_list.place_order(products: {@product.id => 3}, user: @user)
|
||||
end
|
||||
|
||||
step "I am signed in as a user" do
|
||||
|
||||
@@ -9,6 +9,10 @@ step "I click on translation :translation" do |translation_key|
|
||||
click_on text
|
||||
end
|
||||
|
||||
step "I click on selector :selector" do |selector|
|
||||
find(selector).click
|
||||
end
|
||||
|
||||
step 'I visit :path' do |path|
|
||||
visit path
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@ step "the order should be marked as delivered" do
|
||||
end
|
||||
|
||||
step "another order is placed" do
|
||||
@new_order = @list.place_order @user, {@product.id => 5}
|
||||
@new_order = @list.place_order(products: {@product.id => 5}, user: @user)
|
||||
end
|
||||
|
||||
step "the user order should be created as a new order" do
|
||||
|
||||
@@ -33,19 +33,19 @@ step "the order in the supplier dashboard should not be displayed anymore" do
|
||||
end
|
||||
|
||||
step "the list on the supplier dashboard should not be marked as in need of help" do
|
||||
page.should_not have_selector(".list-row-#{@list.id} .list-needs-help-indicator")
|
||||
page.should_not have_selector(".list-row-#{@list.id} .icon.needs-help")
|
||||
end
|
||||
|
||||
step "the list on the supplier dashboard should be marked as in need of help" do
|
||||
page.should have_selector(".list-row-#{@list.id} .list-needs-help-indicator")
|
||||
page.should have_selector(".list-row-#{@list.id} .icon.needs-help")
|
||||
end
|
||||
|
||||
step "the list on the supplier dashboard should not be marked as in need of payment" do
|
||||
page.should_not have_selector(".list-row-#{@list.id} .list-needs-payment-indicator")
|
||||
page.should_not have_selector(".list-row-#{@list.id} .icon.needs-payment")
|
||||
end
|
||||
|
||||
step "the list on the supplier dashboard should be marked as in need of payment" do
|
||||
page.should have_selector(".list-row-#{@list.id} .list-needs-payment-indicator")
|
||||
page.should have_selector(".list-row-#{@list.id} .icon.needs-payment")
|
||||
end
|
||||
|
||||
step "the supplier dashboard list should display the updated price" do
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user