on tests: dont always touch firm on validate

This commit is contained in:
Arthur Neves
2013-09-25 19:50:42 -04:00
parent fdc3c08e55
commit e1bb9fc671
2 changed files with 5 additions and 2 deletions

View File

@@ -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

View File

@@ -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