Sha256: 18dc52985aebeca6b366f930a6cfe4bd11bd9932dc376d2edc99b345a78569ed

Contents?: true

Size: 500 Bytes

Versions: 1

Compression:

Stored size: 500 Bytes

Contents

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

test "set status and headers through helper" do
  Cuba.define do
    on "users" do
      as do
        render "test/fixtures/csrf.erb"
      end
    end
  end

  env = { "SCRIPT_NAME" => "/", "PATH_INFO" => "/users", 'rack.session' => {} }

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

  assert env.fetch("rack.session").has_key?("csrf.token")
  assert /_csrf/ =~ resp.body.first
  assert_equal 44, env.fetch("rack.session").fetch("csrf.token").size
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cuba-sugar-0.2.1 test/csrf.rb