Skip to content

Update ubuntu runner #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ concurrency:
jobs:
rubocop:
name: Rubocop
runs-on: 'ubuntu-20.04'
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
Expand All @@ -30,7 +30,7 @@ jobs:

test:
name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.env.RAILS_VERSION }}'
runs-on: ubuntu-20.04
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -213,7 +213,7 @@ jobs:

legacy:
name: Legacy Ruby Builds (${{ matrix.container.version }})
runs-on: ubuntu-20.04
runs-on: 'ubuntu-latest'
container:
image: ${{ matrix.container.tag }}
options: ${{ matrix.container.options || '--add-host github-complains-if-this-is-empty.com:127.0.0.1' }}
Expand All @@ -225,7 +225,6 @@ jobs:
- container:
version: "2.1.9"
tag: ghcr.io/rspec/docker-ci:2.1.9
post: git config --global --add safe.directory `pwd`
env:
RAILS_VERSION: '~> 4.2.0'
- container:
Expand All @@ -240,14 +239,16 @@ jobs:
RAILS_VERSION: '~> 4.2.0'

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
LEGACY_CI: true
JRUBY_OPTS: ${{ matrix.container.jruby_opts || '--dev' }}
RAILS_VERSION: ${{ matrix.env.RAILS_VERSION }}
steps:
- uses: actions/checkout@v3
- run: git config --global --add safe.directory $GITHUB_WORKSPACE
- run: git init $GITHUB_WORKSPACE
- run: git remote add origin https://github.com/rspec/rspec-activemodel-mocks
- run: git config --local gc.auto 0
- run: git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +$GITHUB_SHA:$GITHUB_REF
- run: git checkout --progress --force $GITHUB_REF
- run: apt-get install libsqlite3-dev
- run: ${{ matrix.container.pre }}
- run: script/legacy_setup.sh
- run: ${{ matrix.container.post }}
- run: script/run_build
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ end
version = ENV.fetch('RAILS_VERSION', '6.0.0')
version_float = version.tr('-', '.').tr('~> ', '').to_f

if version_float < 7.1
gem 'concurrent-ruby', '<= 1.3.4'
end

if version_float < 4
gem 'sqlite3', '~> 1.3.5'
elsif version_float < 6
Expand Down
5 changes: 4 additions & 1 deletion lib/rspec/active_model/mocks/mocks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,11 @@ def self.param_delimiter; "-"; end
end unless stubs.key?(:has_attribute?)

msingleton.__send__(:define_method, :respond_to?) do |method_name, *args|
return true if __model_class_has_column?(method_name)

include_private = args.first || false
__model_class_has_column?(method_name) ? true : super(method_name, include_private)

super(method_name, include_private)
end unless stubs.key?(:respond_to?)

msingleton.__send__(:define_method, :method_missing) do |missing_m, *a, &b|
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true
require 'logger'
require 'rspec/active_model/mocks'
require 'active_record'

Expand Down
1 change: 1 addition & 0 deletions templates/sample/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true
$:<< File.join(File.dirname(__FILE__), '..')
require 'logger'
require 'active_record'
require 'rspec/active_model/mocks'
require 'model/widget'
Expand Down