Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test::Mojo wrong "expected" value in json_is #401

Closed
koorchik opened this issue Oct 22, 2012 · 1 comment
Closed

Test::Mojo wrong "expected" value in json_is #401

koorchik opened this issue Oct 22, 2012 · 1 comment

Comments

@koorchik
Copy link

Here is small test:

use Mojo::Base -strict;
use Mojolicious::Lite;

use Test::Mojo;
use Test::More;

my $t = Test::Mojo->new();

get '/json' => sub {
    my $self = shift;
    $self->render_json( { key1 => 'value1', key2 => 'value2' } );
};

$t->get_ok('/json')->json_is('/key1' => 'value1', 'Correct');
$t->get_ok('/json')->json_is('/key1' => 'value2', 'Should fail with [got:"value1"; expected="value2"]');
$t->get_ok('/json')->json_is('/key3' => 'value2', 'Should fail with [got:""; expected="value2"]');

done_testing;

Current result of
"$t->get_ok('/json')->json_is('/key3' => 'value2', 'Should fail with [got:""; expected="value2"]');"
is:

not ok 6
#   Failed test at basic.t line 16.
#          got: 'value2'
#     expected: 'Should fail with [got:""; expected="value2"]'

But it should be

not ok 6 - Should fail with [got:""; expected="value2"]
#   Failed test 'Should fail with [got:"value1"; expected="value2"]'
#   at basic.t line 15.
#          got: ''
#     expected: 'value2'
@kraih kraih closed this as completed in dc0f88f Oct 22, 2012
@kraih
Copy link
Member

kraih commented Oct 22, 2012

Thanks, fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants