Sha256: 7279eb88e3cb11314c95c0f3efa99b4eb874d0286e0328ec8baad9b16b7f8cde

Contents?: true

Size: 700 Bytes

Versions: 4

Compression:

Stored size: 700 Bytes

Contents

class Gon
  module SpecHelper
    module Rails
      extend ActiveSupport::Concern

      module ClassMethods
        module GonSession
          def process(*)
            # preload threadlocal & store controller instance
            if controller.is_a? ActionController::Base
              controller.gon
              Gon.send(:current_gon).env[Gon::EnvFinder::ENV_CONTROLLER_KEY] =
               controller
            end
            super
          end
        end

        def new(*)
          super.extend(GonSession)
        end
      end
    end
  end
end

if defined?(ActionController::TestCase::Behavior)
  ActionController::TestCase::Behavior.send :include, Gon::SpecHelper::Rails
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gon-6.2.0 lib/gon/spec_helpers.rb
gon-6.1.0 lib/gon/spec_helpers.rb
gon-6.0.1 lib/gon/spec_helpers.rb
gon-6.0.0 lib/gon/spec_helpers.rb