Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More public URL tests

  • Loading branch information...
commit 10858dd869f1fb69e18219f333803e40baa090d8 1 parent 8aaeec5
Dave Cross authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 t/004_public_urls.t
21 t/004_public_urls.t
View
@@ -8,6 +8,8 @@ use lib 'lib';
use Lystyng;
use Dancer::Test;
+use Lystyng::Schema;
+
my %route = (
'' => 200,
'user' => 200,
@@ -21,4 +23,23 @@ for (keys %route) {
"response status is $route{$_} for /$_";
}
+my $sch = Lystyng::Schema->connect(
+ "dbi:mysql:database=$ENV{LYSTYNG_DB_NAME}",
+ $ENV{LYSTYNG_DB_USER},
+ $ENV{LYSTYNG_DB_PASS},
+) or BAIL_OUT("Can't connect to database");
+
+my $user = $sch->resultset('User')->create({
+ username => 'test',
+ name => 'Test User',
+ email => 'test@example.com',
+});
+
+route_exists [ GET => '/user/test' ],
+ 'a get route is now defined for /user/test';
+response_status_is [ GET => '/user/test' ], 200,
+ 'response status is 200 for /user/test';
+
+$user->delete;
+
done_testing;
Please sign in to comment.
Something went wrong with that request. Please try again.