diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-04-27 20:54:53 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-04-27 20:54:53 +0000 |
commit | 1d5c34c2c27370356e8cd1ef478111802b6a5af4 (patch) | |
tree | a24e73ce006a32b79b80fc09ed74490dffe8a13d /activeresource/test | |
parent | 8326a15784550f8a909e140f828dc0b1c83d617c (diff) | |
download | rails-1d5c34c2c27370356e8cd1ef478111802b6a5af4.tar.gz rails-1d5c34c2c27370356e8cd1ef478111802b6a5af4.tar.bz2 rails-1d5c34c2c27370356e8cd1ef478111802b6a5af4.zip |
Added find-by-path options to ActiveResource::Base.find [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6595 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activeresource/test')
-rw-r--r-- | activeresource/test/abstract_unit.rb | 2 | ||||
-rw-r--r-- | activeresource/test/base_test.rb | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/activeresource/test/abstract_unit.rb b/activeresource/test/abstract_unit.rb index 574080acc6..ca0d1631e9 100644 --- a/activeresource/test/abstract_unit.rb +++ b/activeresource/test/abstract_unit.rb @@ -8,4 +8,4 @@ require 'active_support/breakpoint' $:.unshift "#{File.dirname(__FILE__)}/../test" require 'setter_trap' -ActiveResource::Base.logger = Logger.new("#{File.dirname(__FILE__)}/debug.log") +ActiveResource::Base.logger = Logger.new("#{File.dirname(__FILE__)}/debug.log")
\ No newline at end of file diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb index 374cb9481a..51e1dd3c04 100644 --- a/activeresource/test/base_test.rb +++ b/activeresource/test/base_test.rb @@ -203,6 +203,21 @@ class BaseTest < Test::Unit::TestCase assert_raises(ActiveResource::ResourceNotFound) { StreetAddress.find(1) } end + def test_find_all_by_from + ActiveResource::HttpMock.respond_to { |m| m.get "/companies/1/people.xml", {}, "<people>#{@david}</people>" } + + people = Person.find(:all, :from => "/companies/1/people.xml") + assert_equal 1, people.size + assert_equal "David", people.first.name + end + + def test_find_single_by_from + ActiveResource::HttpMock.respond_to { |m| m.get "/companies/1/manager.xml", {}, @david } + + david = Person.find("/companies/1/manager.xml") + assert_equal "David", david.name + end + def test_save rick = Person.new assert_equal true, rick.save |