From 9b0b5c95ebab1a789a8aafb338143506eb45a8cd Mon Sep 17 00:00:00 2001 From: thealiilman Date: Mon, 14 Dec 2020 12:29:01 +0800 Subject: [PATCH] Fix RuboCop offenses These were introduced after #1358 was merged. Rather bizarrely, RuboCop didn't run when the PR was opened. --- .../matchers/active_record/have_db_column_matcher.rb | 7 +++++-- .../matchers/active_record/have_db_column_matcher_spec.rb | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/shoulda/matchers/active_record/have_db_column_matcher.rb b/lib/shoulda/matchers/active_record/have_db_column_matcher.rb index c6ab4e412..5fc8911b8 100644 --- a/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +++ b/lib/shoulda/matchers/active_record/have_db_column_matcher.rb @@ -84,7 +84,7 @@ def have_db_column(column) # @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 @@ def description 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 diff --git a/spec/unit/shoulda/matchers/active_record/have_db_column_matcher_spec.rb b/spec/unit/shoulda/matchers/active_record/have_db_column_matcher_spec.rb index ab165f39f..8d56315f6 100644 --- a/spec/unit/shoulda/matchers/active_record/have_db_column_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/active_record/have_db_column_matcher_spec.rb @@ -102,7 +102,7 @@ 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