diff options
author | Daniel Guettler <daniel.guettler@gmail.com> | 2008-07-09 14:08:04 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-07-09 14:09:17 +0100 |
commit | 84af99e78dbf65b7faa92313acf8457cb0c2b510 (patch) | |
tree | 0d65994dd3bd447f50abb98da88752869836b8d2 /activerecord/test/cases | |
parent | 124d1016fa212c008e33853912493fa9ac15d086 (diff) | |
download | rails-84af99e78dbf65b7faa92313acf8457cb0c2b510.tar.gz rails-84af99e78dbf65b7faa92313acf8457cb0c2b510.tar.bz2 rails-84af99e78dbf65b7faa92313acf8457cb0c2b510.zip |
Ensure NamedScope#build/create/create!/new works as expected when named scope has hash conditions. [Daniel Guettler, Pratik Naik] [#419 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/named_scope_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb index 7d73541ee1..0c1eb23428 100644 --- a/activerecord/test/cases/named_scope_test.rb +++ b/activerecord/test/cases/named_scope_test.rb @@ -183,4 +183,30 @@ class NamedScopeTest < ActiveRecord::TestCase topics.empty? # use loaded (no query) end end + + def test_should_build_with_proxy_options + topic = Topic.approved.build({}) + assert topic.approved + end + + def test_should_build_new_with_proxy_options + topic = Topic.approved.new + assert topic.approved + end + + def test_should_create_with_proxy_options + topic = Topic.approved.create({}) + assert topic.approved + end + + def test_should_create_with_bang_with_proxy_options + topic = Topic.approved.create!({}) + assert topic.approved + end + + def test_should_build_with_proxy_options_chained + topic = Topic.approved.by_lifo.build({}) + assert topic.approved + assert_equal 'lifo', topic.author_name + end end |