@@ -6,7 +6,7 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest
6
6
end
7
7
8
8
test "html publications" do
9
- setup_and_visit_content_item ( "published" )
9
+ setup_and_visit_html_publication ( "published" )
10
10
11
11
within ".gem-c-inverse-header" do
12
12
assert page . has_text? ( @content_item [ "details" ] [ "format_sub_type" ] )
@@ -24,7 +24,7 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest
24
24
end
25
25
26
26
test "html publications with meta data" do
27
- setup_and_visit_content_item ( "print_with_meta_data" )
27
+ setup_and_visit_html_publication ( "print_with_meta_data" )
28
28
29
29
within ".govuk-grid-row.sidebar-with-body" do
30
30
assert page . find ( ".print-meta-data" , visible : false )
@@ -35,7 +35,7 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest
35
35
end
36
36
37
37
test "html publications with meta data - print version" do
38
- setup_and_visit_content_item ( "print_with_meta_data" , "?medium=print" )
38
+ setup_and_visit_html_publication ( "print_with_meta_data" , "?medium=print" )
39
39
40
40
within ".govuk-grid-row.sidebar-with-body" do
41
41
assert page . find ( ".print-meta-data" , visible : true )
@@ -46,25 +46,25 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest
46
46
end
47
47
48
48
test "renders back to contents elements" do
49
- setup_and_visit_content_item ( "published" )
49
+ setup_and_visit_html_publication ( "published" )
50
50
assert page . has_css? ( ".app-c-back-to-top[href='#contents']" )
51
51
end
52
52
53
53
test "prime minister office organisation html publication" do
54
- setup_and_visit_content_item ( "prime_ministers_office" )
54
+ setup_and_visit_html_publication ( "prime_ministers_office" )
55
55
assert_has_component_organisation_logo_with_brand ( "executive-office" , 4 )
56
56
end
57
57
58
58
test "no contents are shown when headings are an empty list" do
59
- setup_and_visit_content_item ( "prime_ministers_office" )
59
+ setup_and_visit_html_publication ( "prime_ministers_office" )
60
60
61
61
within ".gem-c-inverse-header" do
62
62
assert_not page . has_text? ( "Contents" )
63
63
end
64
64
end
65
65
66
66
test "html publication with rtl text direction" do
67
- setup_and_visit_content_item ( "arabic_translation" )
67
+ setup_and_visit_html_publication ( "arabic_translation" )
68
68
assert page . has_css? ( "#wrapper.direction-rtl" ) , "has .direction-rtl class on #wrapper element"
69
69
end
70
70
@@ -81,6 +81,7 @@ def assert_has_component_organisation_logo_with_brand(brand, index = 1)
81
81
'withdrawn_at' : "2014-08-09T11:39:05Z" ,
82
82
}
83
83
84
+ stub_content_store_has_item ( content_item [ "links" ] [ "parent" ] [ 0 ] [ "base_path" ] )
84
85
stub_content_store_has_item ( "/government/publications/canada-united-kingdom-joint-declaration/canada-united-kingdom-joint-declaration" , content_item . to_json )
85
86
visit_with_cachebust "/government/publications/canada-united-kingdom-joint-declaration/canada-united-kingdom-joint-declaration"
86
87
@@ -90,12 +91,13 @@ def assert_has_component_organisation_logo_with_brand(brand, index = 1)
90
91
91
92
test "if document has no parent document_type 'publication' is shown" do
92
93
content_item = GovukSchemas ::Example . find ( "html_publication" , example_name : "prime_ministers_office" )
93
- content_item [ "links" ] [ "parent" ] [ 0 ] [ "document_type" ] = nil
94
+ parent = content_item [ "links" ] [ "parent" ] [ 0 ]
95
+ parent [ "document_type" ] = nil
94
96
content_item [ "withdrawn_notice" ] = {
95
97
'explanation' : "This is out of date" ,
96
98
'withdrawn_at' : "2014-08-09T11:39:05Z" ,
97
99
}
98
-
100
+ stub_content_store_has_item ( parent [ "base_path" ] )
99
101
stub_content_store_has_item ( "/government/publications/canada-united-kingdom-joint-declaration/canada-united-kingdom-joint-declaration" , content_item . to_json )
100
102
visit_with_cachebust "/government/publications/canada-united-kingdom-joint-declaration/canada-united-kingdom-joint-declaration"
101
103
0 commit comments