aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2005-10-06 17:13:24 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2005-10-06 17:13:24 +0000
commit164625ca1f41dd93f141033ca1cb36f5c82f6b9b (patch)
treecf0d28bd4936de201df1ee2228cb1e951edc7b4d /activerecord/test
parentebfddf35b9d4ebcdb5be37df77b83b2e1e16df97 (diff)
downloadrails-164625ca1f41dd93f141033ca1cb36f5c82f6b9b.tar.gz
rails-164625ca1f41dd93f141033ca1cb36f5c82f6b9b.tar.bz2
rails-164625ca1f41dd93f141033ca1cb36f5c82f6b9b.zip
Fixup tests for [2474].
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2478 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/base_test.rb20
-rw-r--r--activerecord/test/fixtures/developer.rb2
2 files changed, 11 insertions, 11 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index fd5e439ef4..35c608d809 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -50,8 +50,8 @@ class BasicsTest < Test::Unit::TestCase
end
def test_integers_as_nil
- Topic.update(1, "approved" => "")
- assert_nil Topic.find(1).approved
+ test = AutoId.create('value' => '')
+ assert_nil AutoId.find(test.id).value
end
def test_set_attributes_with_block
@@ -193,7 +193,7 @@ class BasicsTest < Test::Unit::TestCase
def test_read_attribute_when_false
topic = topics(:first)
topic.approved = false
- assert_equal 0, topic.approved, "approved should be 0"
+ assert !topic.approved?, "approved should be false"
end
def test_preserving_date_objects
@@ -426,7 +426,7 @@ class BasicsTest < Test::Unit::TestCase
def test_default_values
topic = Topic.new
- assert_equal 1, topic.approved
+ assert topic.approved?
assert_nil topic.written_on
assert_nil topic.bonus_time
assert_nil topic.last_read
@@ -434,7 +434,7 @@ class BasicsTest < Test::Unit::TestCase
topic.save
topic = Topic.find(topic.id)
- assert_equal 1, topic.approved
+ assert topic.approved?
assert_nil topic.last_read
end
@@ -511,15 +511,15 @@ class BasicsTest < Test::Unit::TestCase
end
def test_mass_assignment_accessible
- reply = Reply.new("title" => "hello", "content" => "world", "approved" => 0)
+ reply = Reply.new("title" => "hello", "content" => "world", "approved" => false)
reply.save
+
+ assert reply.approved?
- assert_equal 1, reply.approved
-
- reply.approved = 0
+ reply.approved = false
reply.save
- assert_equal 0, reply.approved
+ assert !reply.approved?
end
def test_mass_assignment_protection_inheritance
diff --git a/activerecord/test/fixtures/developer.rb b/activerecord/test/fixtures/developer.rb
index 17d0746cfa..1a4f0648bb 100644
--- a/activerecord/test/fixtures/developer.rb
+++ b/activerecord/test/fixtures/developer.rb
@@ -1,7 +1,7 @@
class Developer < ActiveRecord::Base
has_and_belongs_to_many :projects
has_and_belongs_to_many :special_projects, :join_table => 'developers_projects', :association_foreign_key => 'project_id'
-
+
validates_inclusion_of :salary, :in => 50000..200000
validates_length_of :name, :within => 3..20
end