aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test
diff options
context:
space:
mode:
authorMarc G Gauthier <marcg.gauthier@gmail.com>2011-09-01 18:26:29 +0200
committerMarc G Gauthier <marcg.gauthier@gmail.com>2011-09-01 18:26:29 +0200
commit28d605ff7fe1de0ae9b3bcdb48ac6209859c7ecf (patch)
treee4f82068fd6de086d94b651b9ea2dc751fa301c2 /activeresource/test
parent03b96306176bfc328929cb422ae61d37ee071310 (diff)
downloadrails-28d605ff7fe1de0ae9b3bcdb48ac6209859c7ecf.tar.gz
rails-28d605ff7fe1de0ae9b3bcdb48ac6209859c7ecf.tar.bz2
rails-28d605ff7fe1de0ae9b3bcdb48ac6209859c7ecf.zip
Do not use objects that don't respond to to_sym (integers, floats, dates...) as parameters
Diffstat (limited to 'activeresource/test')
-rw-r--r--activeresource/test/cases/base/load_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/activeresource/test/cases/base/load_test.rb b/activeresource/test/cases/base/load_test.rb
index 0d030148d0..0bbd3ab5f5 100644
--- a/activeresource/test/cases/base/load_test.rb
+++ b/activeresource/test/cases/base/load_test.rb
@@ -51,9 +51,28 @@ class BaseLoadTest < Test::Unit::TestCase
:votes => [ true, false, true ],
:places => [ "Columbia City", "Unknown" ]}}}
+
+ # List of books formated as [{timestamp_of_publication => name}, ...]
+ @books = {:books => [
+ {1009839600 => "Ruby in a Nutshell"},
+ {1199142000 => "The Ruby Programming Language"}
+ ]}
+
+ @books_date = {:books => [
+ {Time.at(1009839600) => "Ruby in a Nutshell"},
+ {Time.at(1199142000) => "The Ruby Programming Language"}
+ ]}
@person = Person.new
end
+ def test_load_hash_with_integers_as_keys
+ assert_nothing_raised{person = @person.load(@books)}
+ end
+
+ def test_load_hash_with_dates_as_keys
+ assert_nothing_raised{person = @person.load(@books_date)}
+ end
+
def test_load_expects_hash
assert_raise(ArgumentError) { @person.load nil }
assert_raise(ArgumentError) { @person.load '<person id="1"/>' }