aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/validations_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/validations_test.rb')
-rwxr-xr-xactiverecord/test/validations_test.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/test/validations_test.rb b/activerecord/test/validations_test.rb
index c4f6f2d6b1..daec199be1 100755
--- a/activerecord/test/validations_test.rb
+++ b/activerecord/test/validations_test.rb
@@ -3,6 +3,7 @@ require 'fixtures/topic'
require 'fixtures/reply'
require 'fixtures/person'
require 'fixtures/developer'
+require 'fixtures/warehouse_thing'
# The following methods in Topic are used in test_conditional_validation_*
class Topic
@@ -54,7 +55,7 @@ class Thaumaturgist < IneptWizard
end
class ValidationsTest < ActiveSupport::TestCase
- fixtures :topics, :developers
+ fixtures :topics, :developers, 'warehouse-things'
def setup
Topic.write_inheritable_attribute(:validate, nil)
@@ -435,6 +436,13 @@ class ValidationsTest < ActiveSupport::TestCase
assert t2.save, "should save with nil"
end
+ def test_validate_uniqueness_with_non_standard_table_names
+ i1 = WarehouseThing.create(:value => 1000)
+ assert !i1.valid?, "i1 should not be valid"
+ assert i1.errors.on(:value), "Should not be empty"
+ end
+
+
def test_validate_straight_inheritance_uniqueness
w1 = IneptWizard.create(:name => "Rincewind", :city => "Ankh-Morpork")
assert w1.valid?, "Saving w1"