Sha256: a4a792bc006942e2bb431e5ed80a74710d6629c3667ba94ff26b34f581d32c5e

Contents?: true

Size: 505 Bytes

Versions: 7

Compression:

Stored size: 505 Bytes

Contents

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

test "redirect canonical example" do
  Cuba.define do
    def redirect(*args)
      run Cuba.new { on(true) { res.redirect(*args) }}
    end

    on "account" do
      redirect "/login", 307

      res.write "Super secure content"
    end
  end

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

   _, _, resp = Cuba.call(env)

  assert_equal "/login", resp["Location"]
  assert_equal 307, resp.status
  assert_equal [], resp.body
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cuba-3.0.0.rc2 test/run.rb
cuba-3.0.0.rc1 test/run.rb
cuba-2.2.1 test/run.rb
cuba-2.2.0 test/run.rb
cuba-2.2.0.rc1 test/run.rb
cuba-2.1.0 test/run.rb
cuba-2.1.0.rc1 test/run.rb