forked from Bailador/Bailador
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First cut at Bailador::Test, add some very basic tests too
- Loading branch information
Tadeusz Sośnierz
committed
Apr 7, 2012
1 parent
774bd83
commit 55fe612
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module Bailador::Test; | ||
|
||
use Test; | ||
use Bailador::App; | ||
|
||
sub route-exists($meth, $path, $desc = '') is export { | ||
my $req = Bailador::Request.new_for_request($meth, $path); | ||
ok Bailador::App.current.find_route($req), $desc; | ||
} | ||
|
||
sub route-doesnt-exist($meth, $path, $desc = '') is export { | ||
my $req = Bailador::Request.new_for_request($meth, $path); | ||
ok !Bailador::App.current.find_route($req), $desc; | ||
} | ||
|
||
sub response-status-is($meth, $path, $status, $desc) is export { ... } | ||
sub response-status-isnt($meth, $path, $status, $desc) is export { ... } | ||
|
||
sub response-content-is($meth, $path, $cont, $desc) is export { ... } | ||
sub response-content-isnt($meth, $path, $cont, $desc) is export { ... } | ||
sub response-content-is-deeply($meth, $path, $cont, $desc) is export { ... } | ||
sub response-content-like($meth, $path, $cont, $desc) is export { ... } | ||
sub response-content-unlike($meth, $path, $cont, $desc) is export { ... } | ||
|
||
sub response-headers-are-deeply($meth, $path, $cont, $desc) is export { ... } | ||
sub response-headers-include($meth, $path, $cont, $desc) is export { ... } | ||
|
||
sub bailador-response($meth, $path, *%opts) is export { ... } | ||
|
||
sub read-logs is export { ... } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use Test; | ||
use Bailador; | ||
use Bailador::Test; | ||
|
||
plan 4; | ||
|
||
get '/foo' => sub { } | ||
post '/bar' => sub { } | ||
|
||
route-exists('GET', '/foo'); | ||
route-doesnt-exist('POST', '/foo'); | ||
|
||
route-exists('POST', '/bar'); | ||
route-doesnt-exist('GET', '/bar'); |