diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5bd605..970f03a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,22 +11,19 @@ jobs: strategy: fail-fast: false matrix: - ruby: [2.7, '3.0'] + ruby: ['2.7', '3.0', '3.1', '3.2', '3.3'] gemfile: + - rails_7.1 - rails_7.0 - rails_6.1 - rails_6.0 - - rails_5.2 - exclude: - - ruby: '3.0' - gemfile: rails_5.2 runs-on: ubuntu-latest env: BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - run: bundle exec rake db:create db:schema:load test \ No newline at end of file + - run: bundle exec rake db:create db:schema:load test diff --git a/.gitignore b/.gitignore index 2903abf..d927810 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ test/**/Gemfile.lock *.iml *.sqlite3 .tool-versions +gems.locked +gemfiles/*.lock + diff --git a/Appraisals b/Appraisals index 1608e44..a5dd337 100644 --- a/Appraisals +++ b/Appraisals @@ -1,19 +1,24 @@ -appraise "rails-6.0" do - gem "actionpack", "~> 6.0.0" - gem "activerecord", "~> 6.0.0" -end -appraise "rails-6.1" do - gem "actionpack", "~> 6.1.0" - gem "activerecord", "~> 6.1.0" +# frozen_string_literal: true + +appraise 'rails-6.0' do + gem 'actionpack', '~> 6.0.0' + gem 'activerecord', '~> 6.0.0' + gem 'sqlite3', '~> 1.4.0' end -appraise "rails-7.0" do - gem "actionpack", "~> 7.0.0" - gem "activerecord", "~> 7.0.0" - gem "sqlite3", "~> 1.4.0" + +appraise 'rails-6.1' do + gem 'actionpack', '~> 6.1.0' + gem 'activerecord', '~> 6.1.0' + gem 'sqlite3', '~> 1.4.0' end -appraise "rails-5.2" do - gem "actionpack", "~> 5.2.0" - gem "activerecord", "~> 5.2.0" - gem "sqlite3", "~> 1.3.8" -end \ No newline at end of file +appraise 'rails-7.0' do + gem 'actionpack', '~> 7.0.0' + gem 'activerecord', '~> 7.0.0' + gem 'sqlite3', '~> 1.4.0' +end +appraise 'rails-7.1' do + gem 'actionpack', '~> 7.1.0' + gem 'activerecord', '~> 7.q.0' + gem 'sqlite3', '~> 1.4.0' +end diff --git a/Rakefile b/Rakefile index 07e03de..f9604e0 100644 --- a/Rakefile +++ b/Rakefile @@ -8,11 +8,8 @@ Rake::TestTask.new(:test) do |t| t.test_files = FileList["test/**/*_test.rb"] end -begin - require File.expand_path("test/dummy/config/application", __dir__) - Rails.application.load_tasks -rescue LoadError -end +require File.expand_path("test/dummy/config/application", __dir__) +Rails.application.load_tasks desc "Running Tests" task default: :test diff --git a/gemfiles/rails_6.0.gemfile b/gemfiles/rails_6.0.gemfile index 1cb0f81..01a3a8c 100644 --- a/gemfiles/rails_6.0.gemfile +++ b/gemfiles/rails_6.0.gemfile @@ -2,16 +2,15 @@ source "https://rubygems.org" +gem "appraisal" +gem "minitest-capybara" gem "cells-erb" gem "cells-rails" gem "reform-rails" gem "trailblazer" gem "trailblazer-cells" -gem "trailblazer-loader" -gem "sqlite3" -gem "minitest-capybara" -gem "appraisal" gem "actionpack", "~> 6.0.0" gem "activerecord", "~> 6.0.0" +gem "sqlite3", "~> 1.4.0" gemspec path: "../" diff --git a/gemfiles/rails_6.1.gemfile b/gemfiles/rails_6.1.gemfile index 2cc837f..08aa33e 100644 --- a/gemfiles/rails_6.1.gemfile +++ b/gemfiles/rails_6.1.gemfile @@ -2,16 +2,15 @@ source "https://rubygems.org" +gem "appraisal" +gem "minitest-capybara" gem "cells-erb" gem "cells-rails" gem "reform-rails" gem "trailblazer" gem "trailblazer-cells" -gem "trailblazer-loader" -gem "sqlite3" -gem "minitest-capybara" -gem "appraisal" gem "actionpack", "~> 6.1.0" gem "activerecord", "~> 6.1.0" +gem "sqlite3", "~> 1.4.0" gemspec path: "../" diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile index e774ea3..fbe91c9 100644 --- a/gemfiles/rails_7.0.gemfile +++ b/gemfiles/rails_7.0.gemfile @@ -2,22 +2,15 @@ source "https://rubygems.org" +gem "appraisal" +gem "minitest-capybara" gem "cells-erb" gem "cells-rails" gem "reform-rails" gem "trailblazer" gem "trailblazer-cells" -gem "sqlite3", "~> 1.4.0" -gem "minitest-capybara" -gem "appraisal" gem "actionpack", "~> 7.0.0" gem "activerecord", "~> 7.0.0" - -# gem "trailblazer-macro", path: "../../trailblazer-macro" -# gem "trailblazer-macro-contract", path: "../../trailblazer-macro-contract" -# gem "trailblazer-activity", path: "../../trailblazer-activity" -# gem "trailblazer-operation", path: "../../trailblazer-operation" -# gem "trailblazer-developer", path: "../../trailblazer-developer" -# gem "trailblazer-activity-dsl-linear", path: "../../trailblazer-activity-dsl-linear" +gem "sqlite3", "~> 1.4.0" gemspec path: "../" diff --git a/gemfiles/rails_5.2.gemfile b/gemfiles/rails_7.1.gemfile similarity index 67% rename from gemfiles/rails_5.2.gemfile rename to gemfiles/rails_7.1.gemfile index 73ef0ce..303131d 100644 --- a/gemfiles/rails_5.2.gemfile +++ b/gemfiles/rails_7.1.gemfile @@ -2,16 +2,15 @@ source "https://rubygems.org" +gem "appraisal" +gem "minitest-capybara" gem "cells-erb" gem "cells-rails" gem "reform-rails" gem "trailblazer" gem "trailblazer-cells" -gem "trailblazer-loader" -gem "sqlite3", "~> 1.3.8" -gem "minitest-capybara" -gem "appraisal" -gem "actionpack", "~> 5.2.0" -gem "activerecord", "~> 5.2.0" +gem "actionpack", "~> 7.1.0" +gem "activerecord", "~> 7.q.0" +gem "sqlite3", "~> 1.4.0" gemspec path: "../" diff --git a/gems.rb b/gems.rb new file mode 100644 index 0000000..87345ec --- /dev/null +++ b/gems.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' +gemspec + +gem 'appraisal' +gem 'minitest-capybara' +gem "cells-erb" +gem "cells-rails" +gem "reform-rails" +gem "trailblazer" +gem "trailblazer-cells" \ No newline at end of file diff --git a/test/dummy/app/models/song.rb b/test/dummy/app/models/song.rb index 7c9dbf0..bd4aa53 100644 --- a/test/dummy/app/models/song.rb +++ b/test/dummy/app/models/song.rb @@ -1,2 +1,9 @@ class Song < ApplicationRecord + + def inspect + # this makes the output consistent across Ruby versions + title = self.title.present? ? "\"#{self.title}\"" : "nil" + id = self.id.present? ? self.id : "nil" + %{#} + end end diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index 086004e..f574066 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -11,7 +11,6 @@ module TrailblazerTestApp class Application < Rails::Application config.load_defaults Rails.gem_version.to_s.split(".")[0..1].join(".") - config.active_record.legacy_connection_handling = false if Rails.gem_version >= Gem::Version.new("6.1") config.cache_classes = true config.eager_load = false config.serve_static_files = false diff --git a/test/dummy/config/database.yml b/test/dummy/config/database.yml index 92b6398..1ca5fe1 100644 --- a/test/dummy/config/database.yml +++ b/test/dummy/config/database.yml @@ -1,11 +1,5 @@ -default: &default +test: adapter: sqlite3 pool: 5 timeout: 5000 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - <<: *default database: db/test.sqlite3 diff --git a/test/integration/artists_controller_test.rb b/test/integration/artists_controller_test.rb index 9e77a81..baa929a 100644 --- a/test/integration/artists_controller_test.rb +++ b/test/integration/artists_controller_test.rb @@ -1,4 +1,5 @@ require "test_helper" +require 'minitest/capybara' class ArtistsControllerTest < Minitest::Capybara::Spec it "cell: Artist::Cell::Dashboard" do diff --git a/test/integration/cells_controller_test.rb b/test/integration/cells_controller_test.rb index ddcc3b1..9a3e522 100644 --- a/test/integration/cells_controller_test.rb +++ b/test/integration/cells_controller_test.rb @@ -1,4 +1,5 @@ require "test_helper" +require 'minitest/capybara' class CellsControllerTest < Minitest::Capybara::Spec it "" do diff --git a/test/integration/songs_controller_test.rb b/test/integration/songs_controller_test.rb index b722aad..72b8c0c 100644 --- a/test/integration/songs_controller_test.rb +++ b/test/integration/songs_controller_test.rb @@ -1,4 +1,5 @@ require "test_helper" +require 'minitest/capybara' class SongsControllerTest < Minitest::Capybara::Spec it "new" do diff --git a/trailblazer-rails.gemspec b/trailblazer-rails.gemspec index 980156c..dedb783 100644 --- a/trailblazer-rails.gemspec +++ b/trailblazer-rails.gemspec @@ -1,6 +1,4 @@ -lib = File.expand_path("lib", __dir__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require "trailblazer/rails/version" +require_relative "lib/trailblazer/rails/version" Gem::Specification.new do |spec| spec.name = "trailblazer-rails" @@ -15,10 +13,11 @@ Gem::Specification.new do |spec| spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) } spec.require_paths = ["lib"] - spec.add_dependency "railties", ">= 5.2.0" + spec.add_dependency "railties", ">= 6.0.0" spec.add_dependency "trailblazer", ">= 2.1.0", "< 2.2.0" spec.add_development_dependency "bundler" spec.add_development_dependency "minitest" spec.add_development_dependency "rake" + spec.add_development_dependency "capybara" end