Sha256: b42323e17287634b584cdd92e23064b928acb345da5429c98765b6693defeb22

Contents?: true

Size: 938 Bytes

Versions: 4

Compression:

Stored size: 938 Bytes

Contents

module Shoulda
  module Matchers
    module Integrations
      module Libraries
        # @private
        class ActionController
          Integrations.register_library(self, :action_controller)

          include Integrations::Inclusion
          include Integrations::Rails

          def integrate_with(test_framework)
            test_framework.include(matchers_module, type: :controller)

            tap do |instance|
              ActiveSupport.on_load(:action_controller_test_case, run_once: true) do
                instance.include_into(::ActionController::TestCase, instance.matchers_module) do
                  def subject # rubocop:disable Lint/NestedMethodDefinition
                    @controller
                  end
                end
              end
            end
          end

          def matchers_module
            Shoulda::Matchers::ActionController
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shoulda-matchers-6.4.0 lib/shoulda/matchers/integrations/libraries/action_controller.rb
shoulda-matchers-6.3.1 lib/shoulda/matchers/integrations/libraries/action_controller.rb
shoulda-matchers-6.3.0 lib/shoulda/matchers/integrations/libraries/action_controller.rb
shoulda-matchers-6.2.0 lib/shoulda/matchers/integrations/libraries/action_controller.rb