1. 09 10月, 2018 1 次提交
  2. 07 10月, 2018 2 次提交
    • R
      Fix test name to add missing "set" · 2b5b08b8
      Ryuta Kamizono 提交于
      2b5b08b8
    • R
      Fix `AssociationRelation` not to set inverse instance key just like before · 1f8534ca
      Ryuta Kamizono 提交于
      Since #31575, `set_inverse_instance` replaces the foreign key by the
      current owner immediately to make it happen when a record is added to
      collection association.
      
      But `set_inverse_instance` is not only called when a record is added,
      but also when a record is loaded from queries. And also, that loaded
      records are not always associated records for some reason (using `or`,
      `unscope`, `rewhere`, etc).
      
      It is hard to distinguish whether or not we should invoke
      `set_inverse_instance`, but at least we should avoid the undesired
      side-effect which was brought from #31575.
      
      Fixes #34108.
      1f8534ca
  3. 05 10月, 2018 2 次提交
  4. 26 9月, 2018 2 次提交
  5. 25 8月, 2018 2 次提交
  6. 13 8月, 2018 1 次提交
    • U
      Add method_call_assertions and use them instead of Mocha · a72bca82
      utilum 提交于
      Six Mocha calls prove quite resistant to Minitestification. For example,
      if we replace
      
      ```
        ActiveRecord::Associations::HasManyAssociation
          .any_instance
          .expects(:reader)
          .never
      ```
      
      with `assert_not_called`, Minitest wisely raises
      
      ```
      NameError: undefined method `reader' for class `ActiveRecord::Associations::HasManyAssociation'
      ```
      
      as `:reader` comes from a deeply embedded abstract class,
      `ActiveRecord::Associations::CollectionAssociation`.
      
      This patch tackles this difficulty by adding
      `ActiveSupport::Testing::MethodCallAsserts#assert_called_on_instance_of`
      which injects a stubbed method into `klass`, and verifies the number of
      times it is called, similar to `assert_called`. It also adds  a convenience
      method, `assert_not_called_on_instance_of`, mirroring
      `assert_not_called`.
      
      It uses the new method_call_assertions to replace the remaining Mocha
      calls in `ActiveRecord` tests.
      
      [utilum + bogdanvlviv + kspath]
      a72bca82
  7. 07 6月, 2018 1 次提交
    • R
      Fix `collection.create` to could be rolled back by `after_save` · 5dc72378
      Ryuta Kamizono 提交于
      In `_create_record`, explicit `transaction` block requires rollback
      handling manually when `insert_record` is failed.
      
      We need to handle it in `_create_record`, not in `insert_record`, since
      our test cases expect a record added to target and returned even if
      `insert_record` is failed,
      
      Closes #31488.
      5dc72378
  8. 13 5月, 2018 1 次提交
  9. 27 4月, 2018 2 次提交
  10. 26 4月, 2018 2 次提交
  11. 21 4月, 2018 1 次提交
  12. 19 4月, 2018 1 次提交
  13. 30 3月, 2018 1 次提交
  14. 18 2月, 2018 2 次提交
  15. 26 1月, 2018 3 次提交
  16. 27 12月, 2017 1 次提交
  17. 12 12月, 2017 1 次提交
  18. 09 11月, 2017 4 次提交
  19. 18 8月, 2017 1 次提交
  20. 13 8月, 2017 1 次提交
    • R
      Fix `reflection.association_primary_key` for `has_many` associations · b23e8696
      Ryuta Kamizono 提交于
      It is incorrect to treat `options[:primary_key]` as
      `association_primary_key` if `has_many` associations because the
      `:primary_key` means the column on the owner record, not on the
      association record. It will break `ids_reader` and `ids_writer`.
      
      ```ruby
        people(:david).essay_ids
        # => ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'essays.first_name' in 'field list': SELECT `essays`.first_name FROM `essays` WHERE `essays`.`writer_id` = 'David'
      ```
      
      Fixes #14439.
      b23e8696
  21. 20 7月, 2017 1 次提交
  22. 13 7月, 2017 1 次提交
  23. 02 7月, 2017 1 次提交
  24. 01 7月, 2017 1 次提交
  25. 30 6月, 2017 1 次提交
  26. 29 6月, 2017 1 次提交
  27. 28 6月, 2017 1 次提交
  28. 22 6月, 2017 1 次提交