1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

test, inline DeveloperWithAggregate, which is used by a single test.

This commit is contained in:
Yves Senn 2014-05-19 14:10:55 +02:00
parent b52e6393d3
commit a0eec57ef0
2 changed files with 7 additions and 7 deletions

View file

@ -774,8 +774,14 @@ class BasicsTest < ActiveRecord::TestCase
assert_equal("c", duped_topic.title)
end
DeveloperSalary = Struct.new(:amount)
def test_dup_with_aggregate_of_same_name_as_attribute
dev = DeveloperWithAggregate.find(1)
developer_with_aggregate = Class.new(ActiveRecord::Base) do
self.table_name = 'developers'
composed_of :salary, :class_name => 'BasicsTest::DeveloperSalary', :mapping => [%w(salary amount)]
end
dev = developer_with_aggregate.find(1)
assert_kind_of DeveloperSalary, dev.salary
dup = nil

View file

@ -76,12 +76,6 @@ class AuditLog < ActiveRecord::Base
belongs_to :unvalidated_developer, :class_name => 'Developer'
end
DeveloperSalary = Struct.new(:amount)
class DeveloperWithAggregate < ActiveRecord::Base
self.table_name = 'developers'
composed_of :salary, :class_name => 'DeveloperSalary', :mapping => [%w(salary amount)]
end
class DeveloperWithBeforeDestroyRaise < ActiveRecord::Base
self.table_name = 'developers'
has_and_belongs_to_many :projects, :join_table => 'developers_projects', :foreign_key => 'developer_id'