[Rt-commit] rt branch, 4.2/dom-traversing-in-tests, created. rt-4.0.6-490-gc078f49

Ruslan Zakirov ruz at bestpractical.com
Wed Aug 22 14:58:51 EDT 2012


The branch, 4.2/dom-traversing-in-tests has been created
        at  c078f4976ff8107635403d6286ef00218a5b40e6 (commit)

- Log -----------------------------------------------------------------
commit c078f4976ff8107635403d6286ef00218a5b40e6
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Aug 22 22:46:12 2012 +0400

    ::Test::Web->dom method that return Mojo::DOM
    
    Code with it looks sweet.
    
    It's a big module, but no production code will
    need it as it only required when --with-tests-deps
    configure option is used. We have plenty of modules
    required only for tests.

diff --git a/lib/RT/Test/Web.pm b/lib/RT/Test/Web.pm
index 8fae537..f36ee23 100644
--- a/lib/RT/Test/Web.pm
+++ b/lib/RT/Test/Web.pm
@@ -393,6 +393,14 @@ sub auth_header {
         MIME::Base64::encode( join(":", @_) );
 }
 
+sub dom {
+    my $self = shift;
+    Carp::croak("Can not get DOM, not HTML repsone")
+        unless $self->is_html;
+    require Mojo::DOM;
+    return Mojo::DOM->new( $self->content );
+}
+
 sub DESTROY {
     my $self = shift;
     if ( !$RT::Test::Web::DESTROY++ ) {
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 6c4a431..e1ad4c8 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -300,6 +300,7 @@ Log::Dispatch::Perl
 Test::WWW::Mechanize::PSGI
 Plack::Middleware::Test::StashWarnings 0.06
 Test::LongString
+Mojo::DOM
 .
 
 $deps{'FASTCGI'} = [ text_to_hash( << '.') ];

-----------------------------------------------------------------------


More information about the Rt-commit mailing list