diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-11-29 16:04:22 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-11-29 20:13:36 +0000 |
commit | fd7ca98bb6218de42b821d48db083ea8c0e97d67 (patch) | |
tree | 24931bb9587ce8927979b9ca0e870f58e8654963 /activerecord/test/cases | |
parent | 34609d67b442366644945a95b019daf5b474727b (diff) | |
download | rails-fd7ca98bb6218de42b821d48db083ea8c0e97d67.tar.gz rails-fd7ca98bb6218de42b821d48db083ea8c0e97d67.tar.bz2 rails-fd7ca98bb6218de42b821d48db083ea8c0e97d67.zip |
Add tests for set_sequence_name etc
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 1ae5e6029f..9fc9197aa5 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1510,6 +1510,28 @@ class BasicsTest < ActiveRecord::TestCase assert_equal "type_id", k.inheritance_column end + def test_set_sequence_name_with_value + k = Class.new( ActiveRecord::Base ) + k.sequence_name = "foo" + assert_equal "foo", k.sequence_name + + k.set_sequence_name "bar" + assert_equal "bar", k.sequence_name + end + + def test_set_sequence_name_with_block + k = Class.new( ActiveRecord::Base ) + k.table_name = "projects" + orig_name = k.sequence_name + + if orig_name + k.set_sequence_name { original_sequence_name + "_lol" } + assert_equal orig_name + "_lol", k.sequence_name + else + skip "sequences not supported by db" + end + end + def test_count_with_join res = Post.count_by_sql "SELECT COUNT(*) FROM posts LEFT JOIN comments ON posts.id=comments.post_id WHERE posts.#{QUOTED_TYPE} = 'Post'" |