diff options
author | franck cuny <franck@lumberjaph.net> | 2010-09-15 16:11:09 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-09-15 16:11:09 +0200 |
commit | 697e5f20634ba1408a41453d760d19381a519435 (patch) | |
tree | 1dc164944e4a0c86789358b932bc3a76ec64203f /t/spore-middleware/format-xml.t | |
parent | rewrite test using mocker (diff) | |
download | net-http-spore-697e5f20634ba1408a41453d760d19381a519435.tar.gz |
tests use the mocker
Diffstat (limited to 't/spore-middleware/format-xml.t')
-rw-r--r-- | t/spore-middleware/format-xml.t | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/t/spore-middleware/format-xml.t b/t/spore-middleware/format-xml.t index 0a01633..623e281 100644 --- a/t/spore-middleware/format-xml.t +++ b/t/spore-middleware/format-xml.t @@ -6,18 +6,22 @@ use XML::Simple; use Net::HTTP::Spore; +my $content = { keys => [qw/1 2 3/] }; + +my $mock_server = { + '/test_spore/_all_docs' => sub { + my $req = shift; + $req->new_response( 200, [ 'Content-Type' => 'text/xml' ], + XMLout($content) ); + }, +}; + ok my $client = Net::HTTP::Spore->new_from_spec( 't/specs/couchdb.json', api_base_url => 'http://localhost:5984' ); -my $content = { keys => [qw/1 2 3/] }; - $client->enable('Format::XML'); -$client->enable( - 'Test::Response', - body => XMLout($content), - headers => [ 'Content-Type' => 'text/xml' ] -); +$client->enable( 'Mock', tests => $mock_server ); my $res = $client->get_all_documents( database => 'test_spore' ); is $res->[0], 200; |