1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00

Fix RuboCop offenses

These were introduced after #1358 was merged. Rather bizarrely,
RuboCop didn't run when the PR was opened.
This commit is contained in:
thealiilman 2020-12-14 12:29:01 +08:00 committed by Elliot Winkler
parent 63b6321175
commit 9b0b5c95eb
2 changed files with 6 additions and 3 deletions

View file

@ -84,7 +84,7 @@ module Shoulda
# @private
class HaveDbColumnMatcher
OPTIONS = %i(precision limit default null scale primary)
OPTIONS = %i(precision limit default null scale primary).freeze
def initialize(column)
@column = column
@ -147,7 +147,10 @@ module Shoulda
def validate_options(opts)
invalid_options = opts.keys.map(&:to_sym) - OPTIONS
if invalid_options.any?
raise ArgumentError, "Unknown option(s): #{invalid_options.map(&:inspect).join(", ")}"
raise(
ArgumentError,
"Unknown option(s): #{invalid_options.map(&:inspect).join(', ')}",
)
end
end

View file

@ -102,7 +102,7 @@ describe Shoulda::Matchers::ActiveRecord::HaveDbColumnMatcher, type: :model do
it 'raises an error with the unknown options' do
expect {
have_db_column(:salary).with_options(preccision: 5, primaryy: true)
}.to raise_error("Unknown option(s): :preccision, :primaryy")
}.to raise_error('Unknown option(s): :preccision, :primaryy')
end
end