aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/callbacks_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Change the empty block style to have space inside of the blockRafael Mendonça França2018-09-251-3/+3
|
* Merge pull request #30919 from seanlinsley/17622-before_save_strict_argumentsRyuta Kamizono2018-07-231-0/+27
|\ | | | | | | Add strict argument checking to ActiveRecord callbacks
| * add strict argument checking to ActiveRecord callbacksSean Linsley2018-07-221-0/+23
|/ | | | This ends up adding it to all save-related callbacks defined in `ActiveRecord::DefineCallbacks`, including e.g. `after_create`. Which should be fine: they didn't support `:on` in the first place.
* Replace `assert !` with `assert_not`Daniel Colson2018-04-191-13/+13
| | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-5/+5
|
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* 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
|
* Remove deprecated behavior that halts callbacks when the return is falseRafael Mendonça França2017-02-071-110/+0
|
* Remove deprecated passing string to define callbackRyuta Kamizono2017-02-041-47/+0
| | | | And raise `ArgumentError` when passing string to define callback.
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-051-2/+2
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* assert_equal takes expectation firstAkira Matsuda2016-12-261-4/+4
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-6/+6
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* code gardening: removes redundant selfsXavier Noria2016-08-081-1/+1
| | | | | | | | | A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
* applies remaining conventions across the projectXavier Noria2016-08-061-2/+0
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-7/+7
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-14/+14
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* systematic revision of =~ usage in ARXavier Noria2016-07-231-1/+1
| | | | | Where appropriatei, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
* Deprecate passing string to define callback.yui-knk2015-12-161-1/+1
|
* AR::RecordNotSaved & RecordNotDestroyed should include an error messageYuki Nishijima2015-05-011-0/+2
| | | | | | | When `AR::Base.save!` or `AR::Base.destroy!` is called and an exception is raised, the exception doesn't have any error message or has a weird message like `#<FailedBulb:0x0000000907b4b8>`. Give a better message so we can easily understand why it's failing to save/destroy.
* after_commit runs after transactions with non-joinable parentsbrainopia2015-01-161-3/+18
| | | | | | after_commit callbacks run after committing a transaction whose parent is not `joinable?`: un-nested transactions, transactions within test cases, and transactions in `console --sandbox`.
* Merge pull request #17227 from claudiob/explicitly-abort-callbacksRafael Mendonça França2015-01-031-20/+146
|\ | | | | | | | | | | | | Introduce explicit way of halting callback chains by throwing :abort. Deprecate current implicit behavior of halting callback chains by returning `false` in apps ported to Rails 5.0. Completely remove that behavior in brand new Rails 5.0 apps. Conflicts: railties/CHANGELOG.md
| * Deprecate `false` as the way to halt AR callbacksclaudiob2015-01-021-20/+146
|/ | | | | | | | | | Before this commit, returning `false` in an ActiveRecord `before_` callback such as `before_create` would halt the callback chain. After this commit, the behavior is deprecated: will still work until the next release of Rails but will also display a deprecation warning. The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
* Remove unused "Developer" fixtures from testsclaudiob2014-12-081-46/+0
| | | | | The `RecursiveCallbackDeveloper` and `ImmutableMethodDeveloper` classes are not used anymore in tests, and neither is the `@cancelled` variable.
* Add #record attribute to RecordNotFound and RecordDestroyed exceptions.Recursive Madman2014-11-261-2/+4
| | | | This allows these exceptions to be handled generically in conjunction with RecordInvalid.
* Build fix when running in isolationArun Agrawal2014-11-141-0/+2
| | | | | `Computer` class needs to be require See #17217 for more details
* callbacks are wrapped with lambdasAaron Patterson2013-05-101-1/+1
|
* Fix some typos in AR- CHANGELOG, tests, method doc. fixedVipul A M2013-03-201-1/+1
|
* Revert "Merge pull request #8989 from robertomiranda/use-rails-4-find-by"Guillermo Iguaran2013-01-181-1/+1
| | | | | This reverts commit 637a7d9d357a0f3f725b0548282ca8c5e7d4af4a, reversing changes made to 5937bd02dee112646469848d7fe8a8bfcef5b4c1.
* User Rails 4 find_byrobertomiranda2013-01-181-1/+1
|
* Fix collisions with before and after validation callbacks.John Foley2012-09-231-0/+49
| | | | | | This commit allows a user to do something like: before_validation :do_stuff, :on => [ :create, :update ] after_validation :do_more, :on => [ :create, :update ]
* + ActiveRecord::Base#destroy!Marc-Andre Lafortune2012-06-061-0/+2
|
* Deprecate set_table_name in favour of self.table_name= or defining your own ↵Jon Leighton2011-11-291-7/+7
| | | | method.
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* Cleanup deprecation warnings in active recordCarlos Antonio da Silva2010-09-061-9/+8
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* fisting after_rollback and after commit callbacksAaron Patterson2010-08-201-1/+6
|
* Remove test ordering bug by using another classEvan Phoenix2010-03-221-4/+7
|
* squelching more warnings in the AR tests. [#4218 state:resolved]Aaron Patterson2010-03-181-1/+1
| | | | Signed-off-by: wycats <wycats@gmail.com>
* Ensure before_validation and after_validation accepts :on as option.José Valim2010-01-061-1/+44
|
* Refactor new callbacks and AR implementation.José Valim2009-09-081-3/+3
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Changed ActiveRecord to use new callbacks and speed up observers by only ↵José Valim2009-09-081-61/+57
| | | | | | notifying events that are actually being consumed. Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.Jeremy Kemper2009-03-081-2/+2
| | | | [#1617 state:resolved]
* Fixed broken after_save callback; was being called when before_create was ↵Michael Lovitt2009-01-161-3/+41
| | | | | | | canceled or before_update was canceled Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1735 state:committed]
* Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/railsJeremy Kemper2008-01-211-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Move tests to casesJeremy Kemper2008-01-181-0/+400
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de