diff -Nur a/spec/support/unit/active_record/create_table.rb b/spec/support/unit/active_record/create_table.rb --- a/spec/support/unit/active_record/create_table.rb 2022-03-02 15:43:54.402107119 +0800 +++ b/spec/support/unit/active_record/create_table.rb 2022-03-02 15:47:54.230150787 +0800 @@ -47,7 +47,7 @@ column_options = {} end - table.column(column_name, column_type, column_options) + table.column(column_name, column_type, **column_options) end end end diff -Nur a/spec/support/unit/helpers/model_builder.rb b/spec/support/unit/helpers/model_builder.rb --- a/spec/support/unit/helpers/model_builder.rb 2022-03-02 15:43:54.410107254 +0800 +++ b/spec/support/unit/helpers/model_builder.rb 2022-03-02 15:47:54.230150787 +0800 @@ -39,7 +39,7 @@ begin connection.execute("DROP TABLE IF EXISTS #{table_name}") - connection.create_table(table_name, options, &block) + connection.create_table(table_name, **options, &block) created_tables << table_name connection rescue Exception => e diff -Nur a/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb b/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb --- a/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb 2022-03-02 15:43:54.634111031 +0800 +++ b/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb 2022-03-02 15:55:07.113449499 +0800 @@ -40,7 +40,7 @@ def build_object(options = {}, &block) build_object_with_generic_attribute( - options.merge(column_type: :integer, value: 1), + **options.merge(column_type: :integer, value: 1), &block ) end @@ -64,7 +64,7 @@ def build_object(options = {}, &block) build_object_with_generic_attribute( - options.merge( + **options.merge( column_type: :integer, column_options: { limit: 2 }, value: 1 @@ -90,7 +90,7 @@ def build_object(options = {}, &block) build_object_with_generic_attribute( - options.merge(column_type: :float, value: 1.0), + **options.merge(column_type: :float, value: 1.0), &block ) end @@ -118,7 +118,7 @@ def build_object(options = {}, &block) build_object_with_generic_attribute( - options.merge(column_type: :decimal, value: BigDecimal('1.0')), + **options.merge(column_type: :decimal, value: BigDecimal('1.0')), &block ) end @@ -149,7 +149,7 @@ define_method :build_object do |options = {}, &block| build_object_with_generic_attribute( - options.merge(column_type: :date, value: today), + **options.merge(column_type: :date, value: today), &block ) end @@ -177,7 +177,7 @@ define_method :build_object do |options = {}, &block| build_object_with_generic_attribute( - options.merge(column_type: :datetime, value: now), + **options.merge(column_type: :datetime, value: now), &block ) end @@ -204,7 +204,7 @@ define_method :build_object do |options = {}, &block| build_object_with_generic_attribute( - options.merge(column_type: :time, value: default_time), + **options.merge(column_type: :time, value: default_time), &block ) end @@ -225,7 +225,7 @@ def build_object(options = {}, &block) build_object_with_generic_attribute( - options.merge(column_type: :string), + **options.merge(column_type: :string), &block ) end @@ -731,7 +731,7 @@ define_method :build_object do |options = {}, &block| build_object_with_generic_attribute( - options.merge(column_type: :timestamp, value: now), + **options.merge(column_type: :timestamp, value: now), &block ) end @@ -772,7 +772,7 @@ end def build_object(options = {}, &block) - super(options.merge(column_options: { null: true }, value: true)) + super(**options.merge(column_options: { null: true }, value: true)) end end @@ -792,13 +792,13 @@ end def build_object(options = {}, &block) - super(options.merge(column_options: { null: false })) + super(**options.merge(column_options: { null: false })) end end def build_object(options = {}, &block) build_object_with_generic_attribute( - options.merge(column_type: :boolean), + **options.merge(column_type: :boolean), &block ) end @@ -820,7 +820,7 @@ include_context 'against a boolean attribute for true and false' def build_object(options = {}, &block) - build_object_with_generic_attribute(options.merge(value: true)) + build_object_with_generic_attribute(**options.merge(value: true)) end end @@ -828,7 +828,7 @@ include_context 'against a boolean attribute for true and false' def build_object(options = {}, &block) - build_object_with_generic_attribute(options.merge(value: false)) + build_object_with_generic_attribute(**options.merge(value: false)) end end diff -Nur a/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb b/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb --- a/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb 2022-03-02 15:43:54.630110963 +0800 +++ b/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb 2022-03-02 15:59:12.837592578 +0800 @@ -282,13 +282,13 @@ def belonging_to_parent(options = {}) define_model :parent define_model :child, parent_id: :integer do - belongs_to :parent, options + belongs_to :parent, **options end.new end def belonging_to_non_existent_class(model_name, assoc_name, options = {}) define_model model_name, "#{assoc_name}_id" => :integer do - belongs_to assoc_name, options + belongs_to assoc_name, **options end.new end end @@ -575,14 +575,14 @@ order = options.delete(:order) define_association_with_order(model, :has_many, :children, order, options) else - model.has_many :children, options + model.has_many :children, **options end end.new end def having_many_non_existent_class(model_name, assoc_name, options = {}) define_model model_name do - has_many assoc_name, options + has_many assoc_name, **options end.new end end @@ -833,14 +833,14 @@ order = options.delete(:order) define_association_with_order(model, :has_one, :detail, order, options) else - model.has_one :detail, options + model.has_one :detail, **options end end.new end def having_one_non_existent(model_name, assoc_name, options = {}) define_model model_name do - has_one assoc_name, options + has_one assoc_name, **options end.new end end @@ -1202,33 +1202,17 @@ def having_and_belonging_to_many_non_existent_class(model_name, assoc_name, options = {}) define_model model_name do - has_and_belongs_to_many assoc_name, options + has_and_belongs_to_many assoc_name, **options end.new end end def define_association_with_conditions(model, macro, name, conditions, other_options={}) - args = [] - options = {} - if active_record_supports_relations? - args << proc { where(conditions) } - else - options[:conditions] = conditions - end - args << options - model.__send__(macro, name, *args) + model.__send__(macro, name, proc { where(conditions) }, **{}) end def define_association_with_order(model, macro, name, order, other_options={}) - args = [] - options = {} - if active_record_supports_relations? - args << proc { order(order) } - else - options[:order] = order - end - args << options - model.__send__(macro, name, *args) + model.__send__(macro, name, proc { order(order) }, **{}) end def dependent_options diff -Nur 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 --- a/spec/unit/shoulda/matchers/active_record/have_db_column_matcher_spec.rb 2022-03-02 15:43:54.434107659 +0800 +++ b/spec/unit/shoulda/matchers/active_record/have_db_column_matcher_spec.rb 2022-03-02 15:47:54.230150787 +0800 @@ -104,7 +104,7 @@ def with_table(column_name, column_type, options) create_table 'employees' do |table| - table.__send__(column_type, column_name, options) + table.__send__(column_type, column_name, **options) end define_model_class('Employee').new end