Skip to content

Commit

Permalink
chore(test): setup test
Browse files Browse the repository at this point in the history
- modify rails and rspec version
- support ruby 3.0
  • Loading branch information
bivanalhar committed Jul 24, 2024
1 parent 6befe8b commit 789e8fe
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 7 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Ruby

on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '0 0 * * 0'

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.0', '3.1', '3.2']
activerecord: ['6.0', '6.1', '7.0', '7.1']
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.activerecord }}.gemfile
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
/spec/reports/
/tmp/
/.ruby-version
gemfiles/*.lock
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

19 changes: 19 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
appraise "rails-6.0" do
gem 'rails', '6.0.6.1'
gem 'rspec-rails', '~> 5'
end

appraise "rails-6.1" do
gem 'rails', '~> 6.1'
gem 'rspec-rails', '>= 6'
end

appraise "rails-7.0" do
gem 'rails', '7.0.8.4'
gem 'rspec-rails', '>= 6'
end

appraise "rails-7.1" do
gem 'rails', '~> 7.1'
gem 'rspec-rails', '>= 6'
end
9 changes: 9 additions & 0 deletions gemfiles/rails_6.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 "coveralls_reborn", require: false
gem "rails", "6.0.6.1"
gem "rspec-rails", "~> 5"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/rails_6.1.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 "coveralls_reborn", require: false
gem "rails", "~> 6.1"
gem "rspec-rails", ">= 6"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/rails_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 "coveralls_reborn", require: false
gem "rails", "7.0.8.4"
gem "rspec-rails", ">= 6"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/rails_7.1.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 "coveralls_reborn", require: false
gem "rails", "~> 7.1"
gem "rspec-rails", ">= 6"

gemspec path: "../"
4 changes: 2 additions & 2 deletions settings_on_rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.required_ruby_version = '>= 3.1.0'
spec.required_ruby_version = '>= 3'
spec.add_dependency 'rails', '>= 6'

spec.add_development_dependency 'sqlite3', '~> 1.7'
spec.add_development_dependency 'bundler', '>= 1.6'
spec.add_development_dependency 'rspec-rails', '~> 3.3'
spec.add_development_dependency "appraisal", "~> 2.1"
spec.add_development_dependency 'rake'
end
5 changes: 5 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@
config.order = :random
end

if ActiveRecord.version > Gem::Version.new('6.2')
ActiveRecord.use_yaml_unsafe_load = true
else
ActiveRecord::Base.use_yaml_unsafe_load = true
end

0 comments on commit 789e8fe

Please sign in to comment.