diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-04-19 22:18:03 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-04-19 22:18:03 +0000 |
commit | c97f329b2a76439cd4fe71debdd64c71e9890b48 (patch) | |
tree | 8fb960628936763a23729390152d024a5b3908d1 /activeresource/test | |
parent | a0e78f7442143c1366de06ec28342ad728870a1c (diff) | |
download | rails-c97f329b2a76439cd4fe71debdd64c71e9890b48.tar.gz rails-c97f329b2a76439cd4fe71debdd64c71e9890b48.tar.bz2 rails-c97f329b2a76439cd4fe71debdd64c71e9890b48.zip |
Disregard namespaces from the default element name, so Highrise::Person will just try to fetch from "/people", not "/highrise/people" [DHH] Added that saves which get a body response (and not just a 201) will use that response to update themselves [DHH] Fixed constant warning when fetching the same object multiple times [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6539 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activeresource/test')
-rw-r--r-- | activeresource/test/base_test.rb | 15 | ||||
-rw-r--r-- | activeresource/test/connection_test.rb | 2 |
2 files changed, 6 insertions, 11 deletions
diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb index c3ae05a1ae..a0e38c991d 100644 --- a/activeresource/test/base_test.rb +++ b/activeresource/test/base_test.rb @@ -16,8 +16,8 @@ class BaseTest < Test::Unit::TestCase mock.put "/people/1.xml", {}, nil, 204 mock.delete "/people/1.xml", {}, nil, 200 mock.delete "/people/2.xml", {}, nil, 400 - mock.post "/people.xml", {}, nil, 201, 'Location' => '/people/5.xml' mock.get "/people/99.xml", {}, nil, 404 + mock.post "/people.xml", {}, "<person><name>Rick</name><age type='integer'>25</age></person>", 201, 'Location' => '/people/5.xml' mock.get "/people.xml", {}, "<people>#{@matz}#{@david}</people>" mock.get "/people/1/addresses.xml", {}, "<addresses>#{@addy}</addresses>" mock.get "/people/1/addresses/1.xml", {}, @addy @@ -128,14 +128,6 @@ class BaseTest < Test::Unit::TestCase assert_equal 'addresses', StreetAddress.collection_name end - def test_nested_element_name - self.class.const_set :Actor, Class.new(Person) - assert_equal 'base_test/actor', Actor.element_name - ensure - self.class.remove_const :Actor rescue nil - end - - def test_prefix assert_equal "/", Person.prefix assert_equal Set.new, Person.send(:prefix_parameters) @@ -215,7 +207,7 @@ class BaseTest < Test::Unit::TestCase end def test_create_with_custom_prefix - matzs_house = StreetAddress.new({}, {:person_id => 1}) + matzs_house = StreetAddress.new({}, { :person_id => 1 }) matzs_house.save assert_equal '5', matzs_house.id end @@ -232,6 +224,9 @@ class BaseTest < Test::Unit::TestCase assert rick.valid? assert !rick.new? assert_equal '5', rick.id + + # test additional attribute returned on create + assert_equal 25, rick.age # Test that save exceptions get bubbled up too ActiveResource::HttpMock.respond_to do |mock| diff --git a/activeresource/test/connection_test.rb b/activeresource/test/connection_test.rb index 8fcbf089de..b434dd4012 100644 --- a/activeresource/test/connection_test.rb +++ b/activeresource/test/connection_test.rb @@ -92,7 +92,7 @@ class ConnectionTest < Test::Unit::TestCase def test_get_collection_empty people = @conn.get("/people_empty_elements.xml") - assert_equal people, nil + assert_nil people end def test_post |