Changeset 18012

Show
Ignore:
Timestamp:
08/22/08 06:01:29 (5 months ago)
Author:
tokuhirom
Message:

refactor the test

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Nanto/trunk/t/030_web_plugin/MobileAttribute.t

    r18011 r18012  
    22use warnings; 
    33use Test::More tests => 2; 
    4 use Nanto::Web::Plugin::MobileAttribute; 
     4use t::Utils; 
    55use HTTP::Engine::Request; 
    66use HTTP::Engine::RequestBuilder; 
     7use Nanto::Web::Plugin::MobileAttribute; 
    78 
    8 my $req = HTTP::Engine::Request->new( 
    9     headers => { 
     9my $req = HTTP::Request->new( 
     10    GET => '/' => HTTP::Headers->new( 
    1011        'User-Agent' => 'DoCoMo/1.0/D504i/c10/TJ', 
     12    ), 
     13); 
     14my $res = HTTP::Engine->new( 
     15    interface => { 
     16        module          => 'Test', 
     17        args            => {}, 
     18        request_handler => sub { 
     19            my $req = shift; 
     20            isa_ok $req->mobile_attribute, 'HTTP::MobileAttribute::Agent::DoCoMo'; 
     21            is $req->mobile_attribute->user_agent, 'DoCoMo/1.0/D504i/c10/TJ'; 
     22            HTTP::Engine::Response->new(status=>200); 
     23        }, 
    1124    }, 
    12     _connection => {}, 
    13     request_builder => HTTP::Engine::RequestBuilder->new(), 
    14 ); 
    15 isa_ok $req->mobile_attribute, 'HTTP::MobileAttribute::Agent::DoCoMo'; 
    16 is $req->mobile_attribute->user_agent, 'DoCoMo/1.0/D504i/c10/TJ'; 
     25)->run($req); 
    1726