Skip to content

Commit

Permalink
with nulldb updated, add AR7.2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaverbuch committed Nov 14, 2024
1 parent 1531595 commit 689a579
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
experimental: true
- ruby-version: 3.2
experimental: true
- ruby-version: 3.3
experimental: true
steps:
- uses: actions/checkout@v4
with:
Expand Down
5 changes: 5 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ end
appraise "activerecord-7.1" do
gem "activerecord", "~> 7.1.0"
end

appraise "activerecord-7.2" do
gem "activerecord", "~> 7.2.0"
end

4 changes: 2 additions & 2 deletions gemfiles/activerecord_6.0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: ..
specs:
stator (0.6.0)
activerecord (>= 5.1)
activerecord (>= 6.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -61,4 +61,4 @@ DEPENDENCIES
stator!

BUNDLED WITH
2.5.22
2.5.23
4 changes: 2 additions & 2 deletions gemfiles/activerecord_6.1.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: ..
specs:
stator (0.6.0)
activerecord (>= 5.1)
activerecord (>= 6.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -60,4 +60,4 @@ DEPENDENCIES
stator!

BUNDLED WITH
2.5.22
2.5.23
4 changes: 2 additions & 2 deletions gemfiles/activerecord_7.0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: ..
specs:
stator (0.6.0)
activerecord (>= 5.1)
activerecord (>= 6.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -58,4 +58,4 @@ DEPENDENCIES
stator!

BUNDLED WITH
2.5.22
2.5.23
4 changes: 2 additions & 2 deletions gemfiles/activerecord_7.1.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: ..
specs:
stator (0.6.0)
activerecord (>= 5.1)
activerecord (>= 6.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -71,4 +71,4 @@ DEPENDENCIES
stator!

BUNDLED WITH
2.5.22
2.5.23
11 changes: 11 additions & 0 deletions gemfiles/activerecord_7.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "activerecord-nulldb-adapter"
gem "rake"
gem "rspec"
gem "activerecord", "~> 7.2.0"

gemspec path: "../"
78 changes: 78 additions & 0 deletions gemfiles/activerecord_7.2.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
PATH
remote: ..
specs:
stator (0.6.0)
activerecord (>= 6.0)

GEM
remote: https://rubygems.org/
specs:
activemodel (7.2.2)
activesupport (= 7.2.2)
activerecord (7.2.2)
activemodel (= 7.2.2)
activesupport (= 7.2.2)
timeout (>= 0.4.0)
activerecord-nulldb-adapter (1.1.1)
activerecord (>= 6.0, < 8.1)
activesupport (7.2.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.8)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
diff-lcs (1.5.1)
drb (2.2.1)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
logger (1.6.1)
minitest (5.25.1)
rake (13.2.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
securerandom (0.3.2)
thor (1.3.2)
timeout (0.4.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)

PLATFORMS
arm64-darwin-24
ruby

DEPENDENCIES
activerecord (~> 7.2.0)
activerecord-nulldb-adapter
appraisal
rake
rspec
stator!

BUNDLED WITH
2.5.23
12 changes: 10 additions & 2 deletions spec/model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,16 @@
User::ACTIVE_STATES.should eql(%w[activated hyperactivated])
User::INACTIVE_STATES.should eql(%w[pending deactivated semiactivated])

User.active.to_sql.gsub(" ", " ").should eq("SELECT users.* FROM users WHERE users.state IN ('activated', 'hyperactivated')")
User.inactive.to_sql.gsub(" ", " ").should eq("SELECT users.* FROM users WHERE users.state IN ('pending', 'deactivated', 'semiactivated')")
is_active_record_72_or_higher = Gem::Requirement.new(">= 7.2").satisfied_by?(ActiveRecord.version)

if (is_active_record_72_or_higher)
User.active.to_sql.gsub(" ", " ").should eq("SELECT 'users'.* FROM 'users' WHERE 'users'.'state' IN ('activated', 'hyperactivated')")
User.inactive.to_sql.gsub(" ", " ").should eq("SELECT 'users'.* FROM 'users' WHERE 'users'.'state' IN ('pending', 'deactivated', 'semiactivated')")
else
User.active.to_sql.gsub(" ", " ").should eq("SELECT users.* FROM users WHERE users.state IN ('activated', 'hyperactivated')")
User.inactive.to_sql.gsub(" ", " ").should eq("SELECT users.* FROM users WHERE users.state IN ('pending', 'deactivated', 'semiactivated')")
end

end

it "should evaluate inverses correctly" do
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
require 'stator'

RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.expect_with(:rspec) { |c| c.syntax = :should }
config.run_all_when_everything_filtered = true
config.filter_run :focus
Expand Down
2 changes: 1 addition & 1 deletion stator.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ Gem::Specification.new do |gem|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]

gem.add_dependency 'activerecord', ">= 5.1"
gem.add_dependency 'activerecord', ">= 6.0"
end

0 comments on commit 689a579

Please sign in to comment.