Skip to content

Commit

Permalink
Add presence validation to tube_purpose_name in the generate sample m…
Browse files Browse the repository at this point in the history
…anifest uat action
  • Loading branch information
yoldas committed Jan 16, 2025
1 parent 705af56 commit 9e2777b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/uat_actions/uat_actions/generate_sample_manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class UatActions::GenerateSampleManifest < UatActions

form_field :with_samples, :check_box, help: 'Create new samples for recipients?', label: 'With Samples?'

validates :tube_purpose_name, presence: true
validate :validate_tube_purpose_exists

def self.default
Expand All @@ -67,7 +68,7 @@ def perform
#
# @return [void]
def validate_tube_purpose_exists
return if tube_purpose_name.blank? # Uses the default.
return if tube_purpose_name.blank? # Already validated by presence
return if Tube::Purpose.exists?(name: tube_purpose_name)

message = format(ERROR_TUBE_PURPOSE_DOES_NOT_EXIST, tube_purpose_name)
Expand Down

0 comments on commit 9e2777b

Please sign in to comment.