Skip to content

Commit

Permalink
0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sdogruyol committed Dec 10, 2016
1 parent 37925cf commit 555804d
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/doc/
/libs/
/lib/
/.crystal/
/.shards/

Expand Down
4 changes: 2 additions & 2 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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

4 changes: 2 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
Expand Down
30 changes: 18 additions & 12 deletions spec/spec-kemal_spec.cr
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions spec/spec_helper.cr
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/spec-kemal.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/spec-kemal/version.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Spec::Kemal
VERSION = "0.2.0"
VERSION = "0.3.0"
end

0 comments on commit 555804d

Please sign in to comment.