Skip to content

Commit

Permalink
Add Ruby 3.1 and Rails 7 to CI (#1526)
Browse files Browse the repository at this point in the history
This PR adds the Ruby 3.1 and Rails 7 elements to the CI matrix.  To support those changes a number of other changes were required:

- Adding a basic Rails 7 Gemfile and updating `Appraisals`
- Quoting 3.0 in the `.github/workflows/build.yml` file so that this entry pulls Ruby 3.0.x and not Ruby 3.1
- Adding the "--disable-error_highlight" value for RUBYOPT in the build environment to disable Ruby 3.1 error highlighting
- Bumping the version of `standard` and configuring it to run against our oldest supported version
  • Loading branch information
petergoldstein authored Jan 14, 2022
1 parent 893eb67 commit b7eb4db
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 25 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
ruby:
- jruby-9.2.16.0
- truffleruby
- "3.1"
- "3.0"
- "2.7"
- "2.6"
Expand All @@ -23,25 +24,41 @@ jobs:
- "5.2"
- "6.0"
- "6.1"
- "7.0"
- main
exclude:
- ruby: 2.5
rails: "7.0"
- ruby: 2.5
rails: main
- ruby: 2.6
rails: "7.0"
- ruby: 2.6
rails: main
- ruby: jruby-9.2.16.0
rails: "7.0"
- ruby: jruby-9.2.16.0
rails: main
- ruby: 3.0
- ruby: "3.0"
rails: "5.0"
- ruby: "3.0"
rails: "5.1"
- ruby: "3.0"
rails: "5.2"
- ruby: "3.1"
rails: "5.0"
- ruby: 3.0
- ruby: "3.1"
rails: "5.1"
- ruby: 3.0
- ruby: "3.1"
rails: "5.2"
- ruby: "3.1"
rails: "6.0"

runs-on: 'ubuntu-latest'

env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
RUBYOPT: "--disable-error_highlight"

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .standard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby_version: "2.5"
6 changes: 6 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ appraise "6.1" do
gem "sqlite3", platforms: [:ruby]
end

appraise "7.0" do
gem "activerecord", "~> 7.0.0"
gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
end

appraise "main" do
gem "activerecord", git: "https://github.com/rails/rails.git", branch: "main"
gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platforms: [:jruby]
Expand Down
28 changes: 14 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ GEM
middleware (0.1.0)
minitest (5.14.3)
multi_test (0.1.2)
parallel (1.20.1)
parser (3.0.0.0)
parallel (1.21.0)
parser (3.1.0.0)
ast (~> 2.4.1)
protobuf-cucumber (3.10.8)
activesupport (>= 3.2)
middleware
thor
thread_safe
rainbow (3.0.0)
rainbow (3.1.1)
rake (13.0.3)
regexp_parser (2.0.3)
regexp_parser (2.2.0)
rexml (3.2.5)
rspec (3.10.0)
rspec-core (~> 3.10.0)
Expand All @@ -100,19 +100,19 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rubocop (1.10.0)
rubocop (1.24.1)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.2.0, < 2.0)
rubocop-ast (>= 1.15.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-performance (1.9.2)
rubocop (>= 0.90.0, < 2.0)
rubocop-ast (1.15.1)
parser (>= 3.0.1.1)
rubocop-performance (1.13.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
ruby-progressbar (1.11.0)
simplecov (0.21.2)
Expand All @@ -122,16 +122,16 @@ GEM
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.2)
sqlite3 (1.4.2)
standard (0.13.0)
rubocop (= 1.10.0)
rubocop-performance (= 1.9.2)
standard (1.6.0)
rubocop (= 1.24.1)
rubocop-performance (= 1.13.1)
sys-uname (1.2.2)
ffi (~> 1.1)
thor (1.1.0)
thread_safe (0.3.6)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.0.0)
unicode-display_width (2.1.0)
yard (0.9.26)
zeitwerk (2.4.2)

Expand Down
9 changes: 9 additions & 0 deletions gemfiles/7.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
gem "activerecord", "~> 7.0.0"

gemspec name: "factory_bot", path: "../"
2 changes: 1 addition & 1 deletion lib/factory_bot/decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def send(...)
end
RUBY
else
def method_missing(name, *args, &block) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing
@component.send(name, *args, &block)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/factory_bot/definition_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def transient(&block)
# end
#
# are equivalent.
def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing, Style/MethodMissingSuper
def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing
association_options = args.first

if association_options.nil?
Expand Down
2 changes: 1 addition & 1 deletion lib/factory_bot/evaluator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def association(factory_name, *traits_and_overrides)

attr_accessor :instance

def method_missing(method_name, *args, &block) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
def method_missing(method_name, *args, &block)
if @instance.respond_to?(method_name)
@instance.send(method_name, *args, &block)
else
Expand Down
8 changes: 4 additions & 4 deletions spec/acceptance/build_stubbed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
it "allows overriding created_at for objects with created_at" do
created_at = 3.days.ago
stubbed = build_stubbed(:thing_with_timestamp, created_at: created_at)
expect(stubbed.created_at).to eq created_at
expect(stubbed.created_at).to be_within(1.second).of created_at
end

it "doesn't allow setting created_at on an object that doesn't define it" do
Expand All @@ -180,7 +180,7 @@
expect(stub.created_at).to be_about_now
past_time = 3.days.ago
stub.created_at = past_time
expect(stub.created_at).to eq past_time
expect(stub.created_at).to be_within(1.second).of past_time
end

it "behaves the same as a non-stubbed created_at" do
Expand Down Expand Up @@ -231,7 +231,7 @@ def created_at
it "allows overriding updated_at for objects with updated_at" do
past_time = 3.days.ago
stubbed = build_stubbed(:thing_with_timestamp, updated_at: past_time)
expect(stubbed.updated_at).to eq past_time
expect(stubbed.updated_at).to be_within(1.second).of past_time
end

it "doesn't allow setting updated_at on an object that doesn't define it" do
Expand All @@ -245,7 +245,7 @@ def created_at
expect(stub.updated_at).to be_about_now
past_time = 3.days.ago
stub.updated_at = past_time
expect(stub.updated_at).to eq past_time
expect(stub.updated_at).to be_within(1.second).of past_time
end

it "behaves the same as a non-stubbed updated_at" do
Expand Down
2 changes: 1 addition & 1 deletion spec/factory_bot/definition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

it "exposes a non-default create strategy when one is provided by the user" do
definition = described_class.new(:name)
block = proc { nil }
block = proc {}
definition.to_create(&block)

expect(definition.to_create).to eq block
Expand Down

0 comments on commit b7eb4db

Please sign in to comment.