Skip to content

Commit 555804d

Browse files
committed
0.4.0
1 parent 37925cf commit 555804d

File tree

7 files changed

+35
-19
lines changed

7 files changed

+35
-19
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/doc/
2-
/libs/
2+
/lib/
33
/.crystal/
44
/.shards/
55

shard.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ shards:
1010

1111
multipart:
1212
github: RX14/multipart.cr
13-
version: 0.1.0
13+
version: 0.1.1
1414

1515
radix:
1616
github: luislavena/radix
17-
version: 0.3.1
17+
version: 0.3.5
1818

shard.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: spec-kemal
2-
version: 0.2.0
2+
version: 0.3.0
33

44
development_dependencies:
55
kemal:
66
github: sdogruyol/kemal
7-
branch: v0.16.1
7+
branch: v0.17.3
88

99
authors:
1010
- Sdogruyol <[email protected]>

spec/spec-kemal_spec.cr

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
# require "./spec_helper"
1+
require "./spec_helper"
22

3-
# describe "SpecKemalApp" do
4-
# it "handles get" do
5-
# get "/"
6-
# response.body.should eq "Hello world"
7-
# end
3+
describe "SpecKemalApp" do
4+
it "handles get" do
5+
Kemal::RouteHandler::INSTANCE.add_route "GET", "/" do
6+
"Hello world"
7+
end
8+
get "/"
9+
response.body.should eq "Hello world"
10+
end
811

9-
# it "handles post" do
10-
# json_body = {"name": "Serdar", "age": 27, "skills": ["crystal, kemal"]}
11-
# post("/user", headers: HTTP::Headers{"Content-Type" => "application/json"}, body: json_body.to_json)
12-
# response.body.should eq(json_body.to_json)
13-
# end
14-
# end
12+
it "handles post" do
13+
Kemal::RouteHandler::INSTANCE.add_route "POST", "/user" do |env|
14+
env.params.json.to_json
15+
end
16+
json_body = {"name": "Serdar", "age": 27, "skills": ["crystal, kemal"]}
17+
post("/user", headers: HTTP::Headers{"Content-Type" => "application/json"}, body: json_body.to_json)
18+
response.body.should eq(json_body.to_json)
19+
end
20+
end

spec/spec_helper.cr

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
require "spec"
22
require "kemal"
33
require "../src/spec-kemal"
4+
5+
Spec.before_each do
6+
config = Kemal.config
7+
config.env = "test"
8+
config.setup
9+
end
10+
11+
Spec.after_each do
12+
Kemal.config.clear
13+
end

src/spec-kemal.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ end
2222
{% end %}
2323

2424
def process_request(request)
25-
io = MemoryIO.new
25+
io = IO::Memory.new
2626
response = HTTP::Server::Response.new(io)
2727
context = HTTP::Server::Context.new(request, response)
2828
main_handler = build_main_handler

src/spec-kemal/version.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Spec::Kemal
2-
VERSION = "0.2.0"
2+
VERSION = "0.3.0"
33
end

0 commit comments

Comments
 (0)