Sha256: 9b0f0f83325bafde22cbf6ecbabeb38f0d8d1d4161526b840a1f02fd38f3d507

Contents?: true

Size: 712 Bytes

Versions: 3

Compression:

Stored size: 712 Bytes

Contents

require "spec_helper"

describe Apipie::Extractor::Recorder::Middleware do
  let(:app) { lambda { |env| [200, env, "app"] } }
  let(:stack) { Apipie::Extractor::Recorder::Middleware.new(app) }
  let(:request) { Rack::MockRequest.new(stack) }
  let(:response) { request.get('/') }

  it 'correctly process request without recording' do
    expect(stack).not_to receive(:analyze)
    response
  end

  it "analyze request if recording is set" do
    Apipie.configuration.record = true
    expect(Apipie::Extractor.call_recorder).to receive(:analyse_env)
    expect(Apipie::Extractor.call_recorder).to receive(:analyse_response)
    expect(Apipie::Extractor).to receive(:clean_call_recorder)
    response
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
apipie-rails-0.2.6 spec/lib/extractor/middleware_spec.rb
apipie-rails-0.2.5 spec/lib/extractor/middleware_spec.rb
apipie-rails-0.2.4 spec/lib/extractor/middleware_spec.rb