Skip to content

Commit

Permalink
Fix to messages on box creation (#1898)
Browse files Browse the repository at this point in the history
  • Loading branch information
leandroradusky authored Feb 6, 2023
1 parent 964d391 commit fd33bda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/models/box_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ def validate_batches_or_samples_for_purpose
when "LOD", "Other"
@box.errors.add(:base, "A batch is required") unless unique_batch_count >= 1
when "Variants"
@box.errors.add(:base, "You must select at least two batches") unless unique_batch_count >= 2
@box.errors.add(:base, "You must select at least two different batches") unless unique_batch_count >= 2
when "Challenge"
@box.errors.add(:base, "A virus batch is required") unless have_virus_batch?
@box.errors.add(:base, "You must select at least one non-distractor batch") unless have_virus_batch?
@box.errors.add(:base, "You must select at least one distractor batch") unless have_distractor_batch?
end
when "add_samples"
Expand All @@ -147,7 +147,7 @@ def validate_batches_or_samples_for_purpose
else
case @box.purpose
when "Variants"
@box.errors.add(:base, "You must select samples coming from at least two batches") unless samples_unique_batch_count >= 2
@box.errors.add(:base, "You must select samples coming from at least two different batches") unless samples_unique_batch_count >= 2
when "Challenge"
@box.errors.add(:base, "You must select at least one non-distractor sample") unless have_virus_sample?
@box.errors.add(:base, "You must select at least one distractor sample") unless have_distractor_sample?
Expand Down
6 changes: 3 additions & 3 deletions spec/features/boxes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
end

expect_page CreateBoxPage do |form|
expect(form.errors).to have_text("You must select at least two batches")
expect(form.errors).to have_text("You must select at least two different batches")
expect(form.purpose_field.value).to eq("Variants")
expect(form.media_field.value).to eq(media)
expect(form.batch_summaries.size).to eq(2)
Expand Down Expand Up @@ -205,7 +205,7 @@
end

expect_page CreateBoxPage do |form|
expect(form.errors).to have_text("A virus batch is required")
expect(form.errors).to have_text("You must select at least one non-distractor batch")
expect(form.purpose_field.value).to eq("Challenge")
expect(form.batch_summaries.size).to eq(2)

Expand Down Expand Up @@ -374,7 +374,7 @@
end

expect_page CreateBoxPage do |form|
expect(form.errors).to have_text("You must select samples coming from at least two batches")
expect(form.errors).to have_text("You must select samples coming from at least two different batches")
expect(form.purpose_field.value).to eq("Variants")
expect(form.media_field.value).to eq(media)
end
Expand Down

0 comments on commit fd33bda

Please sign in to comment.