|
399 | 399 | describe "make_only_english_live_status" do |
400 | 400 | let(:can_make_english_live) { false } |
401 | 401 | let(:can_make_welsh_live) { false } |
| 402 | + let(:changed_from_live_version) { false } |
402 | 403 |
|
403 | 404 | let(:form) { build(:form, :with_group, group:) } |
404 | 405 |
|
405 | 406 | before do |
406 | 407 | allow(form).to receive(:can_make_language_live?).with(language: "en").and_return(can_make_english_live) |
| 408 | + allow(form).to receive(:changed_from_live_version?).with(language: "en").and_return(changed_from_live_version) |
407 | 409 | allow(form).to receive(:can_make_language_live?).with(language: "cy").and_return(can_make_welsh_live) |
408 | 410 | end |
409 | 411 |
|
|
434 | 436 | end |
435 | 437 | end |
436 | 438 |
|
437 | | - context "when the form is a draft" do |
438 | | - let(:form) { build(:form, :ready_for_live, :with_group, group:) } |
| 439 | + context "when the form is live with draft" do |
| 440 | + let(:form) { build(:form, :live_with_draft, :with_group, group:) } |
439 | 441 |
|
440 | | - it "returns cannot_start" do |
441 | | - expect(task_status_service.all_task_statuses[:make_only_english_live_status]).to eq :cannot_start |
| 442 | + context "when there are changes from the English form document" do |
| 443 | + let(:changed_from_live_version) { true } |
| 444 | + |
| 445 | + it "returns cannot_start" do |
| 446 | + expect(task_status_service.all_task_statuses[:make_only_english_live_status]).to eq :cannot_start |
| 447 | + end |
| 448 | + end |
| 449 | + |
| 450 | + context "when there are no changes from the English form document" do |
| 451 | + let(:changed_from_live_version) { false } |
| 452 | + |
| 453 | + it "returns completed" do |
| 454 | + expect(task_status_service.all_task_statuses[:make_only_english_live_status]).to eq :completed |
| 455 | + end |
442 | 456 | end |
443 | 457 | end |
444 | 458 |
|
445 | | - context "when the form is live with draft" do |
446 | | - let(:form) { build(:form, :live_with_draft, :with_group, group:) } |
| 459 | + context "when the form is a draft" do |
| 460 | + let(:form) { build(:form, :ready_for_live, :with_group, group:) } |
447 | 461 |
|
448 | 462 | it "returns cannot_start" do |
449 | 463 | expect(task_status_service.all_task_statuses[:make_only_english_live_status]).to eq :cannot_start |
|
0 commit comments