|
3 | 3 | RSpec.describe ReportHelper, type: :helper do |
4 | 4 | let(:forms) do |
5 | 5 | [ |
6 | | - { "form_id" => 1, "tag" => "live", "content" => { "name" => "All question types form" }, "group" => { "organisation" => { "name" => "Government Digital Service" } } }, |
7 | | - { "form_id" => 3, "tag" => "live", "content" => { "name" => "Branch route form" }, "group" => { "organisation" => { "name" => "Ministry of Tests" } } }, |
8 | | - { "form_id" => 4, "tag" => "live", "content" => { "name" => "Skip route form" }, "group" => { "organisation" => { "name" => "Department for Testing" } } }, |
| 6 | + { "form_id" => 1, "tag" => "live", "content" => { "name" => "All question types form" }, "organisation_name" => "Government Digital Service" }, |
| 7 | + { "form_id" => 3, "tag" => "live", "content" => { "name" => "Branch route form" }, "organisation_name" => "Ministry of Tests" }, |
| 8 | + { "form_id" => 4, "tag" => "live", "content" => { "name" => "Skip route form" }, "organisation_name" => "Department for Testing" }, |
9 | 9 | ] |
10 | 10 | end |
11 | 11 |
|
12 | 12 | let(:forms_with_routes) do |
13 | 13 | [ |
14 | | - { "form_id" => 3, "tag" => "live", "content" => { "name" => "Branch route form" }, "group" => { "organisation" => { "name" => "Ministry of Tests" } }, "metadata" => { "number_of_routes" => 2, "number_of_branch_routes" => 1 } }, |
15 | | - { "form_id" => 4, "tag" => "live", "content" => { "name" => "Skip route form" }, "group" => { "organisation" => { "name" => "Department for Testing" } }, "metadata" => { "number_of_routes" => 1, "number_of_branch_routes" => 0 } }, |
| 14 | + { "form_id" => 3, "tag" => "live", "content" => { "name" => "Branch route form" }, "organisation_name" => "Ministry of Tests", "metadata" => { "number_of_routes" => 2, "number_of_branch_routes" => 1 } }, |
| 15 | + { "form_id" => 4, "tag" => "live", "content" => { "name" => "Skip route form" }, "organisation_name" => "Department for Testing", "metadata" => { "number_of_routes" => 1, "number_of_branch_routes" => 0 } }, |
16 | 16 | ] |
17 | 17 | end |
18 | 18 |
|
19 | 19 | let(:questions) do |
20 | 20 | [ |
21 | | - { "type" => "question_page", "data" => { "question_text" => "Email address" }, "form" => { "form_id" => 1, "tag" => "live", "content" => { "name" => "All question types form" }, "group" => { "organisation" => { "name" => "Government Digital Service" } } } }, |
22 | | - { "type" => "question_page", "data" => { "question_text" => "What’s your email address?" }, "form" => { "form_id" => 3, "tag" => "live", "content" => { "name" => "Branch route form" }, "group" => { "organisation" => { "name" => "Ministry of Tests" } } } }, |
| 21 | + { "type" => "question_page", "data" => { "question_text" => "Email address" }, "form" => { "form_id" => 1, "tag" => "live", "content" => { "name" => "All question types form" }, "organisation_name" => "Government Digital Service" } }, |
| 22 | + { "type" => "question_page", "data" => { "question_text" => "What’s your email address?" }, "form" => { "form_id" => 3, "tag" => "live", "content" => { "name" => "Branch route form" }, "organisation_name" => "Ministry of Tests" } }, |
23 | 23 | ] |
24 | 24 | end |
25 | 25 |
|
|
154 | 154 | "Department for Testing", |
155 | 155 | ] |
156 | 156 | end |
157 | | - |
158 | | - context "when form is not in a group" do |
159 | | - let(:forms) do |
160 | | - [ |
161 | | - { "form_id" => 1, "tag" => "live", "content" => { "name" => "All question types form" }, "group" => nil }, |
162 | | - ] |
163 | | - end |
164 | | - |
165 | | - it "returns the empty string for the organisation name" do |
166 | | - expect(helper.report_forms_table_rows(forms).map(&:second)).to eq [ |
167 | | - "", |
168 | | - ] |
169 | | - end |
170 | | - end |
171 | 157 | end |
172 | 158 |
|
173 | 159 | describe "#report_forms_with_routes_table_head" do |
|
228 | 214 | 0 |
229 | 215 | ] |
230 | 216 | end |
231 | | - |
232 | | - context "when form is not in a group" do |
233 | | - let(:forms) do |
234 | | - [ |
235 | | - { "form_id" => 1, "tag" => "live", "content" => { "name" => "All question types form" }, "group" => nil }, |
236 | | - ] |
237 | | - end |
238 | | - |
239 | | - it "returns the empty string for the organisation name" do |
240 | | - expect(helper.report_forms_table_rows(forms).map(&:second)).to eq [ |
241 | | - "", |
242 | | - ] |
243 | | - end |
244 | | - end |
245 | 217 | end |
246 | 218 |
|
247 | 219 | describe "#report_questions_table_head" do |
|
282 | 254 | "What’s your email address?", |
283 | 255 | ] |
284 | 256 | end |
285 | | - |
286 | | - context "when form is not in a group" do |
287 | | - let(:questions) do |
288 | | - [ |
289 | | - { "type" => "question_page", "data" => { "question_text" => "Email address" }, "form" => { "form_id" => 1, "tag" => "live", "content" => { "name" => "All question types form" }, "group" => nil } }, |
290 | | - ] |
291 | | - end |
292 | | - |
293 | | - it "returns the empty string for the organisation name" do |
294 | | - expect(helper.report_questions_table_rows(questions).map(&:second)).to eq [ |
295 | | - "", |
296 | | - ] |
297 | | - end |
298 | | - end |
299 | 257 | end |
300 | 258 | end |
0 commit comments