Skip to content

Commit 2de90a5

Browse files
committed
Remove unncessary reloads from specs
Previously, we had to reload the pages after adding conditions as we were mocking out the method for retrieving them. Now that conditions are retreived from the database, these reloads are unnecessary in request specs as the code under test will retrieve the latest data from the database.
1 parent 58f8852 commit 2de90a5

1 file changed

Lines changed: 0 additions & 18 deletions

File tree

spec/requests/pages/secondary_skip_controller_spec.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
context "when a condition exists on the page" do
4141
before do
4242
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
4443
end
4544

4645
it "returns 200" do
@@ -51,8 +50,6 @@
5150
context "when a secondary skip condition already exists on the page" do
5251
before do
5352
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
5653
end
5754

5855
it "redirects to the show routes page" do
@@ -84,7 +81,6 @@
8481
context "when a condition exists on the page" do
8582
before do
8683
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
8884
end
8985

9086
context "when the submission is successful" do
@@ -97,8 +93,6 @@
9793
context "when a secondary skip condition already exists on the page" do
9894
before do
9995
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
10296
end
10397

10498
it "redirects to the show routes page" do
@@ -140,7 +134,6 @@
140134
context "when a condition exists on the page" do
141135
before do
142136
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
144137
end
145138

146139
context "when no secondary_skip exists on the page" do
@@ -153,8 +146,6 @@
153146
context "when a secondary_skip exists on the page" do
154147
before do
155148
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
158149
end
159150

160151
it "renders the edit template" do
@@ -187,7 +178,6 @@
187178
context "when a condition exists on the page" do
188179
before do
189180
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
191181
end
192182

193183
context "when no secondary_skip exists on the page" do
@@ -200,8 +190,6 @@
200190
context "when a secondary_skip exists on the page" do
201191
before do
202192
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
205193
end
206194

207195
context "when the submission is successful without changing the routing_page_id" do
@@ -264,7 +252,6 @@
264252
context "when a condition exists on the page" do
265253
before do
266254
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
268255
end
269256

270257
context "when no secondary_skip exists on the page" do
@@ -277,8 +264,6 @@
277264
context "when a secondary_skip exists on the page" do
278265
before do
279266
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
282267
end
283268

284269
it "returns 200" do
@@ -305,7 +290,6 @@
305290
context "when a condition exists on the page" do
306291
before do
307292
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
309293
end
310294

311295
context "when no secondary_skip exists on the page" do
@@ -318,8 +302,6 @@
318302
context "when a secondary_skip exists on the page" do
319303
before do
320304
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
323305
end
324306

325307
context "when the submission is successful and deletes the secondary skip condition" do

0 commit comments

Comments
 (0)