Skip to content

Commit

Permalink
Extract AR::AttributeMethods#attribute_for_inspect's test code out fr…
Browse files Browse the repository at this point in the history
…om base_test.rb

The method itself got extracted out from ActiveRecored::Base in commit
ceb33f8, but the test code never did.
  • Loading branch information
take committed May 21, 2013
1 parent 24f0099 commit 43168bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 8 additions & 0 deletions activerecord/test/cases/attribute_methods_test.rb
Expand Up @@ -27,6 +27,14 @@ def teardown
ActiveRecord::Base.send(:attribute_method_matchers).concat(@old_matchers) ActiveRecord::Base.send(:attribute_method_matchers).concat(@old_matchers)
end end


def test_attribute_for_inspect
t = topics(:first)
t.title = "The First Topic Now Has A Title With\nNewlines And More Than 50 Characters"

assert_equal %("#{t.written_on.to_s(:db)}"), t.attribute_for_inspect(:written_on)
assert_equal '"The First Topic Now Has A Title With\nNewlines And M..."', t.attribute_for_inspect(:title)
end

def test_attribute_present def test_attribute_present
t = Topic.new t = Topic.new
t.title = "hello there!" t.title = "hello there!"
Expand Down
8 changes: 0 additions & 8 deletions activerecord/test/cases/base_test.rb
Expand Up @@ -1228,14 +1228,6 @@ def test_assert_queries
assert_no_queries { assert true } assert_no_queries { assert true }
end end


def test_attribute_for_inspect
t = topics(:first)
t.title = "The First Topic Now Has A Title With\nNewlines And More Than 50 Characters"

assert_equal %("#{t.written_on.to_s(:db)}"), t.attribute_for_inspect(:written_on)
assert_equal '"The First Topic Now Has A Title With\nNewlines And M..."', t.attribute_for_inspect(:title)
end

def test_becomes def test_becomes
assert_kind_of Reply, topics(:first).becomes(Reply) assert_kind_of Reply, topics(:first).becomes(Reply)
assert_equal "The First Topic", topics(:first).becomes(Reply).title assert_equal "The First Topic", topics(:first).becomes(Reply).title
Expand Down

0 comments on commit 43168bd

Please sign in to comment.