aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test
diff options
context:
space:
mode:
authorAhmed El-Daly <aeldaly@developergurus.com>2009-01-29 23:04:49 -0500
committerAhmed El-Daly <aeldaly@developergurus.com>2009-01-29 23:04:49 -0500
commit43d63298f7693a437b454b4b8ee84946af350572 (patch)
tree55166f7c3118061a1fd0df2cb3cf6ea6e31647b9 /activeresource/test
parent6623e4f92a69c2aa0a12957db430b00690d50d19 (diff)
parent24b688d31d34dc7582c8e2ac4347d0c36e3c5e10 (diff)
downloadrails-43d63298f7693a437b454b4b8ee84946af350572.tar.gz
rails-43d63298f7693a437b454b4b8ee84946af350572.tar.bz2
rails-43d63298f7693a437b454b4b8ee84946af350572.zip
Merge branch 'master' of git@github.com:lifo/docrails
Diffstat (limited to 'activeresource/test')
-rw-r--r--activeresource/test/base/equality_test.rb9
-rw-r--r--activeresource/test/base_test.rb15
2 files changed, 23 insertions, 1 deletions
diff --git a/activeresource/test/base/equality_test.rb b/activeresource/test/base/equality_test.rb
index 1fb8938e95..84f1a7b998 100644
--- a/activeresource/test/base/equality_test.rb
+++ b/activeresource/test/base/equality_test.rb
@@ -40,4 +40,13 @@ class BaseEqualityTest < Test::Unit::TestCase
assert_equal resource.id.hash, resource.hash
end
end
+
+ def test_with_prefix_options
+ assert_equal @one == @one, @one.eql?(@one)
+ assert_equal @one == @one.dup, @one.eql?(@one.dup)
+ new_one = @one.dup
+ new_one.prefix_options = {:foo => 'bar'}
+ assert_not_equal @one, new_one
+ end
+
end
diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb
index d37a6d4ed2..e22388f4a7 100644
--- a/activeresource/test/base_test.rb
+++ b/activeresource/test/base_test.rb
@@ -627,6 +627,12 @@ class BaseTest < Test::Unit::TestCase
assert_equal '1', p.__send__(:id_from_response, resp)
end
+ def test_id_from_response_without_location
+ p = Person.new
+ resp = {}
+ assert_equal nil, p.__send__(:id_from_response, resp)
+ end
+
def test_create_with_custom_prefix
matzs_house = StreetAddress.new(:person_id => 1)
matzs_house.save
@@ -670,7 +676,6 @@ class BaseTest < Test::Unit::TestCase
assert_equal person, person.reload
end
-
def test_create
rick = Person.create(:name => 'Rick')
assert rick.valid?
@@ -687,6 +692,14 @@ class BaseTest < Test::Unit::TestCase
assert_raises(ActiveResource::ResourceConflict) { Person.create(:name => 'Rick') }
end
+ def test_create_without_location
+ ActiveResource::HttpMock.respond_to do |mock|
+ mock.post "/people.xml", {}, nil, 201
+ end
+ person = Person.create(:name => 'Rick')
+ assert_equal nil, person.id
+ end
+
def test_clone
matz = Person.find(1)
matz_c = matz.clone