Sha256: 8556492ebb6ba18e45d8d5fd3b0b690e1cfc166304157be143b8634033e6ce93

Contents?: true

Size: 440 Bytes

Versions: 3

Compression:

Stored size: 440 Bytes

Contents

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

test "redirect" do
  Cuba.define do
    on "hello" do
      res.write "hello, world"
    end

    on "" do
      res.redirect "/hello"
    end
  end

  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/" }

  status, headers, body = Cuba.call(env)

  assert_equal status, 302
  assert_equal headers, {"Content-Type"=>"text/html", "Location"=>"/hello"}
  assert_response body, []
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cuba-3.0.0 test/redirect.rb
cuba-3.0.0.rc5 test/redirect.rb
cuba-3.0.0.rc4 test/redirect.rb