diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-12-29 22:16:04 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-12-29 22:16:04 +0000 |
commit | 73101af6ab89034b53e86c28b2f8a9f14eece950 (patch) | |
tree | f2b2f63f6a56c20dcd004037a25007b551d88da4 /activeresource/test | |
parent | 6a5388b6549cb88fd19ff7ea2c48be1210a6e1cb (diff) | |
download | rails-73101af6ab89034b53e86c28b2f8a9f14eece950.tar.gz rails-73101af6ab89034b53e86c28b2f8a9f14eece950.tar.bz2 rails-73101af6ab89034b53e86c28b2f8a9f14eece950.zip |
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
Diffstat (limited to 'activeresource/test')
-rw-r--r-- | activeresource/test/base_test.rb | 16 |
1 files changed, 8 insertions, 8 deletions
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 |