X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fjsonp.t;h=326e402843122f9c8a74eccd485ccf1f76d6437d;hb=1edd63a7979a5348d72d3cfea1ea6b2523c7f6be;hp=70f9b18d84c8460f13b71af5e7e34ad12195cc6c;hpb=d0d292d4373d4af3455eac0b88366fef95f354be;p=catagits%2FCatalyst-Action-REST.git diff --git a/t/jsonp.t b/t/jsonp.t index 70f9b18..326e402 100644 --- a/t/jsonp.t +++ b/t/jsonp.t @@ -2,16 +2,12 @@ use strict; use warnings; use Test::More; use FindBin; +use JSON::MaybeXS; use lib ("$FindBin::Bin/lib", "$FindBin::Bin/../lib"); use Test::Rest; use utf8; -eval 'use JSON 2.12'; -plan skip_all => 'Install JSON 2.12 or later to run this test' if ($@); - -plan tests => 7; - use_ok 'Catalyst::Test', 'Test::Serialize', 'Catalyst::Action::Serialize::JSON'; my $json = JSON->new->utf8; @@ -20,11 +16,13 @@ for ('text/javascript','application/x-javascript','application/javascript') { my $t = Test::Rest->new('content_type' => $_); my $monkey_template = { monkey => 'likes chicken!' }; - my $mres = request($t->get(url => '/monkey_get?callback=omnivore')); + my $mres = request($t->get(url => '/monkey_get?callback=My_Animal.omnivore')); ok( $mres->is_success, 'GET the monkey succeeded' ); - my ($json_param) = $mres->content =~ /^omnivore\((.*)?\);$/; + my ($json_param) = $mres->content =~ /^My_Animal.omnivore\((.*)?\);$/; is_deeply($json->decode($json_param), $monkey_template, "GET returned the right data"); } 1; + +done_testing;