Skip to content

Commit

Permalink
AO3-6587 Fix justifiable spec, cucumber feature and Rubocop style gui…
Browse files Browse the repository at this point in the history
…dance
  • Loading branch information
scottsds committed Dec 15, 2024
1 parent 3c20481 commit a378d49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/models/concerns/justifiable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 21 in app/models/concerns/justifiable.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Use a guard clause (`return if ticket_number.is_a?(Integer)`) instead of wrapping the code inside a conditional expression. Raw Output: app/models/concerns/justifiable.rb:21:5: C: Style/GuardClause: Use a guard clause (`return if ticket_number.is_a?(Integer)`) instead of wrapping the code inside a conditional expression.
self.ticket_number = self.ticket_number.delete_prefix("#") unless self.ticket_number.nil?

Check warning on line 22 in app/models/concerns/justifiable.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Consider merging nested conditions into outer `unless` conditions. Raw Output: app/models/concerns/justifiable.rb:22:66: C: Style/SoleNestedConditional: Consider merging nested conditions into outer `unless` conditions.
end
end

def enabled?
Expand Down
2 changes: 1 addition & 1 deletion spec/models/concerns/justifiable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a378d49

Please sign in to comment.