Don't spawn, build handlers instead
This commit is contained in:
parent
fee1b2b7c0
commit
e232dde74a
5 changed files with 43 additions and 54 deletions
|
@ -1,16 +1,14 @@
|
|||
require "./spec_helper"
|
||||
# require "./spec_helper"
|
||||
|
||||
describe "SpecKemalApp" do
|
||||
start
|
||||
# describe "SpecKemalApp" do
|
||||
# it "handles get" do
|
||||
# get "/"
|
||||
# response.body.should eq "Hello world"
|
||||
# end
|
||||
|
||||
it "handles get" do
|
||||
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
|
||||
# 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,16 +1,3 @@
|
|||
require "spec"
|
||||
require "kemal"
|
||||
require "../src/spec-kemal"
|
||||
|
||||
# Create a dummy app
|
||||
get "/" do
|
||||
"Hello world"
|
||||
end
|
||||
|
||||
post "/user" do |env|
|
||||
env.response.content_type = "application/json"
|
||||
name = env.params.json["name"]
|
||||
age = env.params.json["age"]
|
||||
skills = env.params.json["skills"]
|
||||
{"name": name, "age": age, "skills": skills}.to_json
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue