summaryrefslogtreecommitdiff
path: root/test/spec_lock.rb
blob: 1a745eec9a4ab70f4524f5c2089513918b4a0444 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

require_relative 'helper'

describe Rack::Lock do
  it "constructs lock when builder is multithreaded" do
    builder = Rack::Builder.new(nil, multithread: true) do
      use Rack::Lock
    end

    app = builder.to_app
    app.must_be_kind_of Rack::Lock::Wrapper
  end

  it "ignores lock when builder is not multithreaded" do
    builder = Rack::Builder.new(nil, multithread: false) do
      use Rack::Lock
    end

    app = builder.to_app
    app.must_be_nil
  end
end