mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
Merge pull request #8639 from filipefurtad0/sitemap_spec_into_syste
Updates/moves sitemap_spec
This commit is contained in:
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@@ -34,7 +34,6 @@ jobs:
|
||||
- "spec/controllers"
|
||||
- "spec/models"
|
||||
- "spec/features/admin/[a-o0-9]*_spec.rb"
|
||||
- "spec/features/consumer"
|
||||
- "spec/lib"
|
||||
- "spec/migrations"
|
||||
- "spec/serializers"
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'sitemap' do
|
||||
let(:enterprise) { create(:distributor_enterprise) }
|
||||
let!(:group) { create(:enterprise_group, enterprises: [enterprise], on_front_page: true) }
|
||||
|
||||
it "renders sitemap" do
|
||||
visit '/sitemap.xml'
|
||||
expect(page).to have_content enterprise_shop_url(enterprise)
|
||||
expect(page).to have_content group_url(group)
|
||||
end
|
||||
end
|
||||
23
spec/system/consumer/sitemap_spec.rb
Normal file
23
spec/system/consumer/sitemap_spec.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'system_helper'
|
||||
|
||||
describe 'sitemap' do
|
||||
let(:enterprise) { create(:distributor_enterprise) }
|
||||
let!(:group) { create(:enterprise_group, enterprises: [enterprise], on_front_page: true) }
|
||||
|
||||
it "renders sitemap" do
|
||||
visit '/sitemap.xml'
|
||||
expect(page.source).to have_content return_page(enterprise_shop_url(enterprise))
|
||||
expect(page.source).to have_content return_page(group_url(group))
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def return_page(website)
|
||||
# routing does not include the port of the session, this method adds it
|
||||
url = URI(page.driver.browser.url)
|
||||
path = URI(website).path
|
||||
return_page = "http://#{url.host}:#{url.port}#{path}"
|
||||
end
|
||||
Reference in New Issue
Block a user