spec-kemal/spec/spec-kemal_spec.cr

21 lines
503 B
Crystal
Raw Normal View History

2016-12-10 16:55:26 +00:00
require "./spec_helper"
2016-04-09 14:37:46 +00:00
2016-12-10 16:55:26 +00:00
describe "SpecKemalApp" do
it "handles get" do
2017-09-24 14:24:41 +00:00
get "/" do
2016-12-10 16:55:26 +00:00
"Hello world"
end
get "/"
response.body.should eq "Hello world"
end
2016-04-09 14:37:46 +00:00
2016-12-10 16:55:26 +00:00
it "handles post" do
2017-09-24 14:24:41 +00:00
post "/user" do |env|
2016-12-10 16:55:26 +00:00
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