aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/testing/method_call_assertions.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add method_call_assertions and use them instead of Mochautilum2018-08-131-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* applies new string literal convention in activesupport/libXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Cleaned up generators tests using internal assertion helperRonak Jangir2015-08-201-2/+4
|
* Replacing lambda with proc getting argument error because of it.Ronak Jangir2015-08-171-1/+1
|
* Added helper methods to stub any instanceRonak Jangir2015-08-131-1/+5
|
* Add multiple expected calls to assert_called_with.Kasper Timm Hansen2015-07-101-1/+6
|
* Add method call assertions for internal use.Kasper Timm Hansen2015-07-081-0/+30
Add `assert_called` and `assert_not_called` to boil down the boilerplate we need to write to assert methods are called certain number of times.