Module: Lurker::SpecHelper::Rails::ClassMethods::LurkerSession

Defined in:
lib/lurker/spec_helper/rails.rb

Instance Method Summary collapse

Instance Method Details

#processObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/lurker/spec_helper/rails.rb', line 11

def process(*)
  super.tap do
    if Lurker::Spy.enabled?
      [:@request, :@response].each do |iv_name|
        if !instance_variable_defined?(iv_name) || instance_variable_get(iv_name).nil?
          raise Lurker::Spy::BlindError.new("#{iv_name} is nil: make sure you set it in your test's setup method.")
        end
      end

      Lurker::Spy.current.request  = Lurker::Request.build_from_action_dispatch(@request)
      Lurker::Spy.current.response = Lurker::Response.build_from_action_dispatch(@response)
    end
  end
end