[Rt-commit] rt branch, 4.4/signature-spacing-test-fix, repushed

Rachel Kelly rachel at bestpractical.com
Wed May 11 15:31:14 EDT 2016


The branch 4.4/signature-spacing-test-fix was deleted and repushed:
       was 77ed8ec613e1527e70fbd8e011e4898868641885
       now 4fff9b14b4ff93d38a706d3be589aac1ad2de7f1

1:  344a35c ! 1:  4fff9b1 Fix failing FastCGI tests by changing how timestamps are removed from quote header
    @@ -1,6 +1,24 @@
     Author: rachelkelly <rachel at bestpractical.com>
     
    -    Add regex to match against date-time-user Quote Header
    +    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
     --- a/t/web/signatures.t
    @@ -14,17 +32,17 @@
     -    no warnings 'redefine';
     -    *RT::Transaction::QuoteHeader = sub { "Someone wrote:" };
     -}
    -+# Removed the: Remove the timestamp from the quote header
    - 
    +-
      my ($baseurl, $m) = RT::Test->started_ok;
      ok( $m->login, 'logged in' );
    + 
     @@
    -     my $display = $value;
          $display =~ s/^$/./mg;
          $display =~ s/([ ]+)$/$1\$/mg;
    -+    $display =~ s/On .* wrote:/Someone wrote:/;
    + 
    ++    # 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+:/Someone wrote:/;
     +
    - 
          is($display, $expected, "Content matches expected");
      
    -
    +     my $trim = RT::Interface::Web::StripContent(
2:  77ed8ec < -:  ------- Fix failing FastCGI tests by changing how timestamps are removed from quote header



More information about the rt-commit mailing list