Skip to content

Commit 8019ca7

Browse files
committed
Update test data which doesn't reflect expected usage
Topics call `serialize :content`, which means that the values in the database should be YAML encoded, and we would only expect to receive YAML strings to `update_column` and `update_columns`.
1 parent d7f780c commit 8019ca7

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

activerecord/test/cases/persistence_test.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -514,14 +514,14 @@ def test_update_column_should_raise_exception_if_new_record
514514

515515
def test_update_column_should_not_leave_the_object_dirty
516516
topic = Topic.find(1)
517-
topic.update_column("content", "Have a nice day")
517+
topic.update_column("content", "--- Have a nice day\n...\n")
518518

519519
topic.reload
520-
topic.update_column(:content, "You too")
520+
topic.update_column(:content, "--- You too\n...\n")
521521
assert_equal [], topic.changed
522522

523523
topic.reload
524-
topic.update_column("content", "Have a nice day")
524+
topic.update_column("content", "--- Have a nice day\n...\n")
525525
assert_equal [], topic.changed
526526
end
527527

@@ -605,14 +605,14 @@ def test_update_columns_should_raise_exception_if_new_record
605605

606606
def test_update_columns_should_not_leave_the_object_dirty
607607
topic = Topic.find(1)
608-
topic.update({ "content" => "Have a nice day", :author_name => "Jose" })
608+
topic.update({ "content" => "--- Have a nice day\n...\n", :author_name => "Jose" })
609609

610610
topic.reload
611-
topic.update_columns({ content: "You too", "author_name" => "Sebastian" })
611+
topic.update_columns({ content: "--- You too\n...\n", "author_name" => "Sebastian" })
612612
assert_equal [], topic.changed
613613

614614
topic.reload
615-
topic.update_columns({ content: "Have a nice day", author_name: "Jose" })
615+
topic.update_columns({ content: "--- Have a nice day\n...\n", author_name: "Jose" })
616616
assert_equal [], topic.changed
617617
end
618618

activerecord/test/fixtures/topics.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ first:
66
written_on: 2003-07-16t15:28:11.2233+01:00
77
last_read: 2004-04-15
88
bonus_time: 2005-01-30t15:28:00.00+01:00
9-
content: Have a nice day
9+
content: "--- Have a nice day\n...\n"
1010
approved: false
1111
replies_count: 1
1212

@@ -15,7 +15,7 @@ second:
1515
title: The Second Topic of the day
1616
author_name: Mary
1717
written_on: 2004-07-15t15:28:00.0099+01:00
18-
content: Have a nice day
18+
content: "--- Have a nice day\n...\n"
1919
approved: true
2020
replies_count: 0
2121
parent_id: 1
@@ -26,7 +26,7 @@ third:
2626
title: The Third Topic of the day
2727
author_name: Carl
2828
written_on: 2012-08-12t20:24:22.129346+00:00
29-
content: I'm a troll
29+
content: "--- I'm a troll\n...\n"
3030
approved: true
3131
replies_count: 1
3232

@@ -35,7 +35,7 @@ fourth:
3535
title: The Fourth Topic of the day
3636
author_name: Carl
3737
written_on: 2006-07-15t15:28:00.0099+01:00
38-
content: Why not?
38+
content: "--- Why not?\n...\n"
3939
approved: true
4040
type: Reply
4141
parent_id: 3
@@ -45,5 +45,5 @@ fifth:
4545
title: The Fifth Topic of the day
4646
author_name: Jason
4747
written_on: 2013-07-13t12:11:00.0099+01:00
48-
content: Omakase
48+
content: "--- Omakase\n...\n"
4949
approved: true

0 commit comments

Comments
 (0)