File: spec_rack_config.rb

package info (click to toggle)
librack-ruby 1.1.0-4%2Bsqueeze3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 3,204 kB
  • ctags: 1,101
  • sloc: ruby: 8,704; makefile: 9
file content (24 lines) | stat: -rw-r--r-- 584 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'test/spec'
require 'rack/mock'
require 'rack/builder'
require 'rack/content_length'
require 'rack/config'

context "Rack::Config" do

  specify "should accept a block that modifies the environment" do
    app = Rack::Builder.new do
      use Rack::Lint
      use Rack::ContentLength
      use Rack::Config do |env|
        env['greeting'] = 'hello'
      end
      run lambda { |env|
        [200, {'Content-Type' => 'text/plain'}, [env['greeting'] || '']]
      }
    end
    response = Rack::MockRequest.new(app).get('/')
    response.body.should.equal('hello')
  end

end