diff --git a/lib/WebGUI/Content/Asset.pm b/lib/WebGUI/Content/Asset.pm index 952ee2941..d07005a79 100644 --- a/lib/WebGUI/Content/Asset.pm +++ b/lib/WebGUI/Content/Asset.pm @@ -81,6 +81,7 @@ sub dispatch { my $fragment = $assetUrl; $fragment =~ s/$url//; + $session->asset($asset); my $output = eval { $asset->dispatch($fragment); }; return $output if defined $output; } diff --git a/t/Content/Asset.t b/t/Content/Asset.t index caefd3b84..aee6f1eba 100644 --- a/t/Content/Asset.t +++ b/t/Content/Asset.t @@ -79,7 +79,7 @@ WebGUI::Test->addToCleanup( WebGUI::VersionTag->getWorking( $session ) ); #---------------------------------------------------------------------------- # Tests -plan tests => 12; # Increment this number for each test you create +plan tests => 15; # Increment this number for each test you create #---------------------------------------------------------------------------- # test getUrlPermutation( url ) method @@ -118,12 +118,15 @@ cmp_deeply( #---------------------------------------------------------------------------- # test dispatch( session, url ) method +is ($session->asset, undef, 'session asset is not defined, yet'); is( WebGUI::Content::Asset::dispatch( $session, "testdispatch" ), "www_view one", "Regular www_view", ); +is ($session->asset->getId, $td->getId, 'dispatch set the session asset'); + is( WebGUI::Content::Asset::dispatch( $session, "testdispatch/foo" ), "bar", @@ -144,6 +147,7 @@ is( "www_view two", "dispatch to the asset with the longest URL", ); +is ($session->asset->getId, $clobberingTime->getId, 'dispatch reset the session asset'); $clobberingTime->purge;