[Catalyst] script/create.pl -mech controller (patch)

Sebastian Riedel sri at oook.de
Fri Mar 3 15:13:42 CET 2006


03.03.2006 13:37 Matt S Trout:

> On Fri, Mar 03, 2006 at 01:25:25PM +0100, Sebastian Riedel wrote:
>>
>> 03.03.2006 11:51 Carl Franks:
>>
>>> Attached is a patch which adds a new '-mech' flag to the
>>> script/create.pl program
>>>
>>> It changes the generated test-file, so that instead of testing  
>>> this...
>>> ***
>>> BEGIN { use_ok 'Catalyst::Test', 'myapp' }
>>> BEGIN { use_ok 'testfoo::Controller::Login' }
>>>
>>> ok( request('login')->is_success, 'Request should succeed' );
>>> ***
>>>
>>> It instead tests...
>>> ***
>>> BEGIN { use_ok 'Test::WWW::Mechanize::Catalyst', 'myapp' }
>>>
>>> ok( my $mech = Test::WWW::Mechanize::Catalyst->new, 'created mech
>>> object' );
>>> $mech->get_ok( 'http://localhost/login' );
>>> ***
>>>
>>> The flag does nothing when creating something other than a  
>>> controller.
>>>
>>> The patch is for file "trunk/Catalyst/lib/Catalyst/Helper.pm"
>>> against svn revision 3535
>>
>> We can't do that, as much as i like Test::WWW::Mechanize, it's not a
>> core prereq, so we can't use it in generated code.
>
> Erm, so? Have it check for Test::WWW::Mechanize::Catalyst if the - 
> mech flag
> is passed and bomb out if not, plus emit a warning saying "make  
> sure this
> is in your Makefile.PL".
>
> Seem reasonable?

Ok, we could make it a optional prereq (our packagers will hate me  
once again) and eval check for mechanize in the tests.


--
sebastian




More information about the Catalyst mailing list