Skip to content
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

Test against trilogy and drop hard dependency on mysql2 #2

Merged
merged 2 commits into from
Aug 22, 2024
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
11 changes: 5 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ jobs:
fail-fast: false
matrix:
ruby:
- '3.3'
- '3.2'
- '3.1'
- '3.0'
- '2.7'
- '2.6'
- '2.5'
- '2.4'
client:
- 'trilogy'
- 'mysql2'

steps:
- uses: actions/checkout@v3
Expand All @@ -35,6 +34,6 @@ jobs:

- name: Run tests
env:
DATABASE_URL: mysql2://root:[email protected]/scenic_mysql_adapter_test
DATABASE_URL: ${{ matrix.client }}://root:[email protected]/scenic_mysql_adapter_test
run: |
bundle exec rake test
34 changes: 10 additions & 24 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
appraise "rails-42" do
gem "activerecord", "~> 4.2", "< 5.0"
gem "activemodel", "~> 4.2", "< 5.0"
gem "actionpack", "~> 4.2", "< 5.0"
gem "activesupport", "~> 4.2", "< 5.0"
appraise "rails-71" do
gem "activerecord", "~> 7.1.0"
gem "activemodel", "~> 7.1.0"
gem "actionpack", "~> 7.1.0"
gem "activesupport", "~> 7.1.0"
end

appraise "rails-50" do
gem "activerecord", "~> 5.0", "< 5.1"
gem "activemodel", "~> 5.0", "< 5.1"
gem "actionpack", "~> 5.0", "< 5.1"
gem "activesupport", "~> 5.0", "< 5.1"
end

appraise "rails-51" do
gem "activerecord", "~> 5.1", "< 5.2"
gem "activemodel", "~> 5.1", "< 5.2"
gem "actionpack", "~> 5.1", "< 5.2"
gem "activesupport", "~> 5.1", "< 5.2"
end

appraise "rails-52" do
gem "activerecord", "~> 5.2"
gem "activemodel", "~> 5.2"
gem "actionpack", "~> 5.2"
gem "activesupport", "~> 5.2"
appraise "rails-72" do
gem "activerecord", "~> 7.2.0"
gem "activemodel", "~> 7.2.0"
gem "actionpack", "~> 7.2.0"
gem "activesupport", "~> 7.2.0"
end
11 changes: 0 additions & 11 deletions gemfiles/rails_42.gemfile

This file was deleted.

10 changes: 0 additions & 10 deletions gemfiles/rails_50.gemfile

This file was deleted.

11 changes: 0 additions & 11 deletions gemfiles/rails_51.gemfile

This file was deleted.

10 changes: 0 additions & 10 deletions gemfiles/rails_52.gemfile

This file was deleted.

10 changes: 10 additions & 0 deletions gemfiles/rails_71.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord", "~> 7.1.0"
gem "activemodel", "~> 7.1.0"
gem "actionpack", "~> 7.1.0"
gem "activesupport", "~> 7.1.0"

gemspec path: "../"
10 changes: 10 additions & 0 deletions gemfiles/rails_72.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "activerecord", "~> 7.2.0"
gem "activemodel", "~> 7.2.0"
gem "actionpack", "~> 7.2.0"
gem "activesupport", "~> 7.2.0"

gemspec path: "../"
3 changes: 2 additions & 1 deletion scenic-mysql_adapter.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_dependency "scenic", ">= 1.4.0"
spec.add_dependency "mysql2"

spec.add_development_dependency "bundler"
spec.add_development_dependency "rake"
spec.add_development_dependency "minitest", "~> 5.0"
spec.add_development_dependency "appraisal"
spec.add_development_dependency "mysql2"
spec.add_development_dependency "trilogy"
end
7 changes: 6 additions & 1 deletion test/scenic/mysql_adapter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ def test_views

def test_views_dont_show_as_tables
@adapter.create_view('v', 'select 1 as num')
output = ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, StringIO.new)
pool_or_conn = if ActiveRecord.gem_version >= "7.2"
ActiveRecord::Base.connection_pool
else
ActiveRecord::Base.connection
end
output = ActiveRecord::SchemaDumper.dump(pool_or_conn, StringIO.new)
refute_match(/create_table\s+\"v\"/i, output.string, "View is dumped as a table in schema.rb")
ensure
ActiveRecord::Base.connection.execute 'DROP VIEW IF EXISTS v'
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

# establish the database connection
ActiveRecord::Base.establish_connection(
ENV['DATABASE_URL'] || 'mysql2://root@localhost/scenic_mysql_adapter_test'
ENV['DATABASE_URL'] || 'trilogy://root@localhost/scenic_mysql_adapter_test'
)
ActiveRecord::Migration.verbose = false