All pastes #2073517 Raw Edit

Untitled

public text v1 · immutable
#2073517 ·published 2011-06-02 04:00 UTC
rendered paste body
{
    
    $req->set_always( method => 'GET' );
    
    ok( !$stash->{is_first_login}, qq[is_first_login not initialized before login] );
    clear_all_mocks();
    
    $ctl->assert_login($ctx);

    {   # Following the flow and checking it ($ctx):
        {   my($method, $args) = $ctx->next_call;
            is($method => 'user_exists', q{called 'user_exists'} ) }
    
        {   my($method, $args) = $ctx->next_call;
            is($method => 'check_user_roles', q{called 'check_user roles'...} );
            is($args->[1] =>  'admin', q{...with 'admin' as an argument} ) }

        {   my($method, $args) = $ctx->next_call;
            is($method => 'check_user_roles', q{called 'check_user roles...'} );
            is($args->[1] =>  'user', q{...with 'user' as an argument} ) }   
    
        {   my($method, $args) = $ctx->next_call;
            is($method => 'uri_for', q{called 'uri_for...'} );
            is($args->[1] =>  '/lists', q{...with '/lists' as an argument} ) }  
        
        {   my($method, $args) = $ctx->next_call;
            is($method => 'stash', q{called 'stash'} ) }
        
        {   my($method, $args) = $ctx->next_call;
            is($method => 'user', q{called 'user'} ) }
    
        {   my($method, $args) = $ctx->next_call;
            is($method => 'stash', q{called 'stash'} ) }

        {   my($method, $args) = $ctx->next_call;
            is($method => 'req', q{called 'req'} ) }

        {   my($method, $args) = $ctx->next_call;
            is($method => 'stash', q{called 'stash'} ) }
    
        {   my($method, $args) = $ctx->next_call;
            is($method => 'stash', q{called 'stash'} ) }
    
        {   my($method, $args) = $ctx->next_call;
            is($method => 'detach', q{called 'detach'} ) }

        ok(!defined $ctx->next_call, q{calls nothing no more in $c });
    }

    ok($stash->{is_first_login},   qq[is_first_login properly initialized after login] );

    {   # Following the flow and checking it ($user)
        
        {   my($method, $args) = $user->next_call;
            is($method => 'is_first_login', q{Method called was "is_first_login"} ) }
        
        ok( !defined $user->next_call, q{calls nothing no more in $user} )
    }

    clear_all_mocks();
}