Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/models/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def untag!

broadcast_with_warren

validates :oligo, length: { maximum: 30 }, allow_blank: true

scope :sorted, -> { order(:map_id) }

def name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def check_formatting
return if value.blank?

errors.add(:tag, 'must be a combination of A,C,G,T or N') unless value.match?(/\A[acgtnACGTN]+\z/)
errors.add(:tag, 'length must not exceed 30 characters') if value.length > 30
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/data/sample_manifest_excel/columns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ i7:
options:
type: :textLength
operator: :lessThanOrEqual
formula1: "255"
formula1: "30"
allowBlank: false
showInputMessage: true
promptTitle: "i7"
Expand All @@ -45,7 +45,7 @@ i5:
options:
type: :textLength
operator: :lessThanOrEqual
formula1: "255"
formula1: "30"
allowBlank: false
showInputMessage: true
promptTitle: "i5"
Expand Down
7 changes: 7 additions & 0 deletions spec/models/tag_group/form_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@
expect(tag_group_form_object.tag_group.tags.first.oligo).to eq('ACCTTGGA')
end
end

context 'when the oligos entered are longer than 30 charcters' do
it 'the model is invalid' do
tag_group_form_object.oligos_text = 'AAAAAAASACCCGGGTTTTTAAAAAATTTTTT'
expect(tag_group_form_object).not_to be_valid
end
end
end

context 'when no name is entered' do
Expand Down
Loading