[Rt-commit] rt branch, 4.4/signature-spacing-test-fix, created. rt-4.4.0-112-gb0f432d

Rachel Kelly rachel at bestpractical.com
Wed May 11 15:41:00 EDT 2016


The branch, 4.4/signature-spacing-test-fix has been created
        at  b0f432d6b418efda3a4c849ac9a316f3a7311364 (commit)

- Log -----------------------------------------------------------------
commit b0f432d6b418efda3a4c849ac9a316f3a7311364
Author: rachelkelly <rachel at bestpractical.com>
Date:   Thu May 5 07:05:25 2016 +0000

    Fix failing FastCGI tests by changing how timestamps are removed from quote header
    
        t/web/signatures.t, introduced in
        9df4d3387e22754f160a5aba91f2e25381309b45, overrode the
        RT::Transaction::QuoteHeader method to replace the quote header text "On
        $date at $time, $person wrote:" with "Someone wrote:" to simplify the
        test cases. This solution works in most development environments but
        fails in a client/server environment like FastCGI. By the time this
        method override happens, the server and client processes have already
        forked, so it's simply too late for the test file to redefine methods in
        the server. This led to the test failures because the server output the
        stock "On $date at $time, $person wrote:" instead of the
        simplified-for-tests "Someone wrote:" header.
    
        This commit fixes the test by removing the method override and instead
        replacing the "On $date at $time, $person wrote:" with a regex
        substitution on the output. In this way is not only agnostic to the test
        environment, it is also more insulated from future changes (such as
        RT::Transaction method QuoteHeader being refactored away).

diff --git a/t/web/signatures.t b/t/web/signatures.t
index becc1f9..919e1e6 100644
--- a/t/web/signatures.t
+++ b/t/web/signatures.t
@@ -4,12 +4,6 @@ use warnings;
 use RT::Test tests => undef;
 use HTML::Entities qw/decode_entities/;
 
-# Remove the timestamp from the quote header
-{
-    no warnings 'redefine';
-    *RT::Transaction::QuoteHeader = sub { "Someone wrote:" };
-}
-
 my ($baseurl, $m) = RT::Test->started_ok;
 ok( $m->login, 'logged in' );
 
@@ -57,6 +51,9 @@ sub template_is {
     $display =~ s/^$/./mg;
     $display =~ s/([ ]+)$/$1\$/mg;
 
+    # Remove the timestamp from the quote header
+    $display =~ s/On \w\w\w \w\w\w+ \d\d \d\d:\d\d:\d\d \d\d\d\d, \w+ wrote:/Someone wrote:/;
+
     is($display, $expected, "Content matches expected");
 
     my $trim = RT::Interface::Web::StripContent(

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


More information about the rt-commit mailing list