summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-10-12 17:18:40 +0200
committerfranck cuny <franck@lumberjaph.net>2010-10-12 17:18:40 +0200
commitbbe059b352b1ebc4c07e3e603a956c4329e8f8da (patch)
tree43c0c29efa826505b7e6de3d4a99fabcbb06be4a
parentupdate POD (diff)
downloadnet-http-spore-bbe059b352b1ebc4c07e3e603a956c4329e8f8da.tar.gz
dist.ini file and basic test for format::autho
-rw-r--r--dist.ini28
-rw-r--r--t/spore-middleware/format-auto.t38
2 files changed, 66 insertions, 0 deletions
diff --git a/dist.ini b/dist.ini
new file mode 100644
index 0000000..1c5e5e7
--- /dev/null
+++ b/dist.ini
@@ -0,0 +1,28 @@
+name = Net-HTTP-Spore
+author = franck cuny <franck@lumberjaph.net>
+license = Perl_5
+copyright_holder = linkfluence
+copyright_year = 2010
+version = 0.01
+
+[@Filter]
+bundle = @Basic
+
+[MetaConfig]
+[MetaJSON]
+[PkgVersion]
+[PodSyntaxTests]
+[PodCoverageTests]
+[NoTabsTests]
+[EOLTests]
+
+[MetaResources]
+repository = git://github.com/franckcuny/net-http-spore.git
+bugtracker = http://github.com/franckcuny/net-http-spore/issues
+homepage = http://github.com/franckcuny/net-http-spore
+
+[PodWeaver]
+[AutoPrereq]
+[ReadmeFromPod]
+[CheckChangeLog]
+[UploadToCPAN]
diff --git a/t/spore-middleware/format-auto.t b/t/spore-middleware/format-auto.t
new file mode 100644
index 0000000..e90e16b
--- /dev/null
+++ b/t/spore-middleware/format-auto.t
@@ -0,0 +1,38 @@
+use strict;
+use warnings;
+use Test::More;
+
+plan tests => 1;
+
+use JSON;
+
+use Net::HTTP::Spore;
+
+my $content = { keys => [qw/1 2 3/] };
+
+my $mock_server = {
+    '/api/show' => sub {
+        my $req = shift;
+        $req->new_response(
+            200,
+            [ 'Content-Type' => 'application/json' ],
+            JSON::encode_json($content),
+        );
+    },
+};
+
+my $api = {
+    api_base_url => 'http://services.org/api',
+    methods      => {
+        'show' => {
+            path   => '/show',
+            method => 'GET',
+        }
+    }
+};
+
+ok my $client = Net::HTTP::Spore->new_from_string( JSON::encode_json($api) );
+
+$client->enable('Format::Auto');
+$client->enable( 'Mock', tests => $mock_server );
+