|
40 | 40 | context "when a condition exists on the page" do |
41 | 41 | before do |
42 | 42 | create(:condition, routing_page_id: page.id, check_page_id: page.id, answer_value: "Option 1", goto_page_id: pages[2].id, skip_to_end: false) |
43 | | - page.reload |
44 | 43 | end |
45 | 44 |
|
46 | 45 | it "returns 200" do |
|
51 | 50 | context "when a secondary skip condition already exists on the page" do |
52 | 51 | before do |
53 | 52 | create(:condition, routing_page_id: pages[1].id, check_page_id: page.id, goto_page_id: pages[4].id) |
54 | | - page.reload |
55 | | - pages[1].reload |
56 | 53 | end |
57 | 54 |
|
58 | 55 | it "redirects to the show routes page" do |
|
84 | 81 | context "when a condition exists on the page" do |
85 | 82 | before do |
86 | 83 | create(:condition, routing_page_id: page.id, check_page_id: page.id, answer_value: "Option 1", goto_page_id: pages[2].id, skip_to_end: false) |
87 | | - page.reload |
88 | 84 | end |
89 | 85 |
|
90 | 86 | context "when the submission is successful" do |
|
97 | 93 | context "when a secondary skip condition already exists on the page" do |
98 | 94 | before do |
99 | 95 | create(:condition, routing_page_id: pages[1].id, check_page_id: page.id, goto_page_id: pages[4].id) |
100 | | - page.reload |
101 | | - pages[1].reload |
102 | 96 | end |
103 | 97 |
|
104 | 98 | it "redirects to the show routes page" do |
|
140 | 134 | context "when a condition exists on the page" do |
141 | 135 | before do |
142 | 136 | create(:condition, routing_page_id: page.id, check_page_id: page.id, answer_value: "Option 1", goto_page_id: pages[2].id, skip_to_end: false) |
143 | | - page.reload |
144 | 137 | end |
145 | 138 |
|
146 | 139 | context "when no secondary_skip exists on the page" do |
|
153 | 146 | context "when a secondary_skip exists on the page" do |
154 | 147 | before do |
155 | 148 | create(:condition, routing_page_id: pages[1].id, check_page_id: page.id, goto_page_id: pages[4].id) |
156 | | - page.reload |
157 | | - pages[1].reload |
158 | 149 | end |
159 | 150 |
|
160 | 151 | it "renders the edit template" do |
|
187 | 178 | context "when a condition exists on the page" do |
188 | 179 | before do |
189 | 180 | create(:condition, routing_page_id: page.id, check_page_id: page.id, answer_value: "Option 1", goto_page_id: pages[2].id, skip_to_end: false) |
190 | | - page.reload |
191 | 181 | end |
192 | 182 |
|
193 | 183 | context "when no secondary_skip exists on the page" do |
|
200 | 190 | context "when a secondary_skip exists on the page" do |
201 | 191 | before do |
202 | 192 | create(:condition, routing_page_id: pages[1].id, check_page_id: page.id, goto_page_id: pages[4].id) |
203 | | - page.reload |
204 | | - pages[1].reload |
205 | 193 | end |
206 | 194 |
|
207 | 195 | context "when the submission is successful without changing the routing_page_id" do |
|
264 | 252 | context "when a condition exists on the page" do |
265 | 253 | before do |
266 | 254 | create(:condition, routing_page_id: page.id, check_page_id: page.id, answer_value: "Option 1", goto_page_id: pages[2].id, skip_to_end: false) |
267 | | - page.reload |
268 | 255 | end |
269 | 256 |
|
270 | 257 | context "when no secondary_skip exists on the page" do |
|
277 | 264 | context "when a secondary_skip exists on the page" do |
278 | 265 | before do |
279 | 266 | create(:condition, routing_page_id: pages[1].id, check_page_id: page.id, goto_page_id: pages[4].id) |
280 | | - page.reload |
281 | | - pages[1].reload |
282 | 267 | end |
283 | 268 |
|
284 | 269 | it "returns 200" do |
|
305 | 290 | context "when a condition exists on the page" do |
306 | 291 | before do |
307 | 292 | create(:condition, routing_page_id: page.id, check_page_id: page.id, answer_value: "Option 1", goto_page_id: pages[2].id, skip_to_end: false) |
308 | | - page.reload |
309 | 293 | end |
310 | 294 |
|
311 | 295 | context "when no secondary_skip exists on the page" do |
|
318 | 302 | context "when a secondary_skip exists on the page" do |
319 | 303 | before do |
320 | 304 | create(:condition, routing_page_id: pages[1].id, check_page_id: page.id, goto_page_id: pages[4].id) |
321 | | - page.reload |
322 | | - pages[1].reload |
323 | 305 | end |
324 | 306 |
|
325 | 307 | context "when the submission is successful and deletes the secondary skip condition" do |
|
0 commit comments