Order product user spec green

This commit is contained in:
2014-06-25 17:23:43 +02:00
parent 58f0937570
commit 10bc926e87
10 changed files with 41 additions and 11 deletions
+5 -2
View File
@@ -20,11 +20,14 @@ step "the user is on the homepage" do
end
step "the user should be redirected to the user order overview page" do
route_should_be 'user#active_list'
#route_should_be 'user#active_list'
ember_route_should_be "/active_list"
end
step "the user should be redirected to the archived list path" do
route_should_be 'user#history_list'
#route_should_be 'user#history_list'
sleep 1
ember_route_should_be "/lists/#{@order.list_id}"
page.should have_selector ".order-row-#{@order.id}"
end
+3 -1
View File
@@ -16,7 +16,9 @@ step "the user order should be created as a new order" do
@order = Order.last
row = find(".order-row-#{@order.id}")
row['class'].should include 'placed'
page.should have_content 'Apple pie (1), Heineken beer (2)'
#page.should have_content 'Apple pie (1), Heineken beer (2)'
page.should have_content '1 x Apple pie'
page.should have_content '2 x Heineken beer'
page.should have_content '€ 8.96'
end
@@ -1,7 +1,7 @@
step "the user clicks on the order :product_name twice" do |product_name|
@last_product = instance_variable_get product_name.underscore.gsub(/\s/, '_').prepend('@')
button = find ".order-product-#{@last_product.id}"
button = find ".order-product-#{@last_product.id} .add-product-to-list"
2.times { button.click }
end
+8
View File
@@ -13,4 +13,12 @@ module SpecRouteHelpers
route_hash.merge! options
Rails.application.routes.recognize_path(page.current_path).should include route_hash
end
def ember_route_should_be(route_def)
ember_route.should == route_def
end
def ember_route
page.evaluate_script %|App.__container__.lookup('router:main').location.lastSetURL|
end
end