Skip to content

Commit

Permalink
Merge pull request #74 from AlfonsoUceda/rails8
Browse files Browse the repository at this point in the history
Rails8 is supported
  • Loading branch information
AlfonsoUceda authored Nov 13, 2024
2 parents b4c491f + c0dacb7 commit 7290162
Show file tree
Hide file tree
Showing 26 changed files with 106 additions and 40 deletions.
48 changes: 37 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,65 @@ jobs:
fail-fast: false
matrix:
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
ruby: [2.5, 2.6, 2.7, '3.0', 3.1, 3.2, head]
ruby: [2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, head]
gemfile:
- gemfiles/7.0.gemfile
- gemfiles/8.0.gemfile
- gemfiles/7.2.gemfile
- gemfiles/7.1.gemfile
- gemfiles/6.0.gemfile
- gemfiles/5.2.gemfile
exclude:
- ruby: 2.5
gemfile: gemfiles/7.0.gemfile
gemfile: gemfiles/7.2.gemfile
- ruby: 2.5
gemfile: gemfiles/7.1.gemfile
- ruby: 2.5
gemfile: gemfiles/8.0.gemfile
- ruby: 2.6
gemfile: gemfiles/7.2.gemfile
- ruby: 2.6
gemfile: gemfiles/7.0.gemfile
gemfile: gemfiles/7.1.gemfile
- ruby: 2.6
gemfile: gemfiles/8.0.gemfile
- ruby: 2.7
gemfile: gemfiles/7.2.gemfile
- ruby: 2.7
gemfile: gemfiles/7.1.gemfile
- ruby: 2.7
gemfile: gemfiles/8.0.gemfile
- ruby: 3.0
gemfile: gemfiles/5.2.gemfile
- ruby: 3.0
gemfile: gemfiles/8.0.gemfile
- ruby: 3.0
gemfile: gemfiles/7.2.gemfile
- ruby: 3.1
gemfile: gemfiles/5.2.gemfile
- ruby: 3.1
gemfile: gemfiles/6.0.gemfile
- ruby: 3.1
gemfile: gemfiles/8.0.gemfile
- ruby: 3.2
gemfile: gemfiles/5.2.gemfile
- ruby: 3.2
gemfile: gemfiles/6.0.gemfile
- ruby: 3.3
gemfile: gemfiles/5.2.gemfile
- ruby: 3.3
gemfile: gemfiles/6.0.gemfile
- ruby: head
gemfile: gemfiles/5.2.gemfile
- ruby: head
gemfile: gemfiles/6.0.gemfile

runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

steps:
- uses: actions/checkout@v2
- 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
- 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
13 changes: 10 additions & 3 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
appraise "7.0" do
gem "railties", "~> 7.0.0"
appraise "8.0" do
gem "railties", "~> 8.0.0"
end

appraise "7.2" do
gem "railties", "~> 7.2.0"
end

appraise "7.1" do
gem "railties", "~> 7.1.0"
end

appraise "6.1" do
Expand All @@ -13,4 +21,3 @@ end
appraise "5.2" do
gem "railties", "~> 5.2.0"
end

2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gem "my_engine", path: "test/dummy/engines/my_engine"

group :development, :test do
gem "minitest-spec-rails"
gem "capybara_minitest_spec"
gem "capybara"
end

gem "simple_form"
Expand Down
1 change: 1 addition & 0 deletions cells-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rails'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'sass-rails'
spec.add_development_dependency 'debug'
end
2 changes: 1 addition & 1 deletion gemfiles/5.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem "railties", "~> 5.2.0"

group :development, :test do
gem "minitest-spec-rails"
gem "capybara_minitest_spec"
gem "capybara"
end

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/6.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem "railties", "~> 6.0"

group :development, :test do
gem "minitest-spec-rails"
gem "capybara_minitest_spec"
gem "capybara"
end

gemspec path: "../"
2 changes: 1 addition & 1 deletion gemfiles/6.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem "railties", "~> 6.1.0"

group :development, :test do
gem "minitest-spec-rails"
gem "capybara_minitest_spec"
gem "capybara"
end

gemspec path: "../"
4 changes: 2 additions & 2 deletions gemfiles/7.0.gemfile → gemfiles/7.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ source "https://rubygems.org"
gem "my_engine", path: "../test/dummy/engines/my_engine"
gem "simple_form"
gem "formtastic"
gem "railties", "~> 7.0.0"
gem "railties", "~> 7.1.0"

group :development, :test do
gem "minitest-spec-rails"
gem "capybara_minitest_spec"
gem "capybara"
end

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

source "https://rubygems.org"

gem "my_engine", path: "../test/dummy/engines/my_engine"
gem "simple_form"
gem "formtastic"
gem "railties", "~> 7.2.0"

group :development, :test do
gem "minitest-spec-rails"
gem "capybara"
end

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

source "https://rubygems.org"

gem "my_engine", path: "../test/dummy/engines/my_engine"
gem "simple_form"
gem "formtastic"
gem "railties", "~> 8.0.0"

group :development, :test do
gem "minitest-spec-rails"
gem "capybara"
end

