Sha256: e2fa1b660a08787a5c3974a76fbd9f94751f044f4da555e69376bb4a46e68c0b

Contents?: true

Size: 510 Bytes

Versions: 5

Compression:

Stored size: 510 Bytes

Contents

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

test "redirect canonical example" do
  Cuba.define do
    def redirect(*args)
      run Cuba::Ron.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

5 entries across 5 versions & 1 rubygems

Version Path
cuba-2.0.1 test/run.rb
cuba-2.0.0 test/run.rb
cuba-2.0.0.rc3 test/run.rb
cuba-2.0.0.rc2 test/run.rb
cuba-2.0.0.rc1 test/run.rb