Sha256: e885c1fe0c73677eee7f821d23aa082ac60b8cd4902b5c63d16ec27171e83b5c

Contents?: true

Size: 904 Bytes

Versions: 15

Compression:

Stored size: 904 Bytes

Contents

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

describe "redirects" do
  it "should be immediately processed" do
    app do |r|
      r.root do
        r.redirect "/hello"
        "Foo"
      end

      r.is "about" do
        r.redirect "/hello", 301
        "Foo"
      end

      r.is 'foo' do
        r.get do
          r.redirect
        end

        r.post do
          r.redirect
        end
      end
    end

    status.should == 302
    header('Location').should == '/hello'
    body.should == ''

    status("/about").should == 301
    header('Location', "/about").should == '/hello'
    body("/about").should == ''

    status("/foo", 'REQUEST_METHOD'=>'POST').should == 302
    header('Location', "/foo", 'REQUEST_METHOD'=>'POST').should == '/foo'
    body("/foo", 'REQUEST_METHOD'=>'POST').should == ''

    proc{req('/foo')}.should raise_error(Roda::RodaError)
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
roda-2.2.0 spec/redirect_spec.rb
roda-2.1.0 spec/redirect_spec.rb
roda-2.0.0 spec/redirect_spec.rb
roda-1.3.0 spec/redirect_spec.rb
roda-1.2.0 spec/redirect_spec.rb
roda-1.1.0 spec/redirect_spec.rb
roda-cj-1.0.5 spec/redirect_spec.rb
roda-cj-1.0.4 spec/redirect_spec.rb
roda-cj-1.0.3 spec/redirect_spec.rb
roda-cj-1.0.2 spec/redirect_spec.rb
roda-cj-1.0.1 spec/redirect_spec.rb
roda-cj-1.0.0 spec/redirect_spec.rb
roda-1.0.0 spec/redirect_spec.rb
roda-cj-0.9.6 spec/redirect_spec.rb
roda-cj-0.9.5 spec/redirect_spec.rb