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

chore: Add Rails 7.1 #70

Merged
merged 1 commit into from
Nov 27, 2023
Merged

chore: Add Rails 7.1 #70

merged 1 commit into from
Nov 27, 2023

Conversation

MrSerth
Copy link
Member

@MrSerth MrSerth commented Nov 24, 2023

This PR adds support for Rails 7.1.

⚠️ While the test suite passes, the changes made here are not enough.

Consider the following example:

Failing example

# frozen_string_literal: true

require 'bundler/inline'

gemfile(true) do
  source 'https://rubygems.org'

  git_source(:github) {|repo| "https://github.com/#{repo}.git" }

  gem 'mnemosyne-ruby'
  gem 'rails', '~> 7.1.0'
end

require 'rack/test'
require 'action_controller/railtie'

class TestApp < Rails::Application
  config.root = __dir__
  config.hosts << 'example.org'
  config.session_store :cookie_store, key: 'cookie_store_key'
  config.secret_key_base = 'secret_key_base'

  mnemosyne_config = ::Mnemosyne::Configuration.new('server' => 'amqp://localhost', 'application' => 'TestApp',
    'hostname' => 'example.org')
  config.middleware.insert 0, ::Mnemosyne::Middleware::Rack
  ::Mnemosyne::Instrumenter.start!(mnemosyne_config)

  config.logger = Logger.new($stdout)
  Rails.logger  = config.logger

  routes.draw do
    get '/' => 'test#index'
  end
end

class TestController < ActionController::Base
  include Rails.application.routes.url_helpers

  def index
    render plain: 'Home'
  end
end

require 'minitest/autorun'

class BugTest < Minitest::Test
  include Rack::Test::Methods

  def test_returns_success
    get '/'
    assert last_response.ok?
  end

  def test_returns_not_found
    get '/not_found'
    assert last_response.not_found?
  end

  private

  def app
    Rails.application
  end
end

Executing this script (just by invoking it with ruby <filename>) will fail for Rails 7.1. If tested against Rails 7.0 (changing gem 'rails', '~> 7.1.0' to gem 'rails', '~> 7.0.0'), everything works fine.

Unfortunately, I won't be able to follow-up further, but thought it would be nice to include official Rails 7.1 support for this gem.

MrSerth added a commit to openHPI/codeocean that referenced this pull request Nov 24, 2023
MrSerth added a commit to openHPI/codeharbor that referenced this pull request Nov 24, 2023
MrSerth added a commit to openHPI/codeharbor that referenced this pull request Nov 24, 2023
@jgraichen jgraichen marked this pull request as ready for review November 27, 2023 16:17
@jgraichen jgraichen merged commit 837afa9 into main Nov 27, 2023
132 checks passed
@jgraichen jgraichen deleted the rails-71 branch November 27, 2023 16:18
zuhrasofyan pushed a commit to openHPI/codeharbor that referenced this pull request Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants