aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test/cases/base_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-09-27 21:33:03 +0200
committerJosé Valim <jose.valim@gmail.com>2010-09-27 21:33:03 +0200
commit8be911c698aadd389b1607b4dbcea47001761536 (patch)
tree837fc3d03fd74a5043160aab9224888ca70de12c /activeresource/test/cases/base_test.rb
parent8aa3684e07db81244c61c9ac98347831a976666b (diff)
parentf85b38a36b68488e94e9950fd15ec29a21bf6917 (diff)
downloadrails-8be911c698aadd389b1607b4dbcea47001761536.tar.gz
rails-8be911c698aadd389b1607b4dbcea47001761536.tar.bz2
rails-8be911c698aadd389b1607b4dbcea47001761536.zip
Merge remote branch 'gramos/ares-missing-prefix-value'
Diffstat (limited to 'activeresource/test/cases/base_test.rb')
-rw-r--r--activeresource/test/cases/base_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activeresource/test/cases/base_test.rb b/activeresource/test/cases/base_test.rb
index 6fabeeebcd..18c732b2ab 100644
--- a/activeresource/test/cases/base_test.rb
+++ b/activeresource/test/cases/base_test.rb
@@ -475,6 +475,12 @@ class BaseTest < Test::Unit::TestCase
assert_equal '/people/ann%20mary/addresses/ann%20mary.xml', StreetAddress.element_path(:'ann mary', 'person_id' => 'ann mary')
end
+ def test_custom_element_path_without_required_prefix_param
+ assert_raise ActiveResource::MissingPrefixParam do
+ StreetAddress.element_path(1)
+ end
+ end
+
def test_module_element_path
assert_equal '/sounds/1.xml', Asset::Sound.element_path(1)
end
@@ -513,6 +519,12 @@ class BaseTest < Test::Unit::TestCase
assert_equal '/people/1/addresses/1.xml?type=work', StreetAddress.element_path(1, {:person_id => 1}, {:type => 'work'})
end
+ def test_custom_collection_path_without_required_prefix_param
+ assert_raise ActiveResource::MissingPrefixParam do
+ StreetAddress.collection_path
+ end
+ end
+
def test_custom_collection_path
assert_equal '/people/1/addresses.xml', StreetAddress.collection_path(:person_id => 1)
assert_equal '/people/1/addresses.xml', StreetAddress.collection_path('person_id' => 1)
@@ -560,6 +572,8 @@ class BaseTest < Test::Unit::TestCase
assert_equal Set.new([:the_param1]), person_class.prefix_parameters
person_class.prefix = "the_prefix/:the_param2"
assert_equal Set.new([:the_param2]), person_class.prefix_parameters
+ person_class.prefix = "the_prefix/:the_param1/other_prefix/:the_param2"
+ assert_equal Set.new([:the_param2, :the_param1]), person_class.prefix_parameters
end
end