|
58 | 58 | expect(JSON.parse(form.made_live_forms.last.json_form_blob)["submission_type"]).to eq("email_with_csv") |
59 | 59 | end |
60 | 60 |
|
| 61 | + it "synchronises the FormDocument" do |
| 62 | + task.invoke(form.id) |
| 63 | + form_documents = Api::V2::Form.find(form.id).form_documents |
| 64 | + expect(form_documents.size).to eq(1) |
| 65 | + expect(form_documents.first["content"]["submission_type"]).to eq("email_with_csv") |
| 66 | + end |
| 67 | + |
61 | 68 | it "does not update a different form" do |
62 | 69 | expect { task.invoke(form.id) } |
63 | 70 | .not_to(change { other_form.reload.submission_type }) |
|
74 | 81 | expect { task.invoke(form.id) } |
75 | 82 | .to change { form.reload.submission_type }.to("email_with_csv") |
76 | 83 | end |
| 84 | + |
| 85 | + it "synchronises the FormDocument" do |
| 86 | + task.invoke(form.id) |
| 87 | + form_documents = Api::V2::Form.find(form.id).form_documents |
| 88 | + expect(form_documents.size).to eq(1) |
| 89 | + expect(form_documents.first["content"]["submission_type"]).to eq("email_with_csv") |
| 90 | + end |
77 | 91 | end |
78 | 92 |
|
79 | 93 | context "when the form is archived" do |
|
91 | 105 | task.invoke(form.id) |
92 | 106 | expect(JSON.parse(form.made_live_forms.last.json_form_blob)["submission_type"]).to eq("email") |
93 | 107 | end |
| 108 | + |
| 109 | + it "synchronises the archived and draft FormDocuments" do |
| 110 | + task.invoke(form.id) |
| 111 | + form_documents = Api::V2::Form.find(form.id).form_documents |
| 112 | + expect(form_documents.size).to eq(2) |
| 113 | + expect(form_documents.first["content"]["submission_type"]).to eq("email_with_csv") |
| 114 | + expect(form_documents.second["content"]["submission_type"]).to eq("email_with_csv") |
| 115 | + end |
94 | 116 | end |
95 | 117 | end |
96 | 118 |
|
|
141 | 163 | expect(JSON.parse(form.made_live_forms.last.json_form_blob)["s3_bucket_name"]).to eq(s3_bucket_name) |
142 | 164 | end |
143 | 165 |
|
| 166 | + it "synchronises the FormDocument" do |
| 167 | + task.invoke(form.id, s3_bucket_name, s3_bucket_aws_account_id, s3_bucket_region) |
| 168 | + form_documents = Api::V2::Form.find(form.id).form_documents |
| 169 | + expect(form_documents.size).to eq(1) |
| 170 | + expect(form_documents.first["content"]["submission_type"]).to eq("s3") |
| 171 | + expect(form_documents.first["content"]["s3_bucket_name"]).to eq(s3_bucket_name) |
| 172 | + end |
| 173 | + |
144 | 174 | it "does not update a different form" do |
145 | 175 | expect { task.invoke(form.id, s3_bucket_name, s3_bucket_aws_account_id, s3_bucket_region) } |
146 | 176 | .not_to(change { other_form.reload.submission_type }) |
|
167 | 197 | expect { task.invoke(form.id, s3_bucket_name, s3_bucket_aws_account_id, s3_bucket_region) } |
168 | 198 | .to change { form.reload.s3_bucket_aws_account_id }.to(s3_bucket_aws_account_id) |
169 | 199 | end |
| 200 | + |
| 201 | + it "synchronises the FormDocument" do |
| 202 | + task.invoke(form.id, s3_bucket_name, s3_bucket_aws_account_id, s3_bucket_region) |
| 203 | + form_documents = Api::V2::Form.find(form.id).form_documents |
| 204 | + expect(form_documents.size).to eq(1) |
| 205 | + expect(form_documents.first["content"]["submission_type"]).to eq("s3") |
| 206 | + expect(form_documents.first["content"]["s3_bucket_name"]).to eq(s3_bucket_name) |
| 207 | + end |
170 | 208 | end |
171 | 209 |
|
172 | 210 | context "when the form is archived" do |
|
184 | 222 | task.invoke(form.id, s3_bucket_name, s3_bucket_aws_account_id, s3_bucket_region) |
185 | 223 | expect(JSON.parse(form.made_live_forms.last.json_form_blob)["submission_type"]).to eq("email") |
186 | 224 | end |
| 225 | + |
| 226 | + it "synchronises the archived and draft FormDocuments" do |
| 227 | + task.invoke(form.id, s3_bucket_name, s3_bucket_aws_account_id, s3_bucket_region) |
| 228 | + form_documents = Api::V2::Form.find(form.id).form_documents |
| 229 | + expect(form_documents.size).to eq(2) |
| 230 | + expect(form_documents.first["content"]["submission_type"]).to eq("s3") |
| 231 | + expect(form_documents.first["content"]["s3_bucket_name"]).to eq(s3_bucket_name) |
| 232 | + expect(form_documents.second["content"]["submission_type"]).to eq("s3") |
| 233 | + expect(form_documents.second["content"]["s3_bucket_name"]).to eq(s3_bucket_name) |
| 234 | + end |
187 | 235 | end |
188 | 236 |
|
189 | 237 | context "without arguments" do |
|
264 | 312 | expect(JSON.parse(form.made_live_forms.last.json_form_blob)["submission_type"]).to eq("email") |
265 | 313 | end |
266 | 314 |
|
| 315 | + it "synchronises the FormDocument" do |
| 316 | + task.invoke(form.id) |
| 317 | + form_documents = Api::V2::Form.find(form.id).form_documents |
| 318 | + expect(form_documents.size).to eq(1) |
| 319 | + expect(form_documents.first["content"]["submission_type"]).to eq("email") |
| 320 | + end |
| 321 | + |
267 | 322 | it "does not update a different form" do |
268 | 323 | expect { task.invoke(form.id) } |
269 | 324 | .not_to(change { other_form.reload.submission_type }) |
|
297 | 352 | task.invoke(form.id) |
298 | 353 | expect(JSON.parse(form.made_live_forms.last.json_form_blob)["submission_type"]).to eq("s3") |
299 | 354 | end |
| 355 | + |
| 356 | + it "synchronises the archived and draft FormDocuments" do |
| 357 | + task.invoke(form.id) |
| 358 | + form_documents = Api::V2::Form.find(form.id).form_documents |
| 359 | + expect(form_documents.size).to eq(2) |
| 360 | + expect(form_documents.first["content"]["submission_type"]).to eq("email") |
| 361 | + expect(form_documents.second["content"]["submission_type"]).to eq("email") |
| 362 | + end |
300 | 363 | end |
301 | 364 | end |
302 | 365 |
|
|
0 commit comments