diff --git a/lib/WebGUI/AssetHelper/Copy.pm b/lib/WebGUI/AssetHelper/Copy.pm index a5363a7d6..36c00aab6 100644 --- a/lib/WebGUI/AssetHelper/Copy.pm +++ b/lib/WebGUI/AssetHelper/Copy.pm @@ -72,7 +72,6 @@ sub process { allowComments => 1, returnUrl => $asset->getUrl, }) eq 'redirect') { - return undef; $payload->{open_tab} = $session->http->getRedirectLocation; }; diff --git a/t/AssetHelper/Copy.t b/t/AssetHelper/Copy.t index e8d66755f..25171015f 100644 --- a/t/AssetHelper/Copy.t +++ b/t/AssetHelper/Copy.t @@ -39,35 +39,37 @@ plan tests => 3; # Increment this number for each test you create my $output; my $home = WebGUI::Asset->getDefault($session); -$output = WebGUI::AssetHelper::Copy->process($home); -cmp_deeply( - $output, - { - message => re('was copied to the clipboard'), - }, - 'AssetHelper/Copy redirects the back to the copied asset' -); +{ -my $clippies = $home->getAssetsInClipboard(); -is @{ $clippies }, 1, '... only copied 1 asset to the clipboard, no children'; + $output = WebGUI::AssetHelper::Copy->process($home); + cmp_deeply( + $output, + { + message => re('was copied to the clipboard'), + }, + 'AssetHelper/Copy redirects the back to the copied asset' + ); -foreach my $asset (@{ $clippies }) { - $asset->purge; + my $clippies = $home->getAssetsInClipboard(); + is @{ $clippies }, 1, '... only copied 1 asset to the clipboard, no children'; + addToCleanup(@{ $clippies }); } -$session->setting->set('skipCommitComments', 0); +{ + $session->setting->set('skipCommitComments', 0); -$output = WebGUI::AssetHelper::Copy->process($home); -cmp_deeply( - $output, - { - message => re('was copied to the clipboard'), - open_tab => $home->getUrl, - }, - 'AssetHelper/Copy opens a tab for commit comments' -); + $output = WebGUI::AssetHelper::Copy->process($home); + cmp_deeply( + $output, + { + message => re('was copied to the clipboard'), + open_tab => re('^'.$home->getUrl), + }, + 'AssetHelper/Copy opens a tab for commit comments' + ); -foreach my $asset (@{ $clippies }) { - $asset->purge; + my $clippies = $home->getAssetsInClipboard(); + addToCleanup(@{ $clippies }); } + #vim:ft=perl