gemspec path: "../"
4 changes: 2 additions & 2 deletions lib/cell/rails/testing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Cell
module RailsExtensions
# This modules overrides Cell::Testing#controller_for and provides Rails-specific logic.
module Testing
RAILS_8_0 = Gem::Version.new("8.0.0")
RAILS_9_0 = Gem::Version.new("9.0.0")
RAILS_5_1 = Gem::Version.new("5.1.0")
RAILS_5_0 = Gem::Version.new("5.0.0")

Expand All @@ -18,7 +18,7 @@ def controller_for(controller_class)
def action_controller_test_request(controller_class)
version = ::Rails.gem_version

if version >= RAILS_5_1 && version < RAILS_8_0
if version >= RAILS_5_1 && version < RAILS_9_0
::ActionController::TestRequest.create(controller_class)
elsif version >= RAILS_5_0 && version < RAILS_5_1
::ActionController::TestRequest.create
Expand Down
4 changes: 2 additions & 2 deletions test/dummy/Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'rails', '~> 7.0.0'
gem 'rails', '~> 8.0.0'

gem "my_engine", path: "engines/my_engine"

Expand All @@ -9,7 +9,7 @@ gem "sprockets"

group :development, :test do
gem "minitest-spec-rails"
gem "capybara_minitest_spec"
gem "capybara"
end

gem "cells", ">= 4.1.6"
Expand Down
4 changes: 2 additions & 2 deletions test/dummy/app/cells/song_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def with_escaped
render
end

def with_title(with_title: '')
"<h1>#{with_title}</h1>"
def with_title(options)
"<h1>#{options[:with_title]}</h1>"
end
# include ActionView::Helpers::AssetUrlHelper
# include Sprockets::Rails::Helper
Expand Down
1 change: 1 addition & 0 deletions test/dummy/config/boot.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'ostruct'
4 changes: 2 additions & 2 deletions test/dummy/test/caching_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def tock
end


class CachingUnitTest < MiniTest::Spec
class CachingUnitTest < Minitest::Spec
before :each do
ActionController::Base.cache_store.clear
ActionController::Base.perform_caching = true
Expand Down Expand Up @@ -115,7 +115,7 @@ class CachingUnitTest < MiniTest::Spec
end


class CachingTest < MiniTest::Spec
class CachingTest < Minitest::Spec
class DirectorCell < Cell::ViewModel
def initialize(counter=0)
super
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/test/context_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "test_helper"

class ContextTest < MiniTest::Spec
class ContextTest < Minitest::Spec
class ParentCell < Cell::ViewModel
def user
context[:user]
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/test/integration/form_for_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "test_helper"

class FormForTestTest < MiniTest::Spec
class FormForTestTest < Minitest::Spec
include Cell::Testing

it do
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/test/integration/form_tag_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "test_helper"

class FormTagTestTest < MiniTest::Spec
class FormTagTestTest < Minitest::Spec
include Cell::Testing
controller SongsController

Expand Down
2 changes: 1 addition & 1 deletion test/dummy/test/integration/formtastic_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "test_helper"

class FormForTestTest < MiniTest::Spec
class FormForTestTest < Minitest::Spec
include Cell::Testing
controller SongsController # provides #url_options.

Expand Down
2 changes: 1 addition & 1 deletion test/dummy/test/integration/simple_form_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "test_helper"

class SimpleFormTest < MiniTest::Spec
class SimpleFormTest < Minitest::Spec
include Cell::Testing
controller SongsController # provides #url_options.

Expand Down
4 changes: 2 additions & 2 deletions test/dummy/test/integration/url_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def show
end
end

class UrlHelperTest < MiniTest::Spec
class UrlHelperTest < Minitest::Spec
include Cell::Testing
controller MusiciansController

Expand All @@ -42,7 +42,7 @@ class UrlTest < ActionDispatch::IntegrationTest
# end
end

class DefaultOptionsTest < MiniTest::Spec
class DefaultOptionsTest < Minitest::Spec
include Cell::Testing
controller WithDefaultOptionsController

Expand Down
2 changes: 1 addition & 1 deletion test/dummy/test/public_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "test_helper"

class PublicTest < MiniTest::Spec
class PublicTest < Minitest::Spec
# ::rails_version
it { _(Cell.rails_version).must_equal Gem::Version.new(ActionPack::VERSION::STRING) }

Expand Down
4 changes: 2 additions & 2 deletions test/dummy/test/rails_extensions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def show
"<b>#{model}</b>"
end

def with_title(with_title: '')
"<h1>#{with_title}</h1><b>#{model}</b>"
def with_title(options)
"<h1>#{options[:with_title]}</h1><b>#{model}</b>"
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/dummy/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'

# MiniTest::Spec.class_eval do
# Minitest::Spec.class_eval do
# after :each do
# # DatabaseCleaner.clean
# Thing.delete_all
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/test/translation_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "test_helper"
require "cell/translation"

class TranslationTest < MiniTest::Spec
class TranslationTest < Minitest::Spec
class I18nCell < Cell::ViewModel
include ActionView::Helpers::TranslationHelper
include Cell::Translation
Expand Down
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require 'cells-rails'
require "cells-erb"
require 'rails'
require 'debug'

require_relative "dummy/config/environment"

Expand Down

0 comments on commit 7290162

Please sign in to comment.