diff options
author | franck cuny <franck@lumberjaph.net> | 2010-10-03 11:40:37 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-10-03 11:40:37 +0200 |
commit | 6d2835f444a59a09a85866af6c9ed3f10c0e0a9b (patch) | |
tree | 7dd7c93d0427101d254c1e9a6a8b5e4a5bbf0556 /t | |
parent | update scripts to use dbic; chmod build-failed (diff) | |
download | jitterbug-6d2835f444a59a09a85866af6c9ed3f10c0e0a9b.tar.gz |
update config, view, tests
Diffstat (limited to 't')
-rw-r--r-- | t/003_hook_route.t | 59 | ||||
-rw-r--r-- | t/data/test.yaml | 3 |
2 files changed, 32 insertions, 30 deletions
diff --git a/t/003_hook_route.t b/t/003_hook_route.t index 9929553..b9d7e1f 100644 --- a/t/003_hook_route.t +++ b/t/003_hook_route.t @@ -1,43 +1,44 @@ -use Test::More tests => 1; +use Test::More tests => 4; use strict; use warnings; -ok 1; -#use jitterbug; -#use JSON; -#use YAML qw/LoadFile/; -#use Dancer::Test; -#use Dancer::Config qw/setting/; +#ok 1; +use jitterbug; +use JSON; +use YAML qw/LoadFile/; +use Dancer::Test; +use Dancer::Config qw/setting/; -#my $content = LoadFile('t/data/test.yaml'); +my $content = LoadFile('t/data/test.yaml'); -#setting jitterbug => { namespace => 'jitterbug_test' }; +setting jitterbug => { namespace => 'jitterbug_test' }; -#route_exists [ POST => '/hook/' ], 'a route handle is defined for /'; +route_exists [ POST => '/hook/' ], 'a route handle is defined for /'; -#my $response; +my $response; -#{ - #$response = dancer_response( POST => '/hook', ); - #is $response->{status}, 200, '200 with empty post'; -#} +{ + $response = dancer_response( POST => '/hook', ); + is $response->{status}, 200, '200 with empty post'; +} -#{ - #my $payload = "payload=" . JSON::encode_json($content); +{ + my $payload = "payload=" . JSON::encode_json($content); #open my $in, '<', \$payload; #$ENV{'CONTENT_LENGTH'} = length($payload); #$ENV{'CONTENT_TYPE'} = 'application/x-www-form-urlencoded'; #$ENV{'psgi.input'} = $in; - #$response = dancer_response( - #POST => '/hook/', - #{ - #headers => [ 'Content-Length' => length($payload) ], - #body => $payload - #} - #); - - #is $response->{status}, 200; - #is_deeply JSON::decode_json( $response->{content} ), - #{ updated => 'Dancer' }; -#} + $response = dancer_response( + POST => '/hook/', + { + headers => + [ 'Content-Type' => 'application/x-www-form-urlencoded' ], + body => $payload + } + ); +#use YAML::Syck; warn Dump $response; + is $response->{status}, 200; + is_deeply JSON::decode_json( $response->{content} ), + { updated => 'Dancer' }; +} diff --git a/t/data/test.yaml b/t/data/test.yaml index 9636611..c8e1a63 100644 --- a/t/data/test.yaml +++ b/t/data/test.yaml @@ -8,7 +8,8 @@ commits: author: email: franck@lumberjaph.net name: franck cuny - id: 8c3c1d6be0fa27ada4f03258ddea7683c967a925 + #id: 8c3c1d6be0fa27ada4f03258ddea7683c967a925 + id: ba54d9b7d82eabe4ba35ec212eb24d00869119d5 message: test modified: - lib/Dancer.pm |