summaryrefslogtreecommitdiff
path: root/t/spore-middleware/format-yaml.t
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--t/spore-middleware/format-yaml.t19
1 files changed, 12 insertions, 7 deletions
diff --git a/t/spore-middleware/format-yaml.t b/t/spore-middleware/format-yaml.t
index c104cc5..db9629d 100644
--- a/t/spore-middleware/format-yaml.t
+++ b/t/spore-middleware/format-yaml.t
@@ -6,18 +6,22 @@ use YAML;
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/x-yaml' ],
+ Dump($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::YAML');
-$client->enable(
- 'Test::Response',
- body => Dump($content),
- headers => [ 'Content-Type' => 'text/x-yaml' ]
-);
+$client->enable( 'Mock', tests => $mock_server );
my $res = $client->get_all_documents( database => 'test_spore' );
is $res->[0], 200;
@@ -28,3 +32,4 @@ my $req = $res->request;
is $req->header('Accept'), 'text/x-yaml';
done_testing;
+