0.4.0
This commit is contained in:
parent
37925cf90c
commit
555804d29a
7 changed files with 35 additions and 19 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
|||
/doc/
|
||||
/libs/
|
||||
/lib/
|
||||
/.crystal/
|
||||
/.shards/
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ shards:
|
|||
|
||||
multipart:
|
||||
github: RX14/multipart.cr
|
||||
version: 0.1.0
|
||||
version: 0.1.1
|
||||
|
||||
radix:
|
||||
github: luislavena/radix
|
||||
version: 0.3.1
|
||||
version: 0.3.5
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
name: spec-kemal
|
||||
version: 0.2.0
|
||||
version: 0.3.0
|
||||
|
||||
development_dependencies:
|
||||
kemal:
|
||||
github: sdogruyol/kemal
|
||||
branch: v0.16.1
|
||||
branch: v0.17.3
|
||||
|
||||
authors:
|
||||
- Sdogruyol <dogruyolserdar@gmail.com>
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
# require "./spec_helper"
|
||||
require "./spec_helper"
|
||||
|
||||
# describe "SpecKemalApp" do
|
||||
# it "handles get" do
|
||||
# get "/"
|
||||
# response.body.should eq "Hello world"
|
||||
# end
|
||||
describe "SpecKemalApp" do
|
||||
it "handles get" do
|
||||
Kemal::RouteHandler::INSTANCE.add_route "GET", "/" do
|
||||
"Hello world"
|
||||
end
|
||||
get "/"
|
||||
response.body.should eq "Hello world"
|
||||
end
|
||||
|
||||
# it "handles post" do
|
||||
# json_body = {"name": "Serdar", "age": 27, "skills": ["crystal, kemal"]}
|
||||
# post("/user", headers: HTTP::Headers{"Content-Type" => "application/json"}, body: json_body.to_json)
|
||||
# response.body.should eq(json_body.to_json)
|
||||
# end
|
||||
# end
|
||||
it "handles post" do
|
||||
Kemal::RouteHandler::INSTANCE.add_route "POST", "/user" do |env|
|
||||
env.params.json.to_json
|
||||
end
|
||||
json_body = {"name": "Serdar", "age": 27, "skills": ["crystal, kemal"]}
|
||||
post("/user", headers: HTTP::Headers{"Content-Type" => "application/json"}, body: json_body.to_json)
|
||||
response.body.should eq(json_body.to_json)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
require "spec"
|
||||
require "kemal"
|
||||
require "../src/spec-kemal"
|
||||
|
||||
Spec.before_each do
|
||||
config = Kemal.config
|
||||
config.env = "test"
|
||||
config.setup
|
||||
end
|
||||
|
||||
Spec.after_each do
|
||||
Kemal.config.clear
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ end
|
|||
{% end %}
|
||||
|
||||
def process_request(request)
|
||||
io = MemoryIO.new
|
||||
io = IO::Memory.new
|
||||
response = HTTP::Server::Response.new(io)
|
||||
context = HTTP::Server::Context.new(request, response)
|
||||
main_handler = build_main_handler
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module Spec::Kemal
|
||||
VERSION = "0.2.0"
|
||||
VERSION = "0.3.0"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue