[Catalyst-commits] r11171 - in Catalyst-Plugin-Session/0.00/trunk:
. lib/Catalyst/Plugin t
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Wed Aug 19 21:02:48 GMT 2009
Author: t0m
Date: 2009-08-19 21:02:46 +0000 (Wed, 19 Aug 2009)
New Revision: 11171
Modified:
Catalyst-Plugin-Session/0.00/trunk/Changes
Catalyst-Plugin-Session/0.00/trunk/Makefile.PL
Catalyst-Plugin-Session/0.00/trunk/lib/Catalyst/Plugin/Session.pm
Catalyst-Plugin-Session/0.00/trunk/t/01_setup.t
Catalyst-Plugin-Session/0.00/trunk/t/03_flash.t
Log:
Checking in changes prior to tagging of version 0.26. Changelog diff is:
Index: Changes
===================================================================
--- Changes (revision 11170)
+++ Changes (working copy)
@@ -1,6 +1,9 @@
Revision history for Perl extension Catalyst::Plugin::Session
-0.25 2009-0708
+0.26 2009-08-19
+ - Remove Test::MockObject from the test suite as it is full of fail.
+
+0.25 2009-07-08
- Add the a change_session_id method which can be called after
authentication to change the user's session cookie whilst preserving
their session data. This can be used to provide protection from
Modified: Catalyst-Plugin-Session/0.00/trunk/Changes
===================================================================
--- Catalyst-Plugin-Session/0.00/trunk/Changes 2009-08-19 20:45:45 UTC (rev 11170)
+++ Catalyst-Plugin-Session/0.00/trunk/Changes 2009-08-19 21:02:46 UTC (rev 11171)
@@ -1,6 +1,9 @@
Revision history for Perl extension Catalyst::Plugin::Session
-0.25 2009-0708
+0.26 2009-08-19
+ - Remove Test::MockObject from the test suite as it is full of fail.
+
+0.25 2009-07-08
- Add the a change_session_id method which can be called after
authentication to change the user's session cookie whilst preserving
their session data. This can be used to provide protection from
Modified: Catalyst-Plugin-Session/0.00/trunk/Makefile.PL
===================================================================
--- Catalyst-Plugin-Session/0.00/trunk/Makefile.PL 2009-08-19 20:45:45 UTC (rev 11170)
+++ Catalyst-Plugin-Session/0.00/trunk/Makefile.PL 2009-08-19 21:02:46 UTC (rev 11171)
@@ -30,7 +30,6 @@
test_requires 'Test::Deep';
test_requires 'Test::Exception';
-test_requires 'Test::MockObject' => '1.01';
resources repository => 'http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Plugin-Session/0.00/trunk/';
Modified: Catalyst-Plugin-Session/0.00/trunk/lib/Catalyst/Plugin/Session.pm
===================================================================
--- Catalyst-Plugin-Session/0.00/trunk/lib/Catalyst/Plugin/Session.pm 2009-08-19 20:45:45 UTC (rev 11170)
+++ Catalyst-Plugin-Session/0.00/trunk/lib/Catalyst/Plugin/Session.pm 2009-08-19 21:02:46 UTC (rev 11171)
@@ -13,7 +13,7 @@
use namespace::clean -except => 'meta';
-our $VERSION = '0.25';
+our $VERSION = '0.26';
my @session_data_accessors; # used in delete_session
Modified: Catalyst-Plugin-Session/0.00/trunk/t/01_setup.t
===================================================================
--- Catalyst-Plugin-Session/0.00/trunk/t/01_setup.t 2009-08-19 20:45:45 UTC (rev 11170)
+++ Catalyst-Plugin-Session/0.00/trunk/t/01_setup.t 2009-08-19 21:02:46 UTC (rev 11171)
@@ -4,17 +4,19 @@
use warnings;
use Test::More tests => 10;
-use Test::MockObject;
+use Class::MOP;
use Test::Deep;
my $m;
BEGIN { use_ok( $m = "Catalyst::Plugin::Session" ) }
my %config;
-my $log = Test::MockObject->new;
+my $log_meta = Class::MOP::Class->create_anon_class(superclasses => ['Moose::Object']);
+my $log = $log_meta->name->new;
my @mock_isa = ();
-$log->set_true("fatal");
+my $calls = 0;
+$log_meta->add_method("fatal" => sub { $calls++; 1; });
{
@@ -41,7 +43,7 @@
"can't setup an object that doesn't use state/store plugins"
);
-$log->called_ok( "fatal", "fatal error logged" );
+is $calls, 1, 'Fatal error logged';
@mock_isa = qw/Catalyst::Plugin::Session::State/;
eval { MockCxt->new->setup };
@@ -53,13 +55,13 @@
like( $@, qr/requires.*(?:State)/i,
"can't setup an object that doesn't use state/store plugins" );
-$log->clear;
+$calls = 0;
@mock_isa =
qw/Catalyst::Plugin::Session::State Catalyst::Plugin::Session::Store/;
eval { MockCxt->new->setup };
ok( !$@, "setup() lives with state/store plugins in use" );
-ok( !$log->called("fatal"), "no fatal error logged either" );
+is( $calls, 0, "no fatal error logged either" );
cmp_deeply(
[ keys %{ $config{session} } ],
Modified: Catalyst-Plugin-Session/0.00/trunk/t/03_flash.t
===================================================================
--- Catalyst-Plugin-Session/0.00/trunk/t/03_flash.t 2009-08-19 20:45:45 UTC (rev 11170)
+++ Catalyst-Plugin-Session/0.00/trunk/t/03_flash.t 2009-08-19 21:02:46 UTC (rev 11171)
@@ -4,28 +4,32 @@
use warnings;
use Test::More tests => 12;
-use Test::MockObject::Extends;
use Test::Exception;
use Test::Deep;
my $m;
BEGIN { use_ok( $m = "Catalyst::Plugin::Session" ) }
-my $c = Test::MockObject::Extends->new($m);
+my $c_meta = Class::MOP::Class->create_anon_class(
+ superclasses => [ $m, 'Moose::Object', ],
+);
+my $c = $c_meta->name->new;
my $flash = {};
-$c->mock(
+$c_meta->add_method(
get_session_data => sub {
my ( $c, $key ) = @_;
return $key =~ /expire/ ? time() + 1000 : $flash;
},
);
-$c->mock("debug" => sub { 0 });
-$c->mock("store_session_data" => sub { $flash = $_[2] });
-$c->mock("delete_session_data" => sub { $flash = {} });
-$c->set_always( _sessionid => "deadbeef" );
-$c->set_always( config => { session => { expires => 1000 } } );
-$c->set_always( stash => {} );
+$c->meta->add_method("debug" => sub { 0 });
+$c->meta->add_method("store_session_data" => sub { $flash = $_[2] });
+$c->meta->add_method("delete_session_data" => sub { $flash = {} });
+$c->meta->add_method( _sessionid => sub { "deadbeef" });
+my $config = { expires => 1000 };
+$c->meta->add_method( config => sub { { session => $config } });
+my $stash = {};
+$c->meta->add_method( stash => sub { $stash } );
is_deeply( $c->session, {}, "nothing in session" );
@@ -67,7 +71,7 @@
$c->flash->{bar} = "gorch";
-$c->config->{session}{flash_to_stash} = 1;
+$config->{flash_to_stash} = 1;
$c->finalize_body;
$c->prepare_action;
More information about the Catalyst-commits
mailing list