Skip to content

chore: migrate last remaining tests of rspec #449

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 7 commits into from
May 28, 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
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:


jobs:
rspec:
test:
runs-on: ubuntu-latest
services:
mysql:
Expand Down Expand Up @@ -63,8 +63,9 @@ jobs:
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
RAILS_ENV: test

- name: RSpec
- name: Test
env:
RAILS_ENV: test
RAILS_VERSION: ${{ matrix.rails }}
DB_ADAPTER: ${{ matrix.adapter }}
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci_jruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true

jobs:
rspec:
test:
runs-on: ubuntu-latest
services:
mysql:
Expand Down Expand Up @@ -59,8 +59,9 @@ jobs:
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
RAILS_ENV: test

- name: RSpec
- name: Test
env:
RAILS_ENV: test
RAILS_VERSION: ${{ matrix.rails }}
DB_ADAPTER: ${{ matrix.adapter }}
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci_truffleruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true

jobs:
rspec:
test:
runs-on: ubuntu-latest
services:
mysql:
Expand Down Expand Up @@ -62,8 +62,9 @@ jobs:
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
RAILS_ENV: test

- name: RSpec
- name: Test
env:
RAILS_ENV: test
RAILS_VERSION: ${{ matrix.rails }}
DB_ADAPTER: ${{ matrix.adapter }}
BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile
Expand Down
1 change: 0 additions & 1 deletion .rspec

This file was deleted.

26 changes: 8 additions & 18 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

appraise 'activerecord-7.1' do
gem 'activerecord', '~> 7.1.0'
gem 'railties'

platforms :ruby, :truffleruby do
gem 'mysql2'
gem 'pg'
Expand All @@ -17,45 +19,33 @@ end

appraise 'activerecord-7.2' do
gem 'activerecord', '~> 7.2.0'
gem 'railties'

platforms :ruby do
gem 'mysql2'
gem 'pg'
gem 'sqlite3'
end

platforms :jruby do
gem 'activerecord-jdbcmysql-adapter'
gem 'activerecord-jdbcpostgresql-adapter'
gem 'activerecord-jdbcsqlite3-adapter'
end
end

appraise 'activerecord-8.0' do
gem 'activerecord', '~> 8.0.0'
gem 'railties'

platforms :ruby do
gem 'mysql2'
gem 'pg'
gem 'sqlite3'
end

platforms :jruby do
gem 'activerecord-jdbcmysql-adapter'
gem 'activerecord-jdbcpostgresql-adapter'
gem 'activerecord-jdbcsqlite3-adapter'
end
end

appraise 'activerecord-edge' do
gem 'activerecord', github: 'rails/rails'
gem 'railties', github: 'rails/rails'

platforms :ruby do
gem 'mysql2'
gem 'pg'
gem 'sqlite3'
end

platforms :jruby do
gem 'activerecord-jdbcmysql-adapter'
gem 'activerecord-jdbcpostgresql-adapter'
gem 'activerecord-jdbcsqlite3-adapter'
end
end
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
source 'https://rubygems.org'

gemspec

27 changes: 10 additions & 17 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rake/testtask'

RSpec::Core::RakeTask.new(:spec) do |task|
task.pattern = 'spec/closure_tree/*_spec.rb'
end
task default: :test

task default: %i[spec test]
Rake::TestTask.new do |t|
t.libs.push 'lib'
t.libs.push 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end

namespace :spec do
desc 'Run all spec variants'
namespace :test do
desc 'Run all test variants'
task :all do
rake = 'bin/rake'

[['', ''], ['db_prefix_', ''], ['', '_db_suffix'], %w[abc_ _123]].each do |prefix, suffix|
env = "DB_PREFIX=#{prefix} DB_SUFFIX=#{suffix}"
raise unless system("#{rake} spec #{env}")
raise unless system("#{rake} test #{env}")
end
end
end

Rake::TestTask.new do |t|
t.libs.push 'lib'
t.libs.push 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end

task default: 'spec:all'
9 changes: 3 additions & 6 deletions closure_tree.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require_relative 'lib/closure_tree/version'

Gem::Specification.new do |gem|
gem.name = 'closure_tree'
gem.version = ::ClosureTree::VERSION
gem.version = ClosureTree::VERSION
gem.authors = ['Matthew McEachen', 'Abdelkader Boudih']
gem.email = %w[[email protected] [email protected]]
gem.homepage = 'https://github.com/ClosureTree/closure_tree/'
Expand All @@ -21,23 +21,20 @@ Gem::Specification.new do |gem|
}

gem.files = `git ls-files`.split($/).reject do |f|
f.match(%r{^(spec|img|gemfiles)})
f.match(%r{^(test|img|gemfiles)})
end

gem.test_files = gem.files.grep(%r{^spec/})
gem.test_files = gem.files.grep(%r{^test/})
gem.required_ruby_version = '>= 3.3.0'

gem.add_runtime_dependency 'activerecord', '>= 7.1.0'
gem.add_runtime_dependency 'with_advisory_lock', '>= 5.0.0', '< 6.0.0'

gem.add_development_dependency 'appraisal'
gem.add_development_dependency 'database_cleaner'
gem.add_development_dependency 'generator_spec'
gem.add_development_dependency 'parallel'
gem.add_development_dependency 'minitest'
gem.add_development_dependency 'minitest-reporters'
gem.add_development_dependency 'rspec-instafail'
gem.add_development_dependency 'rspec-rails'
gem.add_development_dependency 'simplecov'
gem.add_development_dependency 'timecop'
# gem.add_development_dependency 'byebug'
Expand Down
1 change: 1 addition & 0 deletions gemfiles/activerecord_7.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
source "https://rubygems.org"

gem "activerecord", "~> 7.1.0"
gem "railties"

platforms :ruby, :truffleruby do
gem "mysql2"
Expand Down
7 changes: 1 addition & 6 deletions gemfiles/activerecord_7.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@
source "https://rubygems.org"

gem "activerecord", "~> 7.2.0"
gem "railties"

platforms :ruby do
gem "mysql2"
gem "pg"
gem "sqlite3"
end

platforms :jruby do
gem "activerecord-jdbcmysql-adapter"
gem "activerecord-jdbcpostgresql-adapter"
gem "activerecord-jdbcsqlite3-adapter"
end

gemspec path: "../"
7 changes: 1 addition & 6 deletions gemfiles/activerecord_8.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@
source "https://rubygems.org"

gem "activerecord", "~> 8.0.0"
gem "railties"

platforms :ruby do
gem "mysql2"
gem "pg"
gem "sqlite3"
end

platforms :jruby do
gem "activerecord-jdbcmysql-adapter"
gem "activerecord-jdbcpostgresql-adapter"
gem "activerecord-jdbcsqlite3-adapter"
end

gemspec path: "../"
7 changes: 1 addition & 6 deletions gemfiles/activerecord_edge.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@
source "https://rubygems.org"

gem "activerecord", github: "rails/rails"
gem "railties", github: "rails/rails"

platforms :ruby do
gem "mysql2"
gem "pg"
gem "sqlite3"
end

platforms :jruby do
gem "activerecord-jdbcmysql-adapter"
gem "activerecord-jdbcpostgresql-adapter"
gem "activerecord-jdbcsqlite3-adapter"
end

gemspec path: "../"
4 changes: 0 additions & 4 deletions lib/closure_tree/test/matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,3 @@ def description
end
end
end

RSpec.configure do |c|
c.include ClosureTree::Test::Matcher, type: :model
end
Loading
Loading