Skip to content

Commit 8131f0e

Browse files
committed
Test differing Default/Global space sitemap behaviour
1 parent f9c465f commit 8131f0e

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

test/integration/sitemap_test.rb

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ class SitemapTest < ActionDispatch::IntegrationTest
4343
SitemapGenerator::Interpreter.run(verbose: false)
4444
end
4545

46-
# Global sitemap should include all content
47-
global_urls = parse
48-
assert_includes global_urls, material_url(materials(:good_material))
49-
assert_includes global_urls, material_url(materials(:plant_space_material))
46+
# Default sitemap should only include default space content (content with null `space_id`)
47+
default_space_urls = parse
48+
assert_includes default_space_urls, material_url(materials(:good_material))
49+
refute_includes default_space_urls, material_url(materials(:plant_space_material))
5050

5151
# Space sitemap should only include content for that space
5252
space_urls = parse_space(space)
@@ -56,6 +56,17 @@ class SitemapTest < ActionDispatch::IntegrationTest
5656
refute_includes space_urls, "#{space.url}/materials/#{materials(:good_material).friendly_id}"
5757
end
5858

59+
test 'generates global sitemap when spaces feature is not enabled' do
60+
with_settings(feature: { spaces: false }) do
61+
SitemapGenerator::Interpreter.run(verbose: false)
62+
end
63+
64+
# Global sitemap should include all content
65+
global_urls = parse
66+
assert_includes global_urls, material_url(materials(:good_material))
67+
assert_includes global_urls, material_url(materials(:plant_space_material))
68+
end
69+
5970
private
6071

6172
# Hacked to read files from disk rather than fetching via URL.

0 commit comments

Comments
 (0)