diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8f4acd4e..0c2e27142 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,7 @@ jobs: fail-fast: false matrix: ruby: + - 3.0.1 - 2.7.2 - 2.6.6 appraisal: @@ -36,6 +37,9 @@ jobs: adapter: - sqlite3 - postgresql + exclude: + - { ruby: 3.0.1, appraisal: rails_5_1 } + - { ruby: 3.0.1, appraisal: rails_5_2 } env: DATABASE_ADAPTER: ${{ matrix.adapter }} BUNDLE_GEMFILE: gemfiles/${{ matrix.appraisal }}.gemfile @@ -49,7 +53,7 @@ jobs: - uses: actions/cache@v2 with: path: vendor/bundle - key: v1-rubygems-local-${{ runner.os }}-${{ matrix.ruby }}-${{ hashFiles(format('gemfiles/{0}.gemfile.lock', matrix.rails_appraisal)) }} + key: v1-rubygems-local-${{ runner.os }}-${{ matrix.ruby }}-${{ hashFiles(format('gemfiles/{0}.gemfile.lock', matrix.appraisal)) }} - name: Install dependencies run: bundle install --jobs=3 --retry=3 - name: Run Unit Tests diff --git a/.ruby-version b/.ruby-version index 37c2961c2..cb2b00e4f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.2 +3.0.1 diff --git a/.tool-versions b/.tool-versions index 9eb38ed71..a7e49f21b 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 2.7.2 +ruby 3.0.1 diff --git a/Appraisals b/Appraisals index dff904d1a..3522ff487 100644 --- a/Appraisals +++ b/Appraisals @@ -77,7 +77,7 @@ appraise 'rails_6_0' do gem 'jbuilder', '~> 2.7' gem 'bcrypt', '~> 3.1.7' gem 'capybara', '>= 2.15' - gem 'listen', '~> 3.2.0' + gem 'listen', '~> 3.3.0' gem 'spring-watcher-listen', '~> 2.0.0' gem 'selenium-webdriver' gem 'webdrivers' diff --git a/gemfiles/rails_5_1.gemfile.lock b/gemfiles/rails_5_1.gemfile.lock index 6eb1f0e42..1485bf0e0 100644 --- a/gemfiles/rails_5_1.gemfile.lock +++ b/gemfiles/rails_5_1.gemfile.lock @@ -62,7 +62,7 @@ GEM crass (1.0.6) diff-lcs (1.4.4) erubi (1.10.0) - ffi (1.14.2) + ffi (1.15.0) fssm (0.2.10) globalid (0.4.2) activesupport (>= 4.2.0) diff --git a/gemfiles/rails_5_2.gemfile.lock b/gemfiles/rails_5_2.gemfile.lock index 7745900b8..834ef47b5 100644 --- a/gemfiles/rails_5_2.gemfile.lock +++ b/gemfiles/rails_5_2.gemfile.lock @@ -73,7 +73,7 @@ GEM crass (1.0.6) diff-lcs (1.4.4) erubi (1.10.0) - ffi (1.14.2) + ffi (1.15.0) fssm (0.2.10) globalid (0.4.2) activesupport (>= 4.2.0) diff --git a/gemfiles/rails_6_0.gemfile b/gemfiles/rails_6_0.gemfile index 4887f09ac..40d094bb7 100644 --- a/gemfiles/rails_6_0.gemfile +++ b/gemfiles/rails_6_0.gemfile @@ -30,7 +30,7 @@ gem "turbolinks", "~> 5" gem "jbuilder", "~> 2.7" gem "bcrypt", "~> 3.1.7" gem "capybara", ">= 2.15" -gem "listen", "~> 3.2.0" +gem "listen", "~> 3.3.0" gem "spring-watcher-listen", "~> 2.0.0" gem "selenium-webdriver" gem "webdrivers" diff --git a/gemfiles/rails_6_0.gemfile.lock b/gemfiles/rails_6_0.gemfile.lock index 127902c5a..294ef74a5 100644 --- a/gemfiles/rails_6_0.gemfile.lock +++ b/gemfiles/rails_6_0.gemfile.lock @@ -82,7 +82,7 @@ GEM crass (1.0.6) diff-lcs (1.4.4) erubi (1.10.0) - ffi (1.14.2) + ffi (1.15.0) fssm (0.2.10) globalid (0.4.2) activesupport (>= 4.2.0) @@ -90,7 +90,7 @@ GEM concurrent-ruby (~> 1.0) jbuilder (2.11.2) activesupport (>= 5.0.0) - listen (3.2.1) + listen (3.3.4) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) loofah (2.9.0) @@ -268,7 +268,7 @@ DEPENDENCIES capybara (>= 2.15) fssm jbuilder (~> 2.7) - listen (~> 3.2.0) + listen (~> 3.3.0) pg (>= 0.18, < 2.0) pry pry-byebug diff --git a/spec/support/acceptance/helpers/step_helpers.rb b/spec/support/acceptance/helpers/step_helpers.rb index ea6f5b7f7..502ab173b 100644 --- a/spec/support/acceptance/helpers/step_helpers.rb +++ b/spec/support/acceptance/helpers/step_helpers.rb @@ -82,6 +82,7 @@ def create_rails_application bundle.remove_gem 'uglifier' bundle.remove_gem 'debugger' bundle.remove_gem 'byebug' + bundle.remove_gem 'webdrivers' bundle.remove_gem 'web-console' end diff --git a/spec/support/unit/active_record/create_table.rb b/spec/support/unit/active_record/create_table.rb index 3b46df61e..208207675 100644 --- a/spec/support/unit/active_record/create_table.rb +++ b/spec/support/unit/active_record/create_table.rb @@ -109,7 +109,7 @@ def add_column_to_table(table, column_name, column_specification) ) end - table.column(column_name, column_type, column_options) + table.column(column_name, column_type, **column_options) end end end diff --git a/spec/support/unit/helpers/model_builder.rb b/spec/support/unit/helpers/model_builder.rb index 4a7fae830..dffb637aa 100644 --- a/spec/support/unit/helpers/model_builder.rb +++ b/spec/support/unit/helpers/model_builder.rb @@ -44,7 +44,7 @@ def create_table(table_name, options = {}, &block) 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 StandardError => e diff --git 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 index ad01d142c..80599530c 100644 --- 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 @@ -21,7 +21,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 @@ -45,7 +45,7 @@ def validation_matcher_scenario_args def build_object(**options, &block) build_object_with_generic_attribute( - options.merge( + **options.merge( column_type: :integer, column_options: { limit: 2 }, value: 1, @@ -71,7 +71,7 @@ def expect_to_match_on_values(builder, values, &block) 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 @@ -99,7 +99,7 @@ def validation_matcher_scenario_args 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 @@ -130,7 +130,7 @@ def validation_matcher_scenario_args 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 @@ -158,7 +158,7 @@ def validation_matcher_scenario_args 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 @@ -186,7 +186,7 @@ def validation_matcher_scenario_args 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 @@ -207,7 +207,7 @@ def validation_matcher_scenario_args def build_object(**options, &block) build_object_with_generic_attribute( - options.merge(column_type: :string), + **options.merge(column_type: :string), &block ) end @@ -798,7 +798,7 @@ def configure_validation_matcher(matcher) 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 @@ -842,7 +842,7 @@ def validation_matcher_scenario_args def build_object(**options, &block) super( - options.merge(column_options: { null: true }, value: true), + **options.merge(column_options: { null: true }, value: true), &block ) end @@ -863,13 +863,13 @@ def build_object(**options, &block) end def build_object(**options, &block) - super(options.merge(column_options: { null: false }), &block) + super(**options.merge(column_options: { null: false }), &block) end end def build_object(**options, &block) build_object_with_generic_attribute( - options.merge(column_type: :boolean), + **options.merge(column_type: :boolean), &block ) end @@ -896,7 +896,7 @@ def validation_matcher_scenario_args include_context 'against a boolean attribute for true and false' def build_object(**options, &block) - build_object_with_generic_attribute(options.merge(value: true), &block) + build_object_with_generic_attribute(**options.merge(value: true), &block) end end @@ -904,7 +904,7 @@ def build_object(**options, &block) include_context 'against a boolean attribute for true and false' def build_object(**options, &block) - build_object_with_generic_attribute(options.merge(value: false), &block) + build_object_with_generic_attribute(**options.merge(value: false), &block) end end @@ -1010,7 +1010,7 @@ def define_model_validating_inclusion( column_options: column_options, }.compact - define_simple_model(model_options) do |model| + define_simple_model(**model_options) do |model| if validation_options model.validates_inclusion_of(attribute_name, validation_options) end diff --git a/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb b/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb index df694f707..a5276ab9d 100644 --- a/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb @@ -714,7 +714,7 @@ def create_child_model_belonging_to_parent( define_model(:parent, parent_options) define_model :child, parent_id: :integer do - belongs_to :parent, options + belongs_to :parent, **options if block class_eval(&block) @@ -743,7 +743,7 @@ def belonging_to_with_inverse(association, inverse_association) 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 @@ -1156,14 +1156,14 @@ def having_many_children(options = {}) 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 @@ -1494,14 +1494,14 @@ def having_one_detail(options = {}) 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 @@ -2124,25 +2124,17 @@ def having_and_belonging_to_many_relatives(_options = {}) 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 = {} - args << proc { where(conditions) } - 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 = {} - args << proc { order(order) } - args << options - model.__send__(macro, name, *args) + model.__send__(macro, name, proc { order(order) }, **{}) end def dependent_options 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 8d56315f6..47ae006ee 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 @@ -112,7 +112,7 @@ def model(options = {}) 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