diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-12-13 02:15:27 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-12-13 02:15:27 +0000 |
commit | 011f4e7413f1bde83aa62a5fc46afd6957ff9b3e (patch) | |
tree | 3d7a2bc5998994c6ba2ee1759914dac15254beef /activeresource/test | |
parent | 2f184c338b6379baecde8c882f72c4fa806a3a0b (diff) | |
download | rails-011f4e7413f1bde83aa62a5fc46afd6957ff9b3e.tar.gz rails-011f4e7413f1bde83aa62a5fc46afd6957ff9b3e.tar.bz2 rails-011f4e7413f1bde83aa62a5fc46afd6957ff9b3e.zip |
Allow subclassed resources to share the site info [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5717 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activeresource/test')
-rw-r--r-- | activeresource/test/base_test.rb | 6 | ||||
-rw-r--r-- | activeresource/test/fixtures/beast.rb | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb index 685f9aa994..e0bbdc00bf 100644 --- a/activeresource/test/base_test.rb +++ b/activeresource/test/base_test.rb @@ -1,6 +1,7 @@ require "#{File.dirname(__FILE__)}/abstract_unit" require "fixtures/person" require "fixtures/street_address" +require "fixtures/beast" class BaseTest < Test::Unit::TestCase def setup @@ -171,4 +172,9 @@ 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 diff --git a/activeresource/test/fixtures/beast.rb b/activeresource/test/fixtures/beast.rb new file mode 100644 index 0000000000..1fe81da425 --- /dev/null +++ b/activeresource/test/fixtures/beast.rb @@ -0,0 +1,14 @@ +class BeastResource < ActiveResource::Base + self.site = 'http://beast.caboo.se' + site.user = 'foo' + site.password = 'bar' +end + +class Forum < BeastResource + # taken from BeastResource + # self.site = 'http://beast.caboo.se' +end + +class Topic < BeastResource + site << '/forums/:forum_id' +end
\ No newline at end of file |