Skip to content

Instantly share code, notes, and snippets.

@omega

omega/t_mytest.t Secret

Created October 19, 2010 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omega/d25085cde48261f37e9b to your computer and use it in GitHub Desktop.
Save omega/d25085cde48261f37e9b to your computer and use it in GitHub Desktop.
Sample test
my $json = $t->json_get_ok('/host/?routes=1') # A method that checks content_type for you.
->json_query('0.routes.0.target_id', 1) # Query for scalar values will compare them
->json_query('0.routes', 8) # If the value after the query is an array-ref, we will check length.
->json_query('0.routes.0', { # If the value after the query is an hash ref, and the expects is a
target_id => 1, # hashref, we is_deeply on the two.
reversed => 0,
host_id => 1,
id => 1,
path => '@chat',
target_type => 'handler',
})
->json_content; # Pure helper method to get the json-content for more extensive tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment