Sha256: 8bc32611f37b6afdcf644a00eabcb5414db72131a6fe5ae30cc7a608e46bfe8a

Contents?: true

Size: 695 Bytes

Versions: 4

Compression:

Stored size: 695 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::Base::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-5.2.3 lib/gon/spec_helpers.rb
gon-5.2.2 lib/gon/spec_helpers.rb
gon-5.2.1 lib/gon/spec_helpers.rb
gon-5.2.0 lib/gon/spec_helpers.rb