Skip to content
This repository
Browse code

More public URL tests

  • Loading branch information...
commit 10858dd869f1fb69e18219f333803e40baa090d8 1 parent 8aaeec5
Dave Cross authored February 07, 2014

Showing 1 changed file with 21 additions and 0 deletions. Show diff stats Hide diff stats

  1. 21  t/004_public_urls.t
21  t/004_public_urls.t
@@ -8,6 +8,8 @@ use lib 'lib';
8 8
 use Lystyng;
9 9
 use Dancer::Test;
10 10
 
  11
+use Lystyng::Schema;
  12
+
11 13
 my %route = (
12 14
   ''       => 200,
13 15
   'user'   => 200,
@@ -21,4 +23,23 @@ for (keys %route) {
21 23
     "response status is $route{$_} for /$_";
22 24
 }
23 25
 
  26
+my $sch = Lystyng::Schema->connect(
  27
+  "dbi:mysql:database=$ENV{LYSTYNG_DB_NAME}",
  28
+  $ENV{LYSTYNG_DB_USER},                                 
  29
+  $ENV{LYSTYNG_DB_PASS},
  30
+) or BAIL_OUT("Can't connect to database");
  31
+
  32
+my $user = $sch->resultset('User')->create({
  33
+  username => 'test',
  34
+  name     => 'Test User',
  35
+  email    => 'test@example.com',
  36
+});
  37
+
  38
+route_exists [ GET => '/user/test' ],
  39
+             'a get route is now defined for /user/test';
  40
+response_status_is [ GET => '/user/test' ], 200,
  41
+                   'response status is 200 for /user/test';
  42
+
  43
+$user->delete;
  44
+
24 45
 done_testing;

0 notes on commit 10858dd

Please sign in to comment.
Something went wrong with that request. Please try again.