Sha256: fb01f46719b5d5b0eb5c7c6bf227f18c574599df7b068e587d27cd589e6dec09

Contents?: true

Size: 956 Bytes

Versions: 3

Compression:

Stored size: 956 Bytes

Contents

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

describe "not_allowed plugin" do 
  it "skips the current block if pass is called" do
    app(:not_allowed) do |r|
      r.get '' do
        'a'
      end

      r.is "c" do
        r.get do
          "cg"
        end

        r.post do
          "cp"
        end

        "c"
      end

      r.get do
        r.is 'b' do
          'b'
        end
      end
    end

    body.should == 'a'
    status('REQUEST_METHOD'=>'POST').should == 405
    header('Allow', 'REQUEST_METHOD'=>'POST').should == 'GET'

    body('/b').should == 'b'
    status('/b', 'REQUEST_METHOD'=>'POST').should == 404

    body('/c').should == 'cg'
    body('/c', 'REQUEST_METHOD'=>'POST').should == 'cp'
    body('/c', 'REQUEST_METHOD'=>'PATCH').should == 'c'
    status('/c', 'REQUEST_METHOD'=>'PATCH').should == 405
    header('Allow', '/c', 'REQUEST_METHOD'=>'PATCH').should == 'GET, POST'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
roda-cj-0.9.6 spec/plugin/not_allowed_spec.rb
roda-cj-0.9.5 spec/plugin/not_allowed_spec.rb
roda-cj-0.9.4 spec/plugin/not_allowed_spec.rb