This commit is contained in:
Sdogruyol 2016-07-17 14:31:45 +03:00
parent 6ffa4af0e1
commit 4edebcf8eb
6 changed files with 12 additions and 13 deletions

View File

@ -51,10 +51,10 @@ describe "Context" do
get "/" do |env|
env.set "key", "value"
{
key: env.get("key"),
before_get: env.get("before_get"),
before_get_int: env.get("before_get_int"),
before_get_float: env.get("before_get_float")
key: env.get("key"),
before_get: env.get("before_get"),
before_get_int: env.get("before_get_int"),
before_get_float: env.get("before_get_float"),
}
end
request = HTTP::Request.new("GET", "/")
@ -68,4 +68,4 @@ describe "Context" do
context.store["before_get_int"].should eq 123
context.store["before_get_float"].should eq 3.5
end
end
end

View File

@ -74,7 +74,7 @@ describe "Macros" do
env.response.headers.add "Content-Type", "image/png"
headers env, {
"Access-Control-Allow-Origin" => "*",
"Content-Type" => "text/plain"
"Content-Type" => "text/plain",
}
end

View File

@ -1,7 +1,6 @@
require "../spec_helper"
describe "Kemal::Middleware::CSRF" do
it "sends GETs to next handler" do
handler = Kemal::Middleware::CSRF.new
request = HTTP::Request.new("GET", "/")
@ -33,7 +32,7 @@ describe "Kemal::Middleware::CSRF" do
request = HTTP::Request.new("POST", "/",
body: "authenticity_token=#{current_token}&hasan=lamec",
headers: HTTP::Headers{"Content-Type" => "application/x-www-form-urlencoded",
"Set-Cookie" => client_response.headers["Set-Cookie"]})
"Set-Cookie" => client_response.headers["Set-Cookie"]})
io, context = process_request(handler, request)
client_response = HTTP::Client::Response.from_io(io, decompress: false)
client_response.status_code.should eq 404
@ -54,8 +53,8 @@ describe "Kemal::Middleware::CSRF" do
request = HTTP::Request.new("POST", "/",
body: "hasan=lamec",
headers: HTTP::Headers{"Content-Type" => "application/x-www-form-urlencoded",
"Set-Cookie" => client_response.headers["Set-Cookie"],
"x-csrf-token" => current_token })
"Set-Cookie" => client_response.headers["Set-Cookie"],
"x-csrf-token" => current_token})
io, context = process_request(handler, request)
client_response = HTTP::Client::Response.from_io(io, decompress: false)
client_response.status_code.should eq 404

View File

@ -166,7 +166,7 @@ describe "Kemal::RouteHandler" do
end
it "sets X-Powered-By to Kemal" do
get "/" {}
get "/" { }
request = HTTP::Request.new("GET", "/")
client_response = call_request_on_app(request)
client_response.headers["X-Powered-By"].should eq("Kemal")

View File

@ -46,7 +46,7 @@ describe "Views" do
client_response = call_request_on_app(request)
client_response.body.should contain("Hello world")
client_response.body.should contain("serdar")
client_response.body.should contain("kemal")
client_response.body.should contain("kemal")
end
it "renders layout with content_for" do

View File

@ -19,7 +19,7 @@ module Kemal
# I hate websites which require daily login so the default
# inactivity timeout is 48 hours.
TTL = 48.hours
TTL = 48.hours
# In-memory, ephemeral datastore only.
#