From 73101af6ab89034b53e86c28b2f8a9f14eece950 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 29 Dec 2006 22:16:04 +0000 Subject: prefix_parameters pulls /:path/:params from the URI prefix git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5809 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activeresource/test/base_test.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'activeresource/test/base_test.rb') diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb index bfc8a9fb68..a8c9454476 100644 --- a/activeresource/test/base_test.rb +++ b/activeresource/test/base_test.rb @@ -43,6 +43,11 @@ class BaseTest < Test::Unit::TestCase assert_equal site, Person.site end + def test_should_use_site_prefix_and_credentials + assert_equal 'http://foo:bar@beast.caboo.se', Forum.site.to_s + assert_equal 'http://foo:bar@beast.caboo.se/forums/:forum_id', Topic.site.to_s + end + def test_site_reader_uses_superclass_site_until_written # Superclass is Object so returns nil. assert_nil ActiveResource::Base.site @@ -88,7 +93,7 @@ class BaseTest < Test::Unit::TestCase assert_equal '/people.xml?gender=', Person.collection_path(:gender => nil) assert_equal '/people.xml?gender=male', Person.collection_path('gender' => 'male') - assert_equal '/people.xml?student=true&gender=male', Person.collection_path(:gender => 'male', :student => true) + assert_equal '/people.xml?gender=male&student=true', Person.collection_path(:gender => 'male', :student => true) assert_equal '/people.xml?name[]=bob&name[]=your+uncle%2Bme&name[]=&name[]=false', Person.collection_path(:name => ['bob', 'your uncle+me', nil, false]) end @@ -128,13 +133,13 @@ class BaseTest < Test::Unit::TestCase def test_prefix assert_equal "/", Person.prefix - assert_equal Set.new, Person.instance_variable_get('@prefix_parameters') + assert_equal Set.new, Person.send(:prefix_parameters) end def test_custom_prefix assert_equal '/people//', StreetAddress.prefix assert_equal '/people/1/', StreetAddress.prefix(:person_id => 1) - assert_equal [:person_id].to_set, StreetAddress.instance_variable_get('@prefix_parameters') + assert_equal [:person_id].to_set, StreetAddress.send(:prefix_parameters) end def test_find_by_id @@ -232,9 +237,4 @@ class BaseTest < Test::Unit::TestCase def test_delete assert Person.delete(1) end - - def test_should_use_site_prefix_and_credentials - assert_equal 'http://foo:bar@beast.caboo.se', Forum.site.to_s - assert_equal 'http://foo:bar@beast.caboo.se/forums/:forum_id', Topic.site.to_s - end end -- cgit v1.2.3