aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/dup_test.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-03-22 11:08:04 -0300
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-03-22 22:41:10 -0300
commitb332891b2ab4188e9d39737f4d214812afa3ce2c (patch)
tree72974490c032f9a753f3fc41d335a049c8abbc05 /activerecord/test/cases/dup_test.rb
parentb714140f4df50d102e70b0151bbb3a09e470d61a (diff)
downloadrails-b332891b2ab4188e9d39737f4d214812afa3ce2c.tar.gz
rails-b332891b2ab4188e9d39737f4d214812afa3ce2c.tar.bz2
rails-b332891b2ab4188e9d39737f4d214812afa3ce2c.zip
Add order to tests that rely on db ordering, to fix failing tests on pg
Also skip persistente tests related to UPDATE + ORDER BY for postgresql PostgreSQL does not support updates with order by, and these tests are failing randomly depending on the fixture loading order now.
Diffstat (limited to 'activerecord/test/cases/dup_test.rb')
-rw-r--r--activerecord/test/cases/dup_test.rb19
1 files changed, 9 insertions, 10 deletions
diff --git a/activerecord/test/cases/dup_test.rb b/activerecord/test/cases/dup_test.rb
index 0236f9b0a1..303f616c61 100644
--- a/activerecord/test/cases/dup_test.rb
+++ b/activerecord/test/cases/dup_test.rb
@@ -10,14 +10,14 @@ module ActiveRecord
end
def test_not_readonly
- topic = Topic.first
+ topic = Topic.order(:id).first
duped = topic.dup
assert !duped.readonly?, 'should not be readonly'
end
def test_is_readonly
- topic = Topic.first
+ topic = Topic.order(:id).first
topic.readonly!
duped = topic.dup
@@ -25,7 +25,7 @@ module ActiveRecord
end
def test_dup_not_persisted
- topic = Topic.first
+ topic = Topic.order(:id).first
duped = topic.dup
assert !duped.persisted?, 'topic not persisted'
@@ -33,20 +33,20 @@ module ActiveRecord
end
def test_dup_has_no_id
- topic = Topic.first
+ topic = Topic.order(:id).first
duped = topic.dup
assert_nil duped.id
end
def test_dup_with_modified_attributes
- topic = Topic.first
+ topic = Topic.order(:id).first
topic.author_name = 'Aaron'
duped = topic.dup
assert_equal 'Aaron', duped.author_name
end
def test_dup_with_changes
- dbtopic = Topic.first
+ dbtopic = Topic.order(:id).first
topic = Topic.new
topic.attributes = dbtopic.attributes
@@ -61,7 +61,7 @@ module ActiveRecord
end
def test_dup_topics_are_independent
- topic = Topic.first
+ topic = Topic.order(:id).first
topic.author_name = 'Aaron'
duped = topic.dup
@@ -71,7 +71,7 @@ module ActiveRecord
end
def test_dup_attributes_are_independent
- topic = Topic.first
+ topic = Topic.order(:id).first
duped = topic.dup
duped.author_name = 'meow'
@@ -82,7 +82,7 @@ module ActiveRecord
end
def test_dup_timestamps_are_cleared
- topic = Topic.first
+ topic = Topic.order(:id).first
assert_not_nil topic.updated_at
assert_not_nil topic.created_at
@@ -98,6 +98,5 @@ module ActiveRecord
assert_not_nil new_topic.updated_at
assert_not_nil new_topic.created_at
end
-
end
end