User specs in the green
This commit is contained in:
@@ -18,7 +18,6 @@ Feature: Active list view
|
||||
And the user is on the active list page
|
||||
And the supplier orders placed counter for the user should be 1
|
||||
When the order gets cancelled
|
||||
And I wait 1 second
|
||||
Then the user should not see the order in the active list view
|
||||
And the supplier orders placed counter for the user should be 0
|
||||
|
||||
|
||||
@@ -49,5 +49,5 @@ step "the user orders list gets closed" do
|
||||
end
|
||||
|
||||
step "the order gets cancelled" do
|
||||
@order.cancel!
|
||||
when_ember_is_ready { @order.cancel! }
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
step "there is no user information stored in the local storage" do
|
||||
user_visit '/'
|
||||
visit empty_page_path
|
||||
page.execute_script %|Qstorage = window.localStorage|
|
||||
page.execute_script(%|Qstorage.removeItem('user_id')|)
|
||||
page.execute_script(%|Qstorage.removeItem('auth_token')|)
|
||||
@@ -27,7 +27,7 @@ step "there is a instagram user" do
|
||||
end
|
||||
|
||||
step "the user is redirected to the sign in page" do
|
||||
ember_route_should_be '/sign_in'
|
||||
when_ember_is_ready { ember_route_should_be '/sign-in' }
|
||||
end
|
||||
|
||||
step "I am signed in as a user" do
|
||||
|
||||
@@ -23,7 +23,7 @@ step "another user scans the QR code on the table" do
|
||||
end
|
||||
|
||||
step "the original user should see the other user added below the active list" do
|
||||
page.evaluate_script(%|$('.list-user-total-container').length()|).should eq 2
|
||||
page.evaluate_script(%|$('.list-user-total-container').length|).should eq 2
|
||||
end
|
||||
|
||||
step "the original user approves the other user's join request" do
|
||||
|
||||
@@ -67,7 +67,7 @@ step "the user order :product_name should be in the order list with price" do |p
|
||||
#ember_order = ember_store['product_orders'].find{|po| po['product_id'] == concerning_product.id}
|
||||
#ember_order = ember_find('product_order', concerning_product.id)
|
||||
sleep 0.1
|
||||
ember_order = ember_all('product_order').find{|po| po['product_id'] == concerning_product.id }
|
||||
ember_order = ember_all('product_order').find{|po| po['product'] == concerning_product.id }
|
||||
quantity = ember_order['quantity']
|
||||
order_price = quantity * concerning_product.price
|
||||
within '.product-orders .product-order' do
|
||||
|
||||
@@ -85,13 +85,13 @@ module SpecEmberHelpers
|
||||
|
||||
def ember_find(typeKey, id)
|
||||
h = page.evaluate_script <<-SCRIPT
|
||||
(MozoUser || App).__container__.lookup('store:main').all('#{typeKey}').findBy('id', '#{id}').serialize()
|
||||
(MozoUser || App).__container__.lookup('service:store').peekRecord('#{typeKey}', '#{id}').toJSON()
|
||||
SCRIPT
|
||||
end
|
||||
|
||||
def ember_all(typeKey)
|
||||
h = page.evaluate_script <<-SCRIPT
|
||||
(MozoUser || App).__container__.lookup('store:main').all('#{typeKey}').invoke('serialize')
|
||||
(MozoUser || App).__container__.lookup('service:store').peekAll('#{typeKey}').map(function(r){ result = r.toJSON(); result['id'] = r.id; return result })
|
||||
SCRIPT
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user