Skip to content
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
23 changes: 14 additions & 9 deletions .github/workflows/declare_schema_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ on: [push]
name: DeclareSchema Build

jobs:
build:
tests:
name: DeclareSchema Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
adapter: [mysql, postgresql, sqlite3]
ruby: ['3.0', 3.1, 3.2, 3.3]
ruby: [3.1, 3.2, 3.3, 3.4]
gemfile:
- gemfiles/rails_6_1.gemfile
- gemfiles/rails_7_0.gemfile
- gemfiles/rails_7_1.gemfile
- gemfiles/rails_7_2.gemfile
- gemfiles/rails_8_0.gemfile
exclude:
- ruby: 3.1
gemfile: gemfiles/rails_8_0.gemfile
- adapter: mysql
ruby: 3.3
gemfile: gemfiles/rails_6_1.gemfile
Expand All @@ -28,15 +31,17 @@ jobs:
ruby: 3.3
gemfile: gemfiles/rails_6_1.gemfile
- adapter: mysql
ruby: '3.0'
gemfile: gemfiles/rails_7_2.gemfile
ruby: 3.4
gemfile: gemfiles/rails_6_1.gemfile
- adapter: postgresql
ruby: '3.0'
gemfile: gemfiles/rails_7_2.gemfile
ruby: 3.4
gemfile: gemfiles/rails_6_1.gemfile
- adapter: sqlite3
ruby: '3.0'
gemfile: gemfiles/rails_7_2.gemfile

ruby: 3.4
gemfile: gemfiles/rails_6_1.gemfile
# TODO: Support SQLite3 with Rails 8.0
- adapter: sqlite3
gemfile: gemfiles/rails_8_0.gemfile
env:
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
MYSQL_HOST: 127.0.0.1
Expand Down
2 changes: 0 additions & 2 deletions lib/declare_schema/dsl.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'active_support/proxy_object'

module DeclareSchema
class Dsl < BasicObject # avoid Object because that gets extended by lots of gems
include ::Kernel # but we need the basic class methods
Expand Down
2 changes: 0 additions & 2 deletions lib/declare_schema/field_declaration_dsl.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'active_support/proxy_object'

module DeclareSchema
class FieldDeclarationDsl < BasicObject # avoid Object because that gets extended by lots of gems
include ::Kernel # but we need the basic class methods
Expand Down
7 changes: 6 additions & 1 deletion spec/lib/declare_schema/migration_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,12 @@ class Ad < ActiveRecord::Base # rubocop:disable Lint/ConstantDefinitionInBlock
end
up, _down = Generators::DeclareSchema::Migration::Migrator.run
ActiveRecord::Migration.class_eval(up)
expect(Ad.field_specs['company'].options[:validates].inspect).to eq("{:presence=>true, :uniqueness=>{:case_sensitive=>false}}")

if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.4")
expect(Ad.field_specs['company'].options[:validates].inspect).to eq("{:presence=>true, :uniqueness=>{:case_sensitive=>false}}")
else
expect(Ad.field_specs['company'].options[:validates].inspect).to eq("{presence: true, uniqueness: {case_sensitive: false}}")
end

# DeclareSchema supports has_and_belongs_to_many relationships and generates the intersection ("join") table
# with appropriate primary key, indexes, and foreign keys.
Expand Down
12 changes: 10 additions & 2 deletions spec/lib/declare_schema/model/table_options_definition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ class TableOptionsDefinitionTestModel < ActiveRecord::Base # rubocop:disable Lin

describe '#to_key' do
subject { model.to_key }
it { is_expected.to eq(['table_options_definition_test_models', "{:charset=>#{charset.inspect}, :collation=>#{collation.inspect}}"]) }
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.4")
it { is_expected.to eq(['table_options_definition_test_models', "{:charset=>#{charset.inspect}, :collation=>#{collation.inspect}}"]) }
else
it { is_expected.to eq(['table_options_definition_test_models', "{charset: #{charset.inspect}, collation: #{collation.inspect}}"]) }
end
end

describe '#settings' do
Expand Down Expand Up @@ -56,7 +60,11 @@ class TableOptionsDefinitionTestModel < ActiveRecord::Base # rubocop:disable Lin

describe '#hash' do
subject { model.hash }
it { is_expected.to eq(['table_options_definition_test_models', "{:charset=>#{charset.inspect}, :collation=>#{collation.inspect}}"].hash) }
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.4")
it { is_expected.to eq(['table_options_definition_test_models', "{:charset=>#{charset.inspect}, :collation=>#{collation.inspect}}"].hash) }
else
it { is_expected.to eq(['table_options_definition_test_models', "{charset: #{charset.inspect}, collation: #{collation.inspect}}"].hash) }
end
end

describe '#to_s' do
Expand Down
Loading