From 9415c4e3ab62837c5837df2a69b178e7188b75ed Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Tue, 29 Apr 2014 12:45:40 +1000 Subject: [PATCH] Patching our integration tests to use the new home page mechanics --- spec/features/consumer/shopping/shopping_spec.rb | 11 +++++++---- spec/support/request/ui_component_helper.rb | 5 +++++ 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 spec/support/request/ui_component_helper.rb diff --git a/spec/features/consumer/shopping/shopping_spec.rb b/spec/features/consumer/shopping/shopping_spec.rb index 303d5de197..70ea45e952 100644 --- a/spec/features/consumer/shopping/shopping_spec.rb +++ b/spec/features/consumer/shopping/shopping_spec.rb @@ -3,14 +3,19 @@ require 'spec_helper' feature "As a consumer I want to shop with a distributor", js: true do include AuthenticationWorkflow include WebHelper + include UIComponentHelper describe "Viewing a distributor" do + let(:supplier) { create(:supplier_enterprise) } let(:distributor) { create(:distributor_enterprise) } + let(:order_cycle) { create(:order_cycle, distributors: [distributor], coordinator: create(:distributor_enterprise)) } - before do #temporarily using the old way to select distributor + before do + order_cycle create_enterprise_group_for distributor visit "/" - click_link distributor.name + open_active_table_row + click_link "Shop at #{distributor.name}" end it "shows a distributor with images" do @@ -23,9 +28,7 @@ feature "As a consumer I want to shop with a distributor", js: true do end describe "with products in order cycles" do - let(:supplier) { create(:supplier_enterprise) } let(:product) { create(:product, supplier: supplier) } - let(:order_cycle) { create(:order_cycle, distributors: [distributor], coordinator: create(:distributor_enterprise)) } before do exchange = Exchange.find(order_cycle.exchanges.to_enterprises(distributor).outgoing.first.id) diff --git a/spec/support/request/ui_component_helper.rb b/spec/support/request/ui_component_helper.rb new file mode 100644 index 0000000000..0b8fed13fa --- /dev/null +++ b/spec/support/request/ui_component_helper.rb @@ -0,0 +1,5 @@ +module UIComponentHelper + def open_active_table_row + find("hub:first-child .active_table_row:first-child").click() + end +end