Sha256: 7224c1d6b807bfec570b6bc8d3198df5d73a3d7c67912e1046347986adc39553

Contents?: true

Size: 779 Bytes

Versions: 28

Compression:

Stored size: 779 Bytes

Contents

require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))

describe "head plugin" do 
  it "considers HEAD requests as GET requests which return no body" do
    app(:head) do |r|
      r.root do
        'root'
      end

      r.get 'a' do
        'a'
      end

      r.is 'b', :method=>[:get, :post] do
        'b'
      end
    end

    s, h, b = req
    s.must_equal 200
    h['Content-Length'].must_equal '4'
    b.must_equal ['root']

    s, h, b = req('REQUEST_METHOD' => 'HEAD')
    s.must_equal 200
    h['Content-Length'].must_equal '4'
    b.must_equal []

    body('/a').must_equal 'a'
    status('/a', 'REQUEST_METHOD' => 'HEAD').must_equal 200

    body('/b').must_equal 'b'
    status('/b', 'REQUEST_METHOD' => 'HEAD').must_equal 200
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
roda-2.29.0 spec/plugin/head_spec.rb
roda-2.28.0 spec/plugin/head_spec.rb
roda-2.27.0 spec/plugin/head_spec.rb
roda-2.26.0 spec/plugin/head_spec.rb
roda-2.25.0 spec/plugin/head_spec.rb
roda-2.24.0 spec/plugin/head_spec.rb
roda-2.23.0 spec/plugin/head_spec.rb
roda-2.22.0 spec/plugin/head_spec.rb
roda-2.21.0 spec/plugin/head_spec.rb
roda-2.20.0 spec/plugin/head_spec.rb
roda-2.19.0 spec/plugin/head_spec.rb
roda-2.18.0 spec/plugin/head_spec.rb
roda-2.17.0 spec/plugin/head_spec.rb
roda-2.16.0 spec/plugin/head_spec.rb
roda-2.15.0 spec/plugin/head_spec.rb
roda-2.14.0 spec/plugin/head_spec.rb
roda-2.13.0 spec/plugin/head_spec.rb
roda-2.12.0 spec/plugin/head_spec.rb
roda-2.11.0 spec/plugin/head_spec.rb
roda-2.10.0 spec/plugin/head_spec.rb