Skip to content

Commit 387f5ef

Browse files
committed
update to 0.19.4
1 parent 14d8e87 commit 387f5ef

File tree

5 files changed

+28
-24
lines changed

5 files changed

+28
-24
lines changed

shard.lock

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ shards:
66

77
kemalyst:
88
github: drujensen/kemalyst
9-
commit: 0c1933e326a774fc8dc56409628102f8abcdf397
9+
commit: d5c238029a0d7b1e2e1d80cd29d66a580105b3fc
1010

1111
kemalyst-model:
1212
github: drujensen/kemalyst-model
13-
commit: c95c53bed98ee0fb963cca804806ce23cf75db0c
13+
commit: 5185a33176a6196e20f76cd4a244bd04dce8bdc2
1414

1515
kemalyst-validators:
1616
github: drujensen/kemalyst-validators
@@ -22,13 +22,17 @@ shards:
2222

2323
mocks:
2424
github: waterlink/mocks.cr
25-
version: 0.8.0
25+
commit: 6e7f0203158ba09a466d84e23375bc6ebd4c36c7
2626

2727
pg:
2828
github: will/crystal-pg
29-
commit: cafe3e90b4a239aa9819482543c63503a6a3f477
29+
commit: cafe0b858007ad09ee67253c90d41ed7647628c4
3030

3131
pool:
3232
github: ysbaddaden/pool
3333
commit: c4ecfad1b87fbd8c6484d1fd536ccfd14c40cc94
3434

35+
singleton:
36+
github: waterlink/singleton.cr
37+
version: 0.1.1
38+

shard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ dependencies:
1717
development_dependencies:
1818
mocks:
1919
github: waterlink/mocks.cr
20-
version: 0.8.0
20+
branch: master

spec/controllers/post_controller_spec.cr

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
require "./spec_helper"
22

33
Mocks.create_mock Post do
4-
mock self.all(query), :inherited
5-
mock self.find(id), :inherited
6-
mock save(), :inherited
7-
mock destroy(), :inherited
4+
mock self.all(query)
5+
mock self.find(id)
6+
mock save()
7+
mock destroy()
88
end
99

1010
describe PostController::Index do
@@ -15,8 +15,8 @@ describe PostController::Index do
1515
allow(Post).to receive(self.all("ORDER BY created_at DESC")).and_return([sample_post])
1616

1717
request = HTTP::Request.new("GET", "/posts")
18-
io, context = create_context(request)
19-
response = PostController::Index.instance.call(context) as String
18+
io, context = create_context(request)
19+
response = PostController::Index.instance.call(context).as(String)
2020
response.should contain "sample post"
2121
end
2222

@@ -30,9 +30,9 @@ describe PostController::Show do
3030
allow(Post).to receive(self.find("1")).and_return(sample_post)
3131

3232
request = HTTP::Request.new("GET", "/posts/1")
33-
io, context = create_context(request)
33+
io, context = create_context(request)
3434
context.params["id"] = "1"
35-
response = PostController::Show.instance.call(context) as String
35+
response = PostController::Show.instance.call(context).as(String)
3636
response.should contain "sample post"
3737
end
3838

@@ -42,9 +42,9 @@ describe PostController::New do
4242

4343
it "displays form to create a new post when authorized" do
4444
request = HTTP::Request.new("GET", "/posts/new")
45-
io, context = create_context(request)
45+
io, context = create_context(request)
4646
context.session["authorized"] = "true"
47-
response = PostController::New.instance.call(context) as String
47+
response = PostController::New.instance.call(context).as(String)
4848
response.should contain "<h1>New Post</h1>"
4949
end
5050

@@ -54,7 +54,7 @@ describe PostController::Create do
5454

5555
it "creates a new post when authorized" do
5656
request = HTTP::Request.new("POST", "/posts/create")
57-
io, context = create_context(request)
57+
io, context = create_context(request)
5858
context.session["authorized"] = "true"
5959
context.params["name"] = "new post"
6060
context.params["body"] = "new post body"
@@ -78,10 +78,10 @@ describe PostController::Edit do
7878
allow(Post).to receive(self.find("1")).and_return(sample_post)
7979

8080
request = HTTP::Request.new("GET", "/posts/1/edit")
81-
io, context = create_context(request)
81+
io, context = create_context(request)
8282
context.session["authorized"] = "true"
8383
context.params["id"] = "1"
84-
response = PostController::Edit.instance.call(context) as String
84+
response = PostController::Edit.instance.call(context).as(String)
8585
response.should contain "<h1>Edit Post</h1>"
8686
end
8787

src/controllers/post_controller.cr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ module PostController
3939
authorized = context.session.has_key?("authorized")
4040
if authorized
4141
if post = Post.new
42-
post.name = context.params["name"] as String
43-
post.body = context.params["body"] as String
42+
post.name = context.params["name"].as(String)
43+
post.body = context.params["body"].as(String)
4444
post.save()
4545
end
4646
end
@@ -71,8 +71,8 @@ module PostController
7171
if authorized
7272
id = context.params["id"]
7373
if post = ::Post.find(id)
74-
post.name = context.params["name"] as String
75-
post.body = context.params["body"] as String
74+
post.name = context.params["name"].as(String)
75+
post.body = context.params["body"].as(String)
7676
post.save
7777
else
7878
html "Post with id:#{id} could not be found", 404

src/controllers/session_controller.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ module SessionController
1515
username = context.params["username"]
1616
password = context.params["password"]
1717

18-
puts "Encrypted Password: #{Crypto::MD5.hex_digest(password as String)}"
19-
if username == "admin" && Crypto::MD5.hex_digest(password as String) == "5f4dcc3b5aa765d61d8327deb882cf99"
18+
puts "Encrypted Password: #{Crypto::MD5.hex_digest(password.as(String))}"
19+
if username == "admin" && Crypto::MD5.hex_digest(password.as(String)) == "5f4dcc3b5aa765d61d8327deb882cf99"
2020
context.session["authorized"] = "true"
2121
end
2222
redirect "/"

0 commit comments

Comments
 (0)