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

Bump build matrix #409

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,9 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2"]
rails: ["6.1", "7.0"]
ruby: ["3.1", "3.2", "3.3"]
rails: ["6.1", "7.0", "7.1", "main"]
continue-on-error: [false]
exclude:
- ruby: "3.2"
rails: "6.1"

runs-on: ubuntu-latest

Expand Down
9 changes: 4 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ source "https://rubygems.org"
# Specify your gem's dependencies in scenic.gemspec
gemspec

rails_version = ENV.fetch("RAILS_VERSION", "6.1")
rails_version = ENV.fetch("RAILS_VERSION", "7.1")

rails_constraint = if rails_version == "master"
rails_constraint = if rails_version == "main"
{github: "rails/rails"}
else
"~> #{rails_version}.0"
end

gem "rails", rails_constraint
gem "sprockets", "< 4.0.0"
gem "pg", "~> 1.1"
gem "activerecord", rails_constraint
gem "railties", rails_constraint
6 changes: 3 additions & 3 deletions scenic.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "database_cleaner"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec", ">= 3.3"
spec.add_development_dependency "pg", "~> 0.19"
spec.add_development_dependency "pry"
spec.add_development_dependency "pg", "~> 1.1"
spec.add_development_dependency "ammeter", ">= 1.1.3"
spec.add_development_dependency "yard"
spec.add_development_dependency "redcarpet"
spec.add_development_dependency "standard"
spec.add_development_dependency "sprockets", "< 4.0.0"

spec.add_dependency "activerecord", ">= 4.0.0"
spec.add_dependency "railties", ">= 4.0.0"

spec.required_ruby_version = ">= 2.3.0"
spec.required_ruby_version = ">= 3.1"
end
12 changes: 9 additions & 3 deletions spec/scenic/schema_dumper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SearchInAHaystack < ActiveRecord::Base
context "with views in non public schemas" do
it "dumps a create_view including namespace for a view in the database" do
view_definition = "SELECT 'needle'::text AS haystack"
Search.connection.execute "CREATE SCHEMA scenic; SET search_path TO scenic, public"
Search.connection.execute "CREATE SCHEMA IF NOT EXISTS scenic; SET search_path TO scenic, public"
Search.connection.create_view :"scenic.searches", sql_definition: view_definition
stream = StringIO.new

Expand Down Expand Up @@ -139,7 +139,7 @@ class SearchInAHaystack < ActiveRecord::Base
it "dumps a create_view for a view in the database" do
view_definition = "SELECT 'needle'::text AS haystack"
Search.connection.execute(
"CREATE SCHEMA scenic; SET search_path TO scenic, public"
"CREATE SCHEMA IF NOT EXISTS scenic; SET search_path TO scenic, public"
)
Search.connection.create_view 'scenic."search in a haystack"',
sql_definition: view_definition
Expand All @@ -151,7 +151,13 @@ class SearchInAHaystack < ActiveRecord::Base
expect(output).to include 'create_view "scenic.\"search in a haystack\"",'
expect(output).to include view_definition

Search.connection.drop_view :'scenic."search in a haystack"'
# Rails 7.1 will add a create_schema statement automatically, which breaks
# the load if the schema already exists.
if Rails.gem_version < Gem::Version.new("7.1")
Search.connection.execute 'DROP VIEW IF EXISTS scenic."search in a haystack" CASCADE;'
else
Search.connection.execute "DROP SCHEMA IF EXISTS scenic CASCADE;"
end

silence_stream($stdout) { eval(output) } # standard:disable Security/Eval

Expand Down
2 changes: 0 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
DatabaseCleaner.strategy = :transaction

config.around(:each, db: true) do |example|
ActiveRecord::SchemaMigration.create_table

DatabaseCleaner.start
example.run
DatabaseCleaner.clean
Expand Down
Loading