Skip to content

Commit

Permalink
Remove some more code added to support older versions
Browse files Browse the repository at this point in the history
Also change back to run CI on ubuntu-latest which should work with all
Ruby versions supported now.
  • Loading branch information
carlosantoniodasilva committed Oct 13, 2023
1 parent 72b421e commit 49e4a99
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 46 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ jobs:
ruby: '3.1'
- gemfile: gemfiles/Gemfile-rails-6-0
env: DEVISE_ORM=mongoid
# TODO: lock `ubunty-20.04` due to older Ruby version compatibility, change to `ubuntu-latest` again when dropping older Ruby support.
# https://github.com/ruby/setup-ruby/issues/496#issuecomment-1520662740
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
steps:
Expand All @@ -45,8 +43,6 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs bundle install and caches installed gems automatically
bundler: ${{ env.BUNDLER_VERSION || 'default' }}
rubygems: ${{ env.RUBYGEMS_VERSION || 'latest' }}
- uses: supercharge/[email protected]
if: ${{ matrix.env == 'DEVISE_ORM=mongoid' }}
- run: bundle exec rake
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ Unlike controller tests, integration tests do not need to supply the
`devise.mapping` `env` value, as the mapping can be inferred by the routes that
are executed in your tests.

You can read more about testing your Rails 3 - Rails 4 controllers with RSpec in the wiki:
You can read more about testing your Rails controllers with RSpec in the wiki:

* https://github.com/heartcombo/devise/wiki/How-To:-Test-controllers-with-Rails-(and-RSpec)

Expand Down
19 changes: 7 additions & 12 deletions bin/test
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
#!/usr/bin/env ruby
$: << File.expand_path(File.expand_path('../../test', __FILE__))

# Remove this begin/rescue once Rails 4 support is removed.
begin
require 'bundler/setup'
require 'rails/test_unit/runner'
require 'rails/test_unit/reporter'
require 'rails/test_unit/line_filtering'
require 'bundler/setup'
require 'rails/test_unit/runner'
require 'rails/test_unit/reporter'
require 'rails/test_unit/line_filtering'

Rails::TestUnitReporter.executable = 'bin/test'
Rails::TestUnitReporter.executable = 'bin/test'

Rails::TestUnit::Runner.parse_options(ARGV)
Rails::TestUnit::Runner.run(ARGV)
rescue LoadError
exec 'rake'
end
Rails::TestUnit::Runner.parse_options(ARGV)
Rails::TestUnit::Runner.run(ARGV)
12 changes: 0 additions & 12 deletions test/rails_app/app/controllers/streaming_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,4 @@ class StreamingController < ApplicationController
def index
render body: 'Index'
end

# Work around https://github.com/heartcombo/devise/issues/2332, which affects
# tests in Rails 4.x (and affects production in Rails >= 5)
def process(name)
super(name)
rescue ArgumentError => e
if e.message == 'uncaught throw :warden'
throw :warden
else
raise e
end
end
end
16 changes: 0 additions & 16 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,6 @@
if ActiveSupport.respond_to?(:test_order)
ActiveSupport.test_order = :random
end
class ActiveSupport::TestCase
if ActiveSupport.version < Gem::Version.new("5.0")
def assert_deprecated(match, deprecator)
super(match) do
# TODO: remove extra begin..end when dropping support for Ruby <= 2.4
begin
behavior = deprecator.behavior
deprecator.behavior = ActiveSupport::Deprecation.behavior
yield
ensure
deprecator.behavior = behavior
end
end
end
end
end

OmniAuth.config.logger = Logger.new('/dev/null')

Expand Down

0 comments on commit 49e4a99

Please sign in to comment.