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

Rails8 is supported #74

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Changes from 1 commit
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
Next Next commit
Rails8 is supported
AlfonsoUceda committed Nov 13, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 0c7b467a2ec655b6ca22dbeb6c6d860c0ea8a992
33 changes: 25 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -6,39 +6,56 @@ 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/8.0.gemfile
- gemfiles/7.0.gemfile
- gemfiles/6.0.gemfile
- gemfiles/5.2.gemfile
exclude:
- ruby: 2.5
gemfile: gemfiles/7.0.gemfile
- ruby: 2.5
gemfile: gemfiles/8.0.gemfile
- ruby: 2.6
gemfile: gemfiles/7.0.gemfile
- ruby: 2.6
gemfile: gemfiles/8.0.gemfile
- ruby: 2.7
gemfile: gemfiles/7.0.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.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
5 changes: 4 additions & 1 deletion Appraisals
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
appraise "8.0" do
gem "railties", "~> 8.0.0"
end

appraise "7.0" do
gem "railties", "~> 7.0.0"
end
@@ -13,4 +17,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
@@ -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"
1 change: 1 addition & 0 deletions cells-rails.gemspec
Original file line number Diff line number Diff line change
@@ -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
@@ -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
@@ -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
@@ -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: "../"
2 changes: 1 addition & 1 deletion gemfiles/7.0.gemfile
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ gem "railties", "~> 7.0.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/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
@@ -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")

@@ -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
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"

@@ -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"
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
@@ -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
@@ -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
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]
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
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

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.

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.

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

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

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

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

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) }

1 change: 1 addition & 0 deletions test/dummy/test/rails_extensions_test.rb
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@ def with_title(with_title: '')
end

test "cell(..) with #call keyword args" do
skip("cells 4.1.7 does not support this")
get :view_with_cell_with_call_keyword_args
assert_equal "<h1>test</h1><b>A Tale That Wasn't Right</b>", @response.body
end
2 changes: 1 addition & 1 deletion test/dummy/test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -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
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
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
require 'cells-rails'
require "cells-erb"
require 'rails'
require 'debug'

require_relative "dummy/config/environment"