1. 29 5月, 2019 1 次提交
  2. 28 5月, 2019 1 次提交
  3. 22 5月, 2019 2 次提交
  4. 21 5月, 2019 2 次提交
    • R
      Fall back to type casting from the connection adapter · 82a54be0
      Ryuta Kamizono 提交于
      Unfortunately, a11a8ff7 had no effect as long as using bind param, and
      was not tested.
      
      This ensures making the intent of a11a8ff7, which fall back to type
      casting from the connection adapter.
      
      Fixes #35205.
      
      ```
      % ARCONN=postgresql bundle exec ruby -w -Itest test/cases/relation/where_test.rb -n test_type_casting_nested_joins
      Using postgresql
      Run options: -n test_type_casting_nested_joins --seed 55730
      
      # Running:
      
      E
      
      Error:
      ActiveRecord::WhereTest#test_type_casting_nested_joins:
      ActiveRecord::StatementInvalid: PG::InvalidTextRepresentation: ERROR:  invalid input syntax for integer: "2-foo"
      
      rails test test/cases/relation/where_test.rb:30
      
      Finished in 0.245778s, 4.0687 runs/s, 0.0000 assertions/s.
      1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
      ```
      82a54be0
    • R
      Except SCHEMA SQLs in `capture_sql` · 0810c076
      Ryuta Kamizono 提交于
      Testing the result of `capture_sql` is fragile, it is due to whether
      SCHEMA SQLs are executed or not depends on whether schema cache is
      filled or not.
      
      https://buildkite.com/rails/rails/builds/61248#a5b9dc59-ff0c-40c0-b56e-0895662fbc4c/993-1004
      https://buildkite.com/rails/rails/builds/61248#1157b389-f2c7-4554-b6e5-a37624a0e74a/996-1005
      
      I've confirmed all `capture_sql` use cases in our code base, all cases
      won't expect SCHEMA SQLs are included.
      
      ```
      % git grep -n capture_sql
      test/cases/associations/belongs_to_associations_test.rb:202:    sql = capture_sql { comment.post }
      test/cases/associations/belongs_to_associations_test.rb:204:    assert_not_equal sql, capture_sql { comment.post }
      test/cases/associations/has_many_associations_test.rb:169:    sql = capture_sql { post.comments.to_a }
      test/cases/associations/has_many_associations_test.rb:171:    assert_not_equal sql, capture_sql { post.comments.to_a }
      test/cases/associations/has_many_associations_test.rb:276:    expected_sql = capture_sql { author.thinking_posts.delete_all }
      test/cases/associations/has_many_associations_test.rb:281:    loaded_sql = capture_sql { author.thinking_posts.delete_all }
      test/cases/associations/has_many_associations_test.rb:289:    expected_sql = capture_sql { author.posts.delete_all }
      test/cases/associations/has_many_associations_test.rb:294:    loaded_sql = capture_sql { author.posts.delete_all }
      test/cases/associations/left_outer_join_association_test.rb:22:      queries = capture_sql do
      test/cases/associations/left_outer_join_association_test.rb:49:    queries = capture_sql { Author.left_outer_joins(:posts).to_a }
      test/cases/associations/left_outer_join_association_test.rb:54:    queries = capture_sql { Author.joins(:posts).left_outer_joins(:posts).to_a }
      test/cases/associations/left_outer_join_association_test.rb:60:    queries = capture_sql { Author.left_outer_joins({}).to_a }
      test/cases/associations/left_outer_join_association_test.rb:65:    queries = capture_sql { Author.left_outer_joins([]).to_a }
      test/cases/associations/left_outer_join_association_test.rb:78:    queries = capture_sql { Author.left_outer_joins(:essays).to_a }
      test/cases/associations_test.rb:384:    log = capture_sql do
      test/cases/associations_test.rb:399:    log = capture_sql do
      test/cases/associations_test.rb:414:    log = capture_sql do
      test/cases/associations_test.rb:429:    log = capture_sql do
      test/cases/associations_test.rb:444:    log = capture_sql do
      test/cases/associations_test.rb:459:    log = capture_sql do
      test/cases/reflection_test.rb:307:    expected_sql = capture_sql { hotel.recipes.to_a }
      test/cases/reflection_test.rb:312:    loaded_sql = capture_sql { hotel.recipes.to_a }
      test/cases/relation_test.rb:212:      queries = capture_sql { Author.joins(:posts).merge(Post.joins(:comments)).to_a }
      test/cases/relation_test.rb:232:      queries = capture_sql { Post.joins(:author, :categorizations).merge(Author.select(:id)).merge(categorizations_with_authors).to_a }
      test/cases/relation_test.rb:347:      log = capture_sql do
      test/cases/scoping/relation_scoping_test.rb:146:      log = capture_sql do
      test/cases/scoping/relation_scoping_test.rb:159:    log = capture_sql do
      test/cases/test_case.rb:33:    def capture_sql
      test/cases/test_case.rb:41:      capture_sql { yield }
      ```
      0810c076
  5. 19 5月, 2019 1 次提交
    • R
      Implicit through table joins should be appeared before user supplied joins · 7412b7f8
      Ryuta Kamizono 提交于
      #36293 was an issue for through association with `joins` for a long
      time, but since #35864 through association with `left_joins` would also
      be affected by the issue.
      
      Implicit through table joins should be appeared before user supplied
      joins, otherwise loading through association with joins will cause a
      statement invalid error.
      
      Fixes #36293.
      
      ```
      % ARCONN=postgresql bundle exec ruby -w -Itest test/cases/associations/has_many_through_associations_test
      .rb -n test_through_association_with_joins
      Using postgresql
      Run options: -n test_through_association_with_joins --seed 7116
      
      # Running:
      
      E
      
      Error:
      HasManyThroughAssociationsTest#test_through_association_with_joins:
      ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  missing FROM-clause entry for table "posts"
      LINE 1: ... "comments_posts" ON "comments_posts"."post_id" = "posts"."i...
                                                                   ^
      : SELECT "comments".* FROM "comments" INNER JOIN "comments" "comments_posts" ON "comments_posts"."post_id" = "posts"."id" INNER JOIN "posts" ON "comments"."post_id" = "posts"."id" WHERE "posts"."author_id" = $1
      
      rails test test/cases/associations/has_many_through_associations_test.rb:61
      
      Finished in 0.388657s, 2.5730 runs/s, 0.0000 assertions/s.
      1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
      ```
      7412b7f8
  6. 15 5月, 2019 1 次提交
  7. 13 5月, 2019 1 次提交
    • R
      Don't track implicit `touch` mutation · dcb82590
      Ryuta Kamizono 提交于
      This partly reverts the effect of d1107f4d.
      
      d1107f4d makes `touch` tracks the mutation whether the `touch` is
      occurred by explicit or not.
      
      Existing apps expects that the previous changes tracks only the changes
      which is explicit action by users.
      
      I'd revert the implicit `touch` mutation tracking since I'd not like to
      break existing apps.
      
      Fixes #36219.
      dcb82590
  8. 07 5月, 2019 2 次提交
    • Y
      Remove ignored_sql from SQLCounter by adding "TRANSACTION" to log name · 6a32e8aa
      Yasuo Honda 提交于
      This commit adds "TRANSACTION" to savepoint and commit, rollback statements
      because none of savepoint statements were removed by #36153 since they are not "SCHEMA" statements.
      
      Although, only savepoint statements can be labeled as "TRANSACTION"
      I think all of transaction related method should add this label.
      
      Follow up #36153
      6a32e8aa
    • R
      Should attempt `committed!`/`rolledback!` to all enrolled records in the transaction · 718a32ca
      Ryuta Kamizono 提交于
      Currently, `committed!`/`rolledback!` will only be attempted for the
      first enrolled record in the transaction, that will cause some
      problematic behaviors.
      
      The first one problem, `clear_transaction_record_state` won't be called
      even if the transaction is finalized except the first enrolled record.
      This means that de-duplicated records in the transaction won't refer
      latest state (e.g. won't happen rolling back record state).
      
      The second one problem, the enrolled order is not always the same as the
      order in which the actions actually happened, the first enrolled record
      may succeed no actions (e.g. `destroy` has already succeeded on another
      record during `before_destroy`), it will lose to fire any transactional
      callbacks.
      
      To avoid both problems, we should attempt `committed!`/`rolledback!` to
      all enrolled records in the transaction.
      718a32ca
  9. 03 5月, 2019 1 次提交
    • Y
      Remove redundant `test_too_many_binds` · 36483cdb
      Yasuo Honda 提交于
      with `ActiveRecord::BindParameterTest#test_too_many_binds`
      
      sqlite adapter has its own `bind_params_length`, `ActiveRecord::BindParameterTest#test_too_many_binds` respects it.
      
      * Modified `ActiveRecord::BindParameterTest#test_too_many_binds` to show `bind_params_length` value
      
      ```
      $ git diff
      diff --git a/activerecord/test/cases/bind_parameter_test.rb b/activerecord/test/cases/bind_parameter_test.rb
      index 85685d1d00..83cd07f1d7 100644
      --- a/activerecord/test/cases/bind_parameter_test.rb
      +++ b/activerecord/test/cases/bind_parameter_test.rb
      @@ -108,6 +108,7 @@ def test_statement_cache_with_sql_string_literal
      
             def test_too_many_binds
               bind_params_length = @connection.send(:bind_params_length)
      +        p bind_params_length
      
               topics = Topic.where(id: (1 .. bind_params_length).to_a << 2**63)
               assert_equal Topic.count, topics.count
      $
      ```
      
      * Executed modified `ActiveRecord::BindParameterTest#test_too_many_binds`
      
      ```
      $ bin/test test/cases/bind_parameter_test.rb -n test_too_many_binds
      Using sqlite3
      Run options: -n test_too_many_binds --seed 47321
      
      999
      .
      
      Finished in 0.075249s, 13.2892 runs/s, 26.5784 assertions/s.
      1 runs, 2 assertions, 0 failures, 0 errors, 0 skips
      $
      ```
      36483cdb
  10. 02 5月, 2019 2 次提交
  11. 01 5月, 2019 1 次提交
    • Y
      Remove database specific sql statements from SQLCounter · 6030110f
      Yasuo Honda 提交于
      Every database executes different type of sql statement to get metadata then `ActiveRecord::TestCase` ignores these database specific sql statements to make `assert_queries` or `assert_no_queries` work consistently.
      
      Connection adapter already labels these statement by setting "SCHEMA" argument, this pull request makes use of "SCHEMA" argument to ignore metadata queries.
      
      Here are the details of these changes:
      
      * PostgresqlConnectionTest
      
      Each of PostgresqlConnectionTest modified just executes corresponding methods
      
      https://github.com/rails/rails/blob/fef174f5c524edacbcad846d68400e7fe114a15a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb#L182-L195
      
      ```ruby
              # Returns the current database encoding format.
              def encoding
                query_value("SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = current_database()", "SCHEMA")
              end
      
              # Returns the current database collation.
              def collation
                query_value("SELECT datcollate FROM pg_database WHERE datname = current_database()", "SCHEMA")
              end
      
              # Returns the current database ctype.
              def ctype
                query_value("SELECT datctype FROM pg_database WHERE datname = current_database()", "SCHEMA")
              end
      ```
      
      * BulkAlterTableMigrationsTest
      
      mysql2 adapter executes `SHOW KEYS FROM ...` to see if there is an index already created as below. I think the main concerns of these tests are how each database adapter creates or drops indexes then ignoring  `SHOW KEYS FROM` statement makes sense.
      
      https://github.com/rails/rails/blob/fef174f5c524edacbcad846d68400e7fe114a15a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb#L11
      
      ```ruby
                execute_and_free("SHOW KEYS FROM #{quote_table_name(table_name)}", "SCHEMA") do |result|
      ```
      
      * Temporary change not included in this commit to show which statements executed
      
      ```diff
      $ git diff
      diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
      index 8e8ed494d9..df05f9bd16 100644
      --- a/activerecord/test/cases/migration_test.rb
      +++ b/activerecord/test/cases/migration_test.rb
      @@ -854,7 +854,7 @@ def test_adding_indexes
      
             classname = ActiveRecord::Base.connection.class.name[/[^:]*$/]
             expected_query_count = {
      -        "Mysql2Adapter"     => 3, # Adding an index fires a query every time to check if an index already exists or not
      +        "Mysql2Adapter"     => 1, # Adding an index fires a query every time to check if an index already exists or not
               "PostgreSQLAdapter" => 2,
             }.fetch(classname) {
               raise "need an expected query count for #{classname}"
      @@ -886,7 +886,7 @@ def test_removing_index
      
             classname = ActiveRecord::Base.connection.class.name[/[^:]*$/]
             expected_query_count = {
      -        "Mysql2Adapter"     => 3, # Adding an index fires a query every time to check if an index already exists or not
      +        "Mysql2Adapter"     => 1, # Adding an index fires a query every time to check if an index already exists or not
               "PostgreSQLAdapter" => 2,
             }.fetch(classname) {
               raise "need an expected query count for #{classname}"
      $
      ```
      
      * Executed these modified tests
      
      ```ruby
      $ ARCONN=mysql2 bin/test test/cases/migration_test.rb -n /index/
      Using mysql2
      Run options: -n /index/ --seed 8462
      
      F
      
      Failure:
      BulkAlterTableMigrationsTest#test_adding_indexes [/home/yahonda/git/rails/activerecord/test/cases/migration_test.rb:863]:
      3 instead of 1 queries were executed.
      Queries:
      SHOW KEYS FROM `delete_me`
      SHOW KEYS FROM `delete_me`
      ALTER TABLE `delete_me` ADD UNIQUE INDEX `awesome_username_index`  (`username`), ADD  INDEX `index_delete_me_on_name_and_age`  (`name`, `age`).
      Expected: 1
        Actual: 3
      
      bin/test test/cases/migration_test.rb:848
      
      F
      
      Failure:
      BulkAlterTableMigrationsTest#test_removing_index [/home/yahonda/git/rails/activerecord/test/cases/migration_test.rb:895]:
      3 instead of 1 queries were executed.
      Queries:
      SHOW KEYS FROM `delete_me`
      SHOW KEYS FROM `delete_me`
      ALTER TABLE `delete_me` DROP INDEX `index_delete_me_on_name`, ADD UNIQUE INDEX `new_name_index`  (`name`).
      Expected: 1
        Actual: 3
      
      bin/test test/cases/migration_test.rb:879
      
      ..
      
      Finished in 0.379245s, 10.5473 runs/s, 7.9105 assertions/s.
      4 runs, 3 assertions, 2 failures, 0 errors, 0 skips
      $
      ```
      
      * ActiveRecord::ConnectionAdapters::Savepoints
      
      Left `self.ignored_sql` to ignore savepoint related statements because these SQL statements are not related "SCHEMA"
      
      ```
      self.ignored_sql = [/^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/]
      ```
      
      https://github.com/rails/rails/blob/fef174f5c524edacbcad846d68400e7fe114a15a/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb#L10-L20
      
      ```ruby
            def create_savepoint(name = current_savepoint_name)
              execute("SAVEPOINT #{name}")
            end
      
            def exec_rollback_to_savepoint(name = current_savepoint_name)
              execute("ROLLBACK TO SAVEPOINT #{name}")
            end
      
            def release_savepoint(name = current_savepoint_name)
              execute("RELEASE SAVEPOINT #{name}")
            end
      ```
      6030110f
  12. 30 4月, 2019 1 次提交
  13. 27 4月, 2019 1 次提交
    • R
      Fix merging left_joins to maintain its own `join_type` context · 20ede2e2
      Ryuta Kamizono 提交于
      This fixes a regression for #35864.
      
      Usually, stashed joins (mainly eager loading) are performed as LEFT
      JOINs.
      But the case of merging joins/left_joins of different class, that
      (stashed) joins are performed as the same `join_type` as the parent
      context for now.
      Since #35864, both (joins/left_joins) stashed joins might be contained
      in `joins_values`, so each stashed joins should maintain its own
      `join_type` context.
      
      Fixes #36103.
      20ede2e2
  14. 25 4月, 2019 1 次提交
  15. 24 4月, 2019 2 次提交
  16. 22 4月, 2019 1 次提交
    • R
      PERF: 20% faster pk attribute access · b6828fc9
      Ryuta Kamizono 提交于
      I've realized that `user.id` is 20% slower than `user.name` in the
      benchmark (https://github.com/rails/rails/pull/35987#issuecomment-483882480).
      
      The reason that performance difference is that `self.class.primary_key`
      method call is a bit slow.
      
      Avoiding that method call will make almost attribute access faster and
      `user.id` will be completely the same performance with `user.name`.
      
      Before (02b5b8cb):
      
      ```
      Warming up --------------------------------------
                   user.id   140.535k i/100ms
                user['id']    96.549k i/100ms
                 user.name   158.110k i/100ms
              user['name']    94.507k i/100ms
             user.changed?    19.003k i/100ms
       user.saved_changes?    25.404k i/100ms
      Calculating -------------------------------------
                   user.id      2.231M (± 0.9%) i/s -     11.243M in   5.040066s
                user['id']      1.310M (± 1.3%) i/s -      6.565M in   5.012607s
                 user.name      2.683M (± 1.2%) i/s -     13.439M in   5.009392s
              user['name']      1.322M (± 0.9%) i/s -      6.615M in   5.003239s
             user.changed?    201.999k (±10.9%) i/s -      1.007M in   5.091195s
       user.saved_changes?    258.214k (±17.1%) i/s -      1.245M in   5.007421s
      ```
      
      After (this change):
      
      ```
      Warming up --------------------------------------
                   user.id   158.364k i/100ms
                user['id']   106.412k i/100ms
                 user.name   158.644k i/100ms
              user['name']   107.518k i/100ms
             user.changed?    19.082k i/100ms
       user.saved_changes?    24.886k i/100ms
      Calculating -------------------------------------
                   user.id      2.768M (± 1.1%) i/s -     13.936M in   5.034957s
                user['id']      1.507M (± 2.1%) i/s -      7.555M in   5.017211s
                 user.name      2.727M (± 1.5%) i/s -     13.643M in   5.004766s
              user['name']      1.521M (± 1.3%) i/s -      7.634M in   5.018321s
             user.changed?    200.865k (±11.1%) i/s -    992.264k in   5.044868s
       user.saved_changes?    269.652k (±10.5%) i/s -      1.344M in   5.077972s
      ```
      b6828fc9
  17. 19 4月, 2019 6 次提交
  18. 17 4月, 2019 1 次提交
    • L
      Add collection cache versioning · 4f2ac80d
      Lachlan Sylvester 提交于
      Cache versioning enables the same cache key to be reused when the object
      being cached changes by moving the volatile part of the cache key out of
      the cache key and into a version that is embedded in the cache entry.
      
      This is already occurring when the object being cached is an
      `ActiveRecord::Base`, but when caching an `ActiveRecord::Relation`
      we are currently still putting the volatile information (max updated at
      and count) as part of the cache key.
      
      This PR moves the volatile part of the relations `cache_key` into the
      `cache_version` to support recycling cache keys for
      `ActiveRecord::Relation`s.
      4f2ac80d
  19. 16 4月, 2019 2 次提交
    • K
      Bump RuboCop to 0.67.2 · c6379fd2
      Koichi ITO 提交于
      Performance cops will be extracted from RuboCop to RuboCop Performance
      when next RuboCop 0.68 will be released.
      https://github.com/rubocop-hq/rubocop/issues/5977
      
      RuboCop 0.67 is its transition period.
      
      Since rails/rails repository uses Performance cops, This PR added
      rubocop-performance gem to Gemfile.
      
      And this PR fixes some offenses using the following auto-correct.
      
      ```console
      % bundle exec rubocop -a
      
      Offenses:
      
      activerecord/test/cases/connection_adapters/connection_handlers_multi_db_test.rb:212:26:
      C: [Corrected] Layout/SpaceAroundOperators: Operator =
      > should be surrounded by a single space.
                    "primary"  => { adapter: "sqlite3", database: "db/primary.sqlite3" }
                               ^^
      activerecord/test/cases/connection_adapters/connection_handlers_multi_db_test.rb:239:26:
      C: [Corrected] Layout/SpaceAroundOperators: Operator => should be
      surrounded by a single space.
                    "primary"  => { adapter: "sqlite3", database: "db/primary.sqlite3" }
                               ^^
      actionview/test/template/resolver_shared_tests.rb:1:1: C: [Corrected]
      Style/FrozenStringLiteralComment: Missing magic comment #
      frozen_string_literal: true.
      module ResolverSharedTests
      ^
      actionview/test/template/resolver_shared_tests.rb:10:33: C: [Corrected]
      Layout/SpaceAroundEqualsInParameterDefault: Surrounding space missing in
      default value assignment.
        def with_file(filename, source="File at #{filename}")
                                      ^
      actionview/test/template/resolver_shared_tests.rb:106:5: C: [Corrected]
      Rails/RefuteMethods: Prefer assert_not_same over refute_same.
          refute_same a, b
          ^^^^^^^^^^^
      
      2760 files inspected, 5 offenses detected, 5 offenses corrected
      ```
      c6379fd2
    • R
      Fix dirty tracking after rollback. · 63ff495b
      Ryuta Kamizono 提交于
      Currently the rollback only restores primary key value, `new_record?`,
      `destroyed?`, and `frozen?`. Since the `save` clears current dirty
      attribute states, retrying save after rollback will causes no change
      saved if partial writes is enabled (by default).
      
      This makes `remember_transaction_record_state` remembers original values
      then restores dirty attribute states after rollback.
      
      Fixes #15018.
      Fixes #30167.
      Fixes #33868.
      Fixes #33443.
      Closes #33444.
      Closes #34504.
      63ff495b
  20. 15 4月, 2019 2 次提交
    • R
      Fix dirty tracking for `touch` · d1107f4d
      Ryuta Kamizono 提交于
      Before this fix, `touch` only clears dirty tracking for touched
      attributes, doesn't track saved (touched) changes.
      
      This fixes that tracks saved changes and carry over remaining changes.
      
      Fixes #33429.
      Closes #34306.
      d1107f4d
    • Y
      make change_column_comment and change_table_comment invertible · 1fe71ebd
      Yoshiyuki Kinjo 提交于
      We can revert migrations using `change_column_comment` or
      `change_table_comment` at current master.
      However, results are not what we expect: comments are remained in new
      status.
      This change tells previous comment to these methods in a way like
      `change_column_default`.
      1fe71ebd
  21. 14 4月, 2019 1 次提交
    • R
      Don't expose `add_to_transaction` · 533dd8a6
      Ryuta Kamizono 提交于
      `add_to_transaction` was added at da840d13, but it should not be called
      by except internal, since `remember_transaction_record_state` should be
      called only once before saving.
      
      And also, currently `add_to_transaction` doesn't always add the record
      to transaction since da8de911, that is the reason hard to use that even
      in internal.
      
      Even if `add_to_transaction` ensure to add the record to transaction,
      that is an internal concern, people don't need to explicitly call
      `add_to_transaction`.
      533dd8a6
  22. 13 4月, 2019 5 次提交
    • C
      Add validation to subclass in tests to avoid polluting parent class · 42a8340a
      Chris Salzberg 提交于
      These two tests currently both define acceptance validators on the same
      class, Topic. This means that in either one test or the other, there are
      not one but *two* instances of the LazilyDefineAttributes module
      builder in the class' ancestors, which can result in unpredictable
      results.
      
      Subclassing Topic in each test avoids conflicts.
      42a8340a
    • Y
      use PostgreSQL's bulk_alter_table implementation · 53f1b3e5
      Yoshiyuki Kinjo 提交于
      Running this migration on mysql at current master fails
      because `add_references_for_alter` is missing.
      
      ```
      change_table :users, bulk: true do |t|
        t.references :article
      end
      ```
      
      This is also true for postgresql adapter,
      but its `bulk_alter_table` implementation can fallback in such case.
      postgresql's implementation is desirable to prevent unknown failure like this.
      53f1b3e5
    • R
      Auto-correct `Style/StringLiterals` cop offences · cc6bff3d
      Ryuta Kamizono 提交于
      Somehow Code Climate is not working as expected for now?
      cc6bff3d
    • Y
      Fix `presicion` -> `precision` · f95c132e
      yuuji.yaginuma 提交于
      This fix is necessary to test precision's default correctly.
      f95c132e
    • G
      Fix test flakyness due to `test_truncate_tables` · cd50e952
      Guilherme Mansur 提交于
      `Truncate Tables posts` will also reset the `AUTOINCREMENT` this causes
      a situation where if a test suite that uses the `taggings` fixtures runs
      and subsequently the `test_truncate_tables` run, newly created posts
      would reference the `tagging` in the database. This commit resest the
      state of the posts table after the `connection.truncate` call in the
      `test_truncate_tables`, as well as all other tests that call `trucate`
      This ensures the associations and db state remain consistent after the
      tests.
      
      Fixes: https://github.com/rails/rails/issues/35941
      cd50e952
  23. 12 4月, 2019 2 次提交