Skip to content
Browse files

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

  • Loading branch information...
1 parent b52e639 commit a0eec57ef0fbbbb2910a46ca65bd5b565ca0534c @senny senny committed May 19, 2014
Showing with 7 additions and 7 deletions.
  1. +7 −1 activerecord/test/cases/base_test.rb
  2. +0 −6 activerecord/test/models/developer.rb
View
8 activerecord/test/cases/base_test.rb
@@ -774,8 +774,14 @@ def test_dup
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
6 activerecord/test/models/developer.rb
@@ -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'

0 comments on commit a0eec57

Please sign in to comment.
Something went wrong with that request. Please try again.