Sha256: f87a198f29f780287a28c0b484983532ee599ce2bf161b2c6dcee5a8fc394aec

Contents?: true

Size: 535 Bytes

Versions: 5

Compression:

Stored size: 535 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class LoadHooksControllerTest < Devise::ControllerTestCase
  setup do
    ActiveSupport.on_load(:devise_controller) do
      define_method :defined_by_load_hook do
        puts 'I am defined dynamically by activesupport load hook'
      end
    end
  end

  teardown do
    DeviseController.class_eval { undef :defined_by_load_hook }
  end

  test 'load hook called when controller is loaded' do
    assert DeviseController.instance_methods.include? :defined_by_load_hook
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
devise-4.5.0 test/controllers/load_hooks_controller_test.rb
devise-4.4.3 test/controllers/load_hooks_controller_test.rb
devise-4.4.2 test/controllers/load_hooks_controller_test.rb
devise-4.4.1 test/controllers/load_hooks_controller_test.rb
devise-4.4.0 test/controllers/load_hooks_controller_test.rb