DRY specs with new EmbeddedPagesHelper

This commit is contained in:
Maikel Linke
2018-07-19 10:44:43 +10:00
parent 599f1a966b
commit 8a3a617870
3 changed files with 13 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
require 'spec_helper'
feature "Using embedded shopfront functionality", js: true do
include OpenFoodNetwork::EmbeddedPagesHelper
describe 'embedded groups' do
let(:enterprise) { create(:distributor_enterprise) }
@@ -68,14 +69,4 @@ feature "Using embedded shopfront functionality", js: true do
end
end
end
private
def on_embedded_page
expect(page).to have_selector "iframe"
within_frame :frame do
yield
end
end
end

View File

@@ -1,6 +1,7 @@
require 'spec_helper'
feature "Using embedded shopfront functionality", js: true do
include OpenFoodNetwork::EmbeddedPagesHelper
include AuthenticationWorkflow
include WebHelper
include ShopWorkflow
@@ -107,14 +108,6 @@ feature "Using embedded shopfront functionality", js: true do
private
def on_embedded_page
expect(page).to have_selector "iframe"
within_frame :frame do
yield
end
end
def login_with_modal
expect(page).to have_selector 'div.login-modal', visible: true

View File

@@ -0,0 +1,11 @@
module OpenFoodNetwork
module EmbeddedPagesHelper
def on_embedded_page
expect(page).to have_selector "iframe"
within_frame :frame do
yield
end
end
end
end