Skip to content

Commit 789e8fe

Browse files
committed
chore(test): setup test
- modify rails and rspec version - support ruby 3.0
1 parent 6befe8b commit 789e8fe

File tree

10 files changed

+106
-7
lines changed

10 files changed

+106
-7
lines changed

.github/workflows/ruby.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7+
8+
name: Ruby
9+
10+
on:
11+
push:
12+
branches:
13+
- master
14+
pull_request:
15+
branches:
16+
- master
17+
schedule:
18+
- cron: '0 0 * * 0'
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
test:
25+
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
ruby-version: ['3.0', '3.1', '3.2']
29+
activerecord: ['6.0', '6.1', '7.0', '7.1']
30+
env:
31+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.activerecord }}.gemfile
32+
steps:
33+
- uses: actions/checkout@v3
34+
- name: Set up Ruby
35+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
36+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
37+
# uses: ruby/setup-ruby@v1
38+
uses: ruby/setup-ruby@v1
39+
with:
40+
ruby-version: ${{ matrix.ruby-version }}
41+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
42+
- name: Run tests
43+
run: bundle exec rake

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
/spec/reports/
1111
/tmp/
1212
/.ruby-version
13+
gemfiles/*.lock

.travis.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

Appraisals

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
appraise "rails-6.0" do
2+
gem 'rails', '6.0.6.1'
3+
gem 'rspec-rails', '~> 5'
4+
end
5+
6+
appraise "rails-6.1" do
7+
gem 'rails', '~> 6.1'
8+
gem 'rspec-rails', '>= 6'
9+
end
10+
11+
appraise "rails-7.0" do
12+
gem 'rails', '7.0.8.4'
13+
gem 'rspec-rails', '>= 6'
14+
end
15+
16+
appraise "rails-7.1" do
17+
gem 'rails', '~> 7.1'
18+
gem 'rspec-rails', '>= 6'
19+
end

gemfiles/rails_6.0.gemfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "coveralls_reborn", require: false
6+
gem "rails", "6.0.6.1"
7+
gem "rspec-rails", "~> 5"
8+
9+
gemspec path: "../"

gemfiles/rails_6.1.gemfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "coveralls_reborn", require: false
6+
gem "rails", "~> 6.1"
7+
gem "rspec-rails", ">= 6"
8+
9+
gemspec path: "../"

gemfiles/rails_7.0.gemfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "coveralls_reborn", require: false
6+
gem "rails", "7.0.8.4"
7+
gem "rspec-rails", ">= 6"
8+
9+
gemspec path: "../"

gemfiles/rails_7.1.gemfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "coveralls_reborn", require: false
6+
gem "rails", "~> 7.1"
7+
gem "rspec-rails", ">= 6"
8+
9+
gemspec path: "../"

settings_on_rails.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
1919
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2020
spec.require_paths = ["lib"]
2121

22-
spec.required_ruby_version = '>= 3.1.0'
22+
spec.required_ruby_version = '>= 3'
2323
spec.add_dependency 'rails', '>= 6'
2424

2525
spec.add_development_dependency 'sqlite3', '~> 1.7'
2626
spec.add_development_dependency 'bundler', '>= 1.6'
27-
spec.add_development_dependency 'rspec-rails', '~> 3.3'
27+
spec.add_development_dependency "appraisal", "~> 2.1"
2828
spec.add_development_dependency 'rake'
2929
end

spec/spec_helper.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@
88
config.order = :random
99
end
1010

11+
if ActiveRecord.version > Gem::Version.new('6.2')
12+
ActiveRecord.use_yaml_unsafe_load = true
13+
else
14+
ActiveRecord::Base.use_yaml_unsafe_load = true
15+
end

0 commit comments

Comments
 (0)