aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test/cases
diff options
context:
space:
mode:
Diffstat (limited to 'activeresource/test/cases')
-rw-r--r--activeresource/test/cases/base_test.rb8
-rw-r--r--activeresource/test/cases/finder_test.rb2
2 files changed, 9 insertions, 1 deletions
diff --git a/activeresource/test/cases/base_test.rb b/activeresource/test/cases/base_test.rb
index 6fabeeebcd..eb1a747c0a 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_parent_id
+ assert_raise ActiveResource::MissingPrefixParam do
+ assert_equal '/people/1/addresses/1.xml', StreetAddress.element_path(1)
+ end
+ end
+
def test_module_element_path
assert_equal '/sounds/1.xml', Asset::Sound.element_path(1)
end
@@ -560,6 +566,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
diff --git a/activeresource/test/cases/finder_test.rb b/activeresource/test/cases/finder_test.rb
index fd09ef46d7..ebb783996d 100644
--- a/activeresource/test/cases/finder_test.rb
+++ b/activeresource/test/cases/finder_test.rb
@@ -84,7 +84,7 @@ class FinderTest < Test::Unit::TestCase
def test_find_by_id_not_found
assert_raise(ActiveResource::ResourceNotFound) { Person.find(99) }
- assert_raise(ActiveResource::ResourceNotFound) { StreetAddress.find(1) }
+ assert_raise(ActiveResource::ResourceNotFound) { StreetAddress.find(99, :params => {:person_id => 1}) }
end
def test_find_all_sub_objects