Skip to content

Commit

Permalink
Remove dispatch_path from test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
veryrusty authored and cromedome committed Mar 9, 2017
1 parent 2e11a84 commit eb9cff1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
2 changes: 1 addition & 1 deletion t/dsl/halt.t
Expand Up @@ -61,7 +61,7 @@ subtest 'halt in before hook' => sub {

hook before => sub {
response->content('I was halted');
halt if request->dispatch_path eq '/shortcircuit';
halt if request->path eq '/shortcircuit';
};

}
Expand Down
2 changes: 1 addition & 1 deletion t/dsl/halt_with_param.t
Expand Up @@ -59,7 +59,7 @@ subtest 'halt with parameter in before hook' => sub {
use Dancer2;

hook before => sub {
halt('I was halted') if request->dispatch_path eq '/shortcircuit';
halt('I was halted') if request->path eq '/shortcircuit';
};

}
Expand Down
4 changes: 2 additions & 2 deletions t/forward_before_hook.t
Expand Up @@ -18,14 +18,14 @@ get '/redirect' => sub {
};

hook before => sub {
return if request->dispatch_path eq '/default';
return if request->path eq '/default';

# Add some content to the response
response->content("SillyStringIsSilly");

# redirect - response should include the above content
return redirect '/default'
if request->dispatch_path eq '/redirect';
if request->path eq '/redirect';

# The response object will get replaced by the result of the forward.
forward '/default';
Expand Down
2 changes: 1 addition & 1 deletion t/issues/gh-944.t
Expand Up @@ -11,7 +11,7 @@ use HTTP::Request::Common;
set serializer => 'JSON';

hook before => sub {
return if request->dispatch_path eq '/content';
return if request->path eq '/content';
response->content({ foo => 'bar' });
response->halt;
};
Expand Down
16 changes: 2 additions & 14 deletions t/request.t
Expand Up @@ -122,8 +122,8 @@ sub run_test {
is $req->scheme, 'http';
}

note "testing path, dispatch_path and uri_base"; {
# Base env used for path, dispatch_path and uri_base tests
note "testing path and uri_base"; {
# Base env used for path and uri_base tests
my $base = {
'psgi.url_scheme' => 'http',
REQUEST_METHOD => 'GET',
Expand All @@ -145,9 +145,6 @@ sub run_test {
is( $req->uri_base, 'http://localhost:5000/foo',
'uri_base correct when empty PATH_INFO'
);
is( $req->dispatch_path, '/',
'dispatch_path correct when empty PATH_INFO'
);

# SCRIPT_NAME not set
$env = {
Expand All @@ -161,9 +158,6 @@ sub run_test {
is( $req->uri_base, 'http://localhost:5000',
'uri_base handles empty SCRIPT_NAME'
);
is( $req->dispatch_path, '/foo',
'dispatch_path handles empty SCRIPT_NAME'
);

# Both SCRIPT_NAME and PATH_INFO set
# PSGI spec does not allow SCRIPT_NAME='/', PATH_INFO='/some/path'
Expand All @@ -180,9 +174,6 @@ sub run_test {
is( $req->uri_base, 'http://localhost:5000/foo',
'uri_base correct when both PATH_INFO and SCRIPT_NAME set',
);
is( $req->dispatch_path, '/bar/baz/',
'dispatch_path correct when both PATH_INFO and SCRIPT_NAME set'
);

# Neither SCRIPT_NAME or PATH_INFO set
$env = {
Expand All @@ -198,9 +189,6 @@ sub run_test {
is( $req->uri_base, 'http://localhost:5000',
'uri_base correct when calculated from REQUEST_URI',
);
is( $req->dispatch_path, '/',
'dispatch_path correct when calculated from REQUEST_URI'
);
}

note "testing forward";
Expand Down

0 comments on commit eb9cff1

Please sign in to comment.