Skip to content

Commit fd33bda

Browse files
Fix to messages on box creation (#1898)
1 parent 964d391 commit fd33bda

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

app/models/box_form.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ def validate_batches_or_samples_for_purpose
134134
when "LOD", "Other"
135135
@box.errors.add(:base, "A batch is required") unless unique_batch_count >= 1
136136
when "Variants"
137-
@box.errors.add(:base, "You must select at least two batches") unless unique_batch_count >= 2
137+
@box.errors.add(:base, "You must select at least two different batches") unless unique_batch_count >= 2
138138
when "Challenge"
139-
@box.errors.add(:base, "A virus batch is required") unless have_virus_batch?
139+
@box.errors.add(:base, "You must select at least one non-distractor batch") unless have_virus_batch?
140140
@box.errors.add(:base, "You must select at least one distractor batch") unless have_distractor_batch?
141141
end
142142
when "add_samples"
@@ -147,7 +147,7 @@ def validate_batches_or_samples_for_purpose
147147
else
148148
case @box.purpose
149149
when "Variants"
150-
@box.errors.add(:base, "You must select samples coming from at least two batches") unless samples_unique_batch_count >= 2
150+
@box.errors.add(:base, "You must select samples coming from at least two different batches") unless samples_unique_batch_count >= 2
151151
when "Challenge"
152152
@box.errors.add(:base, "You must select at least one non-distractor sample") unless have_virus_sample?
153153
@box.errors.add(:base, "You must select at least one distractor sample") unless have_distractor_sample?

spec/features/boxes_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
end
137137

138138
expect_page CreateBoxPage do |form|
139-
expect(form.errors).to have_text("You must select at least two batches")
139+
expect(form.errors).to have_text("You must select at least two different batches")
140140
expect(form.purpose_field.value).to eq("Variants")
141141
expect(form.media_field.value).to eq(media)
142142
expect(form.batch_summaries.size).to eq(2)
@@ -205,7 +205,7 @@
205205
end
206206

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

@@ -374,7 +374,7 @@
374374
end
375375

376376
expect_page CreateBoxPage do |form|
377-
expect(form.errors).to have_text("You must select samples coming from at least two batches")
377+
expect(form.errors).to have_text("You must select samples coming from at least two different batches")
378378
expect(form.purpose_field.value).to eq("Variants")
379379
expect(form.media_field.value).to eq(media)
380380
end

0 commit comments

Comments
 (0)