aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-05-19 14:10:55 +0200
committerYves Senn <yves.senn@gmail.com>2014-05-19 14:11:45 +0200
commita0eec57ef0fbbbb2910a46ca65bd5b565ca0534c (patch)
treeea6c3fd9e6b0941bf1e452392e744695bcf9e7d3 /activerecord/test
parentb52e6393d30dcfd95dc24cfe32e143f78b8e0a98 (diff)
downloadrails-a0eec57ef0fbbbb2910a46ca65bd5b565ca0534c.tar.gz
rails-a0eec57ef0fbbbb2910a46ca65bd5b565ca0534c.tar.bz2
rails-a0eec57ef0fbbbb2910a46ca65bd5b565ca0534c.zip
test, inline `DeveloperWithAggregate`, which is used by a single test.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/base_test.rb8
-rw-r--r--activerecord/test/models/developer.rb6
2 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index c88a843282..7c7c1fbfbd 100644
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -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
diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb
index 0a614c3bfd..5bd2f00129 100644
--- a/activerecord/test/models/developer.rb
+++ b/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'