From: Ash Berlin Date: Tue, 17 Feb 2009 18:26:05 +0000 (+0000) Subject: Version bump for release X-Git-Tag: 0.51~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FTest-WWW-Mechanize-Catalyst.git;a=commitdiff_plain;h=dabec5e2ff6722fb97852568b29a7890582b8dd1 Version bump for release Remove warnings in HTTP::Cookies. Call BUILDALL --- diff --git a/CHANGES b/CHANGES index 5cecf9b..3826ad4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,10 +1,14 @@ Revision history for Perl module Test::WWW::Mechanize::Catalyst: -0.50_2 Thur Feb 12 09:47 GMT 2008 +0.50 Tue Feb 17 09:12 GMT 2009 + - Remove warning in HTTP::Cookies + - Call BUILDALL + +0.50_2 Thur Feb 12 09:47 GMT 2009 - Make t/multi_content_type.t handle case when server cant be started, which is almost always due to port in use. -0.50_1 Thur Feb 5 09:02 GMT 2008 +0.50_1 Thur Feb 5 09:02 GMT 2009 - App classname no longer has to be passed to import: $m = T::W::M::C->new(catalyst_app => 'Catty') now works. diff --git a/lib/Test/WWW/Mechanize/Catalyst.pm b/lib/Test/WWW/Mechanize/Catalyst.pm index 4248f49..e9e91c6 100644 --- a/lib/Test/WWW/Mechanize/Catalyst.pm +++ b/lib/Test/WWW/Mechanize/Catalyst.pm @@ -12,7 +12,7 @@ extends 'Test::WWW::Mechanize', 'Moose::Object'; use namespace::clean -execept => 'meta'; -our $VERSION = '0.50_2'; +our $VERSION = '0.50'; our $APP_CLASS; my $Test = Test::Builder->new(); @@ -37,21 +37,38 @@ has host => ( sub new { my $class = shift; - my $obj = $class->SUPER::new(@_); + my $args = ref $_[0] ? $_[0] : { @_ }; + + # Dont let LWP complain about options for our attributes + my %attr_options = map { + my $n = $_->init_arg; + defined $n && exists $args->{$n} + ? ( $n => delete $args->{$n} ) + : ( ); + } $class->meta->get_all_attributes; + + my $obj = $class->SUPER::new(%$args); my $self = $class->meta->new_object( __INSTANCE__ => $obj, ($APP_CLASS ? (catalyst_app => $APP_CLASS) : () ), - @_ + %attr_options ); + $self->BUILDALL; + + + return $self; +} + +sub BUILD { + my ($self) = @_; + unless ($ENV{CATALYST_SERVER}) { croak "catalyst_app attribute is required unless CATALYST_SERVER env variable is set" unless $self->has_catalyst_app; Class::MOP::load_class($self->catalyst_app) unless (Class::MOP::is_class_loaded($self->catalyst_app)); } - - return $self; } sub _make_request { @@ -114,17 +131,16 @@ sub _make_request { sub _do_catalyst_request { my ($self, $request) = @_; + my $uri = $request->uri; + $uri->scheme('http') unless defined $uri->scheme; + $uri->host('localhost') unless defined $uri->host; + $self->cookie_jar->add_cookie_header($request) if $self->cookie_jar; # Woe betide anyone who unsets CATALYST_SERVER return Catalyst::Test::remote_request($request) if $ENV{CATALYST_SERVER}; - my $uri = $request->uri; - if ($uri->as_string =~ m{^/}) { - $uri->scheme('http'); - $uri->host('localhost'); - } # If there's no Host header, set one. diff --git a/t/pod_coverage.t b/t/pod_coverage.t deleted file mode 100644 index 2ee90fa..0000000 --- a/t/pod_coverage.t +++ /dev/null @@ -1,7 +0,0 @@ -#!perl -T - -use Test::More; -eval "use Test::Pod::Coverage 1.04"; -plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" - if $@; -all_pod_coverage_ok();