Permalink
Browse files

don't change class definition in test case

  • Loading branch information...
1 parent 124c97f commit c347b3c06c2867badce5e22ecfbed3e972960c29 @joshsusser joshsusser committed Nov 29, 2011
Showing with 4 additions and 6 deletions.
  1. +0 −6 activerecord/test/cases/associations_test.rb
  2. +4 −0 activerecord/test/models/post.rb
@@ -286,12 +286,6 @@ def test_association_methods_override_attribute_methods_of_same_name
end
def test_model_method_overrides_association_method
- Post.class_eval <<-"RUBY"
- has_one :first_comment, :class_name => 'Comment', :order => 'id ASC'
- def first_comment
- super.body
- end
- RUBY
assert_equal(comments(:greetings).body, posts(:welcome).first_comment)
end
end
@@ -24,6 +24,10 @@ def greeting
belongs_to :author_with_posts, :class_name => "Author", :foreign_key => :author_id, :include => :posts
belongs_to :author_with_address, :class_name => "Author", :foreign_key => :author_id, :include => :author_address
+ def first_comment
+ super.body
+ end
+ has_one :first_comment, :class_name => 'Comment', :order => 'id ASC'
has_one :last_comment, :class_name => 'Comment', :order => 'id desc'
scope :with_special_comments, :joins => :comments, :conditions => {:comments => {:type => 'SpecialComment'} }

0 comments on commit c347b3c

Please sign in to comment.