Skip to content

Commit

Permalink
Add Ruby 3.1 and ActiveRecord 7 to CI (#574)
Browse files Browse the repository at this point in the history
Address collision problem when using Rails 7 and the default class name 'Role'
Use Coveralls wear_merged! and move to the top of the spec file
  • Loading branch information
petergoldstein authored Jan 10, 2022
1 parent bb295d9 commit e07e69f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 10 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/activerecord.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ jobs:
matrix:
gemfile: [activerecord_4, activerecord_5, activerecord_6]
ruby: [2.5.7, 2.6.5, 2.7.2]
include:
- gemfile: activerecord_7
ruby: '3.1'
- gemfile: activerecord_7
ruby: '3.0'
- gemfile: activerecord_6
ruby: '3.0'
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
ADAPTER: active_record
Expand Down
8 changes: 4 additions & 4 deletions gemfiles/activerecord_6.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
source "https://rubygems.org"

gem "sqlite3", "~> 1.4", platform: "ruby"
gem "activerecord", ">= 6.0.0", require: "active_record"
gem "actionpack", ">= 6.0.0"
gem "activemodel", ">= 6.0.0"
gem "railties", ">= 6.0.0"
gem "activerecord", "~> 6.1.0", require: "active_record"
gem "actionpack", "~> 6.1.0"
gem "activemodel", "~> 6.1.0"
gem "railties", "~> 6.1.0"

group :test do
gem "codeclimate-test-reporter", require: nil
Expand Down
22 changes: 22 additions & 0 deletions gemfiles/activerecord_7.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "sqlite3", "~> 1.4", platform: "ruby"
gem "activerecord", "~> 7.0.0", require: "active_record"
gem "actionpack", "~> 7.0.0"
gem "activemodel", "~> 7.0.0"
gem "railties", "~> 7.0.0"

group :test do
gem "codeclimate-test-reporter", require: nil
gem "coveralls", require: false
gem "database_cleaner", "~> 1.6.2"
gem "its"
gem "test-unit"
gem "byebug"
gem "pry"
gem "pry-byebug"
end

gemspec path: "../"
6 changes: 5 additions & 1 deletion spec/generators/rolify/rolify_activerecord_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ class User < ActiveRecord::Base
end
}
require File.join(destination_root, "app/models/user.rb")
run_generator
if Rails::VERSION::MAJOR >= 7
run_generator %w(--skip-collision-check)
else
run_generator
end
}

describe 'config/initializers/rolify.rb' do
Expand Down
7 changes: 2 additions & 5 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "simplecov"
SimpleCov.start
require 'coveralls'
Coveralls.wear_merged!

require 'rubygems'
require "bundler/setup"
Expand All @@ -13,9 +13,6 @@
end
require 'database_cleaner'

require 'coveralls'
Coveralls.wear_merged!

ENV['ADAPTER'] ||= 'active_record'

load File.dirname(__FILE__) + "/support/adapters/#{ENV['ADAPTER']}.rb"
Expand Down

0 comments on commit e07e69f

Please sign in to comment.