-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathpage_viewing_spec.rb
More file actions
66 lines (51 loc) · 2.22 KB
/
page_viewing_spec.rb
File metadata and controls
66 lines (51 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
require 'rails_helper'
feature 'Public Page Viewing' do
let(:event) { create(:event) }
let!(:website) { create(:website, event: event) }
scenario 'Public views a published website page' do
home_page = create(:page, published_body: 'Home Content')
website.update(navigation_links: [home_page.slug])
visit page_path(slug: event.slug, page: home_page.slug)
expect(page).to have_content('Home Content')
within('#main-nav') { expect(page).to have_content(home_page.name) }
end
scenario 'Public views the landing page of website' do
create(:page, published_body: 'Home Content', landing: true)
visit landing_path(slug: event.slug)
expect(page).to have_content('Home Content')
end
scenario 'Public views the landing page from custom domain', js: true do
with_domain('lvh.me') do
website.update(domains: 'www.lvh.me')
create(:page, published_body: 'Home Content', landing: true)
visit root_path
expect(page).to have_content('Home Content')
end
end
scenario 'Public views the landing page for an older website on custom domain', js: true do
with_domain('lvh.me') do
website.update(domains: 'www.lvh.me')
old_home_page = create(:page, published_body: 'Old Website', landing: true)
website.update(navigation_links: [old_home_page.slug])
new_website = create(:website, domains: 'www.lvh.me')
new_home_page = create(:page,
website: new_website,
published_body: 'New Website',
landing: true)
new_website.update(navigation_links: [new_home_page.slug])
visit root_path
expect(page).to have_content('New Website')
click_on(new_home_page.name, match: :first)
expect(page).to have_content('New Website')
visit landing_path(slug: website.event.slug)
expect(page).to have_content('Old Website')
click_on(old_home_page.name, match: :first)
expect(page).to have_content('Old Website')
end
end
scenario 'Public gets not found message for wrong path on subdomain' do
website.update(domains: 'www.example.com')
visit landing_path(slug: website.event.slug)
expect(page).to have_content("Page Not Found")
end
end