summary refs log tree commit diff
path: root/t/spore
diff options
context:
space:
mode:
Diffstat (limited to 't/spore')
-rw-r--r--t/spore/01_new_from_string.t26
-rw-r--r--t/spore/02_enable.t8
2 files changed, 18 insertions, 16 deletions
diff --git a/t/spore/01_new_from_string.t b/t/spore/01_new_from_string.t
index 34bfedf..e9d9357 100644
--- a/t/spore/01_new_from_string.t
+++ b/t/spore/01_new_from_string.t
@@ -8,9 +8,13 @@ plan tests => 14;
 use IO::All;
 use Net::HTTP::Spore;
 
-my $couchdb_spec = 't/specs/couchdb.json';
-my %args = ( api_base_url => 'http://localhost:5984', );
-my $content < io($couchdb_spec);
+my $api_spec = 't/specs/api.json';
+my %args = ( base_url => 'http://localhost/', );
+
+my $github_spec =
+  "http://github.com/franckcuny/spore/raw/master/services/github.json";
+
+my $content < io($api_spec);
 
 dies_ok { Net::HTTP::Spore->new_from_spec };
 like $@, qr/specification file is missing/;
@@ -18,33 +22,31 @@ like $@, qr/specification file is missing/;
 dies_ok { Net::HTTP::Spore->new_from_spec( "/foo/bar/baz", ) };
 like $@, qr/does not exists/;
 
-dies_ok { Net::HTTP::Spore->new_from_spec( $couchdb_spec, ) };
-like $@, qr/api_base_url is missing/;
+dies_ok { Net::HTTP::Spore->new_from_spec( $api_spec, ) };
+like $@, qr/base_url is missing/;
 
-ok my $client = Net::HTTP::Spore->new_from_spec( $couchdb_spec, %args );
+ok my $client = Net::HTTP::Spore->new_from_spec( $api_spec, %args );
 ok $client = Net::HTTP::Spore->new_from_string( $content, %args );
 
 SKIP: {
     skip "require RUN_HTTP_TEST", 1 unless $ENV{RUN_HTTP_TEST};
-    ok $client = Net::HTTP::Spore->new_from_spec(
-        'http://github.com/franckcuny/spore/raw/master/services/github.json',
-        %args );
+    ok $client = Net::HTTP::Spore->new_from_spec( $github_spec, %args );
 }
 
 dies_ok {
     Net::HTTP::Spore->new_from_string(
-'{"api_base_url" : "http://services.org/restapi/","methods" : { "get_info" : { "method" : "GET" } } }'
+'{"base_url" : "http://services.org/restapi/","methods" : { "get_info" : { "method" : "GET" } } }'
     );
 };
 like $@, qr/Attribute \(path\) is required/;
 
 dies_ok {
     Net::HTTP::Spore->new_from_string(
-'{"api_base_url" : "http://services.org/restapi/","methods" : { "get_info" : { "method" : "PET", "path":"/info" } } }'
+'{"base_url" : "http://services.org/restapi/","methods" : { "get_info" : { "method" : "PET", "path":"/info" } } }'
     );
 };
 like $@, qr/Attribute \(method\) does not pass the type constraint/;
 
 ok $client = Net::HTTP::Spore->new_from_string(
-'{"api_base_url" : "http://services.org/restapi/","methods" : { "get_info" : { "path" : "/show", "method" : "GET" } } }'
+'{"base_url" : "http://services.org/restapi/","methods" : { "get_info" : { "path" : "/show", "method" : "GET" } } }'
 );
diff --git a/t/spore/02_enable.t b/t/spore/02_enable.t
index 3f25606..2bd7402 100644
--- a/t/spore/02_enable.t
+++ b/t/spore/02_enable.t
@@ -16,11 +16,11 @@ sub call { 1 }
 
 package main;
 
-my $couchdb_spec = 't/specs/couchdb.json';
-my %args = ( api_base_url => 'http://localhost:5984', );
-my $content < io($couchdb_spec);
+my $api_spec = 't/specs/api.json';
+my %args = ( base_url => 'http://localhost/', );
+my $content < io($api_spec);
 
-ok my $client = Net::HTTP::Spore->new_from_spec( $couchdb_spec, %args );
+ok my $client = Net::HTTP::Spore->new_from_spec( $api_spec, %args );
 
 is scalar @{$client->middlewares}, 0, 'no middleware';