Reworking the tests a little more for FASTER

This commit is contained in:
Will Marshall
2014-04-01 14:11:48 +11:00
parent 749abd82e8
commit bd4623bc71
3 changed files with 4 additions and 11 deletions

View File

@@ -14,8 +14,6 @@ feature "As a consumer I want to check out my cart", js: true do
before do
create_enterprise_group_for distributor
exchange = Exchange.find(order_cycle.exchanges.to_enterprises(distributor).outgoing.first.id)
exchange.variants << product.master
end
# Disabled :in for performance reasons

View File

@@ -13,13 +13,10 @@ feature "As a consumer I want to shop with a distributor", js: true do
click_link distributor.name
end
it "shows a distributor" do
it "shows a distributor with images" do
visit shop_path
page.should have_text distributor.name
end
it "shows distributor images" do
visit shop_path
find("#tab_about a").click
first("distributor img")['src'].should == distributor.logo.url(:thumb)
first("#about img")['src'].should == distributor.promo_image.url(:large)

View File

@@ -1,5 +1,6 @@
module ShopWorkflow
def select_distributor
# If no order cycles are available this is much faster
visit "/"
click_link distributor.name
end
@@ -7,15 +8,12 @@ module ShopWorkflow
# These methods are naughty and write to the DB directly
# Because loading the whole Angular app is slow
def select_order_cycle
#exchange = Exchange.find(order_cycle.exchanges.to_enterprises(distributor).outgoing.first.id)
#visit "/shop"
#select exchange.pickup_time, from: "order_cycle_id"
exchange = Exchange.find(order_cycle.exchanges.to_enterprises(distributor).outgoing.first.id)
exchange.variants << product.master
order.update_attribute :order_cycle, order_cycle
end
def add_product_to_cart
#fill_in "variants[#{product.master.id}]", with: product.master.on_hand - 1
#first("form.custom > input.button.right").click
create(:line_item, variant: product.master, order: order)
end
end