mirror of
https://github.com/github/rails.git
synced 2026-01-09 14:48:08 -05:00
Merge pull request #12364 from arthurnn/test_fix_validate
Fix query counters when testing with IdentityMap on 3.2
This commit is contained in:
@@ -656,7 +656,9 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
|
||||
def test_inverse_on_before_validate
|
||||
firm = companies(:first_firm)
|
||||
assert_queries(1) do
|
||||
firm.clients_of_firm << Client.new("name" => "Natural Company")
|
||||
client = Client.new("name" => "Natural Company")
|
||||
client.touch_firm_on_validate = true
|
||||
firm.clients_of_firm << client
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -126,8 +126,9 @@ class Client < Company
|
||||
has_many :accounts, :through => :firm
|
||||
belongs_to :account
|
||||
|
||||
attr_accessor :touch_firm_on_validate
|
||||
validate do
|
||||
firm
|
||||
firm if touch_firm_on_validate
|
||||
end
|
||||
|
||||
class RaisedOnSave < RuntimeError; end
|
||||
|
||||
Reference in New Issue
Block a user