real_data_tests 0.3.11 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/real_data_tests/rspec_helper.rb +28 -19
- data/lib/real_data_tests/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e9613e7cdfc987dd88b0726c3cfe9f9bc31cf4877267988c70fe2c52bf96b163
         | 
| 4 | 
            +
              data.tar.gz: 654f32e804769aca3cc0415b0455d0d4f481b6fc8e01625a3bd52fc43e11ee6d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 80f42c596ef4fef11a44272c8a94089700428cc414030024410531e74ee6709d55fdff7b0de3b47a733b73aaf5e576cf519c746f9d4af60bfad978feefa5235f
         | 
| 7 | 
            +
              data.tar.gz: 0656dede260673942b237c12e94566156fdbed104b864c23b2617c69871088af97afaf6d21fcce6772e3e4a25dcc80e24450f189600d863b6b7a4992c1e9d491
         | 
| @@ -75,32 +75,41 @@ module RealDataTests | |
| 75 75 | 
             
                  statements = []
         | 
| 76 76 | 
             
                  current_statement = ''
         | 
| 77 77 | 
             
                  in_string = false
         | 
| 78 | 
            -
                   | 
| 78 | 
            +
                  in_conflict = false
         | 
| 79 | 
            +
                  quote_char = nil
         | 
| 79 80 |  | 
| 80 81 | 
             
                  sql.each_char do |char|
         | 
| 81 | 
            -
                     | 
| 82 | 
            -
                     | 
| 83 | 
            -
                       | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
                       | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 82 | 
            +
                    # Detect start of quoted strings
         | 
| 83 | 
            +
                    if (char == "'" || char == '"') && !in_string
         | 
| 84 | 
            +
                      in_string = true
         | 
| 85 | 
            +
                      quote_char = char
         | 
| 86 | 
            +
                    # Detect end of quoted strings (matching quote type)
         | 
| 87 | 
            +
                    elsif (char == "'" || char == '"') && in_string && char == quote_char
         | 
| 88 | 
            +
                      in_string = false
         | 
| 89 | 
            +
                    # Track if we're in an ON CONFLICT clause
         | 
| 90 | 
            +
                    elsif char == 'O' && !in_string && current_statement.strip.end_with?(')')
         | 
| 91 | 
            +
                      # Look ahead to see if this is 'ON CONFLICT'
         | 
| 92 | 
            +
                      potential_conflict = sql[sql.index(char, sql.rindex(current_statement)), 11]
         | 
| 93 | 
            +
                      in_conflict = potential_conflict&.upcase == 'ON CONFLICT'
         | 
| 94 | 
            +
                    end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
                    current_statement << char
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                    # Only split on semicolon if we're not in a string and not in an ON CONFLICT clause
         | 
| 99 | 
            +
                    if char == ';' && !in_string && !in_conflict
         | 
| 100 | 
            +
                      statements << current_statement.strip
         | 
| 101 | 
            +
                      current_statement = ''
         | 
| 102 | 
            +
                      in_conflict = false
         | 
| 97 103 | 
             
                    end
         | 
| 98 104 | 
             
                  end
         | 
| 99 105 |  | 
| 100 | 
            -
                  # Add  | 
| 106 | 
            +
                  # Add any remaining statement
         | 
| 101 107 | 
             
                  statements << current_statement.strip if current_statement.strip.length > 0
         | 
| 102 108 |  | 
| 103 | 
            -
                  statements
         | 
| 109 | 
            +
                  statements.map do |stmt|
         | 
| 110 | 
            +
                    # Ensure each statement ends with a semicolon
         | 
| 111 | 
            +
                    stmt.end_with?(';') ? stmt : "#{stmt};"
         | 
| 112 | 
            +
                  end
         | 
| 104 113 | 
             
                end
         | 
| 105 114 |  | 
| 106 115 | 
             
                def extract_conflict_clause(statement)
         |