I downloaded the rails edge
cd activerecord
rake test_mysql
I am getting an exception at line 165 block.
def test_validate_uniqueness_with_scope
Reply.validates_uniqueness_of(:content, scope: "parent_id")
t = Topic.create("title" => "I'm unique!")
r1 = t.replies.create "title" => "r1", "content" => "hello world"
assert r1.valid?, "Saving r1"
r2 = t.replies.create "title" => "r2", "content" => "hello world"
assert_not r2.valid?, "Saving r2 first time"
r2.content = "something else"
assert r2.save, "Saving r2 second time"
t2 = Topic.create("title" => "I'm unique too!")
r3 = t2.replies.create "title" => "r3", "content" => "hello world"
assert r3.valid?, "Saving r3"
end
def test_validate_uniqueness_with_aliases
Reply.validates_uniqueness_of(:new_content, scope: :new_parent_id)
Line 169 (
http://github.com/rails/rails/blob/master/activerecord/test/cases/validations/uniqueness_validation_test.rb#L169 )
says that if database is not UTF-8 then test will fail.
I think my database is UTF-8. Take a look at this.
What am I missing? What do I need to do so that this test passes.
For the sake of completeness I would a say I have one test in error
( this one) and two other tests are failing. It seems the other two
failing tests are also because of UTF-8 issue.
Thanks
This issue is resolved. For the record I resolved this issue by
creating database through rake task.
rake mysql:drop_databases
rake mysql:build_databases