Skip to content
This repository
Browse code

Merge pull request #875 from PerlDancer/hash-order

don't expect specific order in cookie
  • Loading branch information...
commit ae8426ca00cb33a2ac3262424f4cbbc035c3e604 2 parents 6bac57e + d4598c0
David Precious authored December 15, 2012

Showing 1 changed file with 15 additions and 6 deletions. Show diff stats Hide diff stats

  1. 21  t/09_cookies/05_api.t
21  t/09_cookies/05_api.t
@@ -23,13 +23,22 @@ foreach my $test (@tests) {
23 23
        "HttpOnly is correctly set";
24 24
 }
25 25
 
26  
-ok my $c = Dancer::Cookie->new(
27  
-    name  => 'complex',
28  
-    value => { token => 'foo', token_secret => 'bar' },
29  
-);
  26
+{
  27
+    my $values = { token => 'foo', token_secret => 'bar' };
  28
+
  29
+    ok my $c = Dancer::Cookie->new(
  30
+        name  => 'complex',
  31
+        value => $values,
  32
+    );
  33
+
  34
+    subtest "cookie header" => sub {
  35
+        ok $c->to_header =~ /^complex=([^;]+);/, "cookie name";
30 36
 
31  
-my $text = $c->to_header;
32  
-like $text, qr/complex=token&foo&token_secret&bar/;
  37
+        my %cookie_values = split '&', $1;
  38
+
  39
+        is_deeply \%cookie_values => $values, "cookie values";
  40
+    };
  41
+}
33 42
 
34 43
 my $env = {
35 44
     REQUEST_METHOD => 'GET',

0 notes on commit ae8426c

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