From a378d49e4b848a5d1c339fbce688a3abc8225f21 Mon Sep 17 00:00:00 2001 From: Scott Date: Sat, 14 Dec 2024 22:21:38 -0800 Subject: [PATCH] AO3-6587 Fix justifiable spec, cucumber feature and Rubocop style guidance --- app/models/concerns/justifiable.rb | 4 +++- spec/models/concerns/justifiable_spec.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/justifiable.rb b/app/models/concerns/justifiable.rb index a6f4e8df49f..bd4af895427 100644 --- a/app/models/concerns/justifiable.rb +++ b/app/models/concerns/justifiable.rb @@ -18,7 +18,9 @@ module Justifiable private def strip_octothorpe - self.ticket_number = self.ticket_number.delete_prefix("#") unless self.ticket_number.nil? + unless ticket_number.is_a?(Integer) + self.ticket_number = self.ticket_number.delete_prefix("#") unless self.ticket_number.nil? + end end def enabled? diff --git a/spec/models/concerns/justifiable_spec.rb b/spec/models/concerns/justifiable_spec.rb index b023e56a6f0..2e68cd2bd48 100644 --- a/spec/models/concerns/justifiable_spec.rb +++ b/spec/models/concerns/justifiable_spec.rb @@ -26,7 +26,7 @@ record.assign_attributes(attributes) expect(record).not_to be_valid - expect(record.errors[:ticket_number]).to contain_exactly("can't be blank", "is not a number") + expect(record.errors[:ticket_number]).to contain_exactly("can't be blank", "may begin with an # and otherwise contain only numbers.") expect(record.ticket_url).to be_nil end