diff options
author | Leon Breedt <bitserf@gmail.com> | 2005-04-02 21:03:36 +0000 |
---|---|---|
committer | Leon Breedt <bitserf@gmail.com> | 2005-04-02 21:03:36 +0000 |
commit | aaea48fe9826b9e5d2d5b92795a297b8f238c58d (patch) | |
tree | e7c01c7f95d467f837c1f96d58dac74c3c902610 /actionwebservice/test/ws/types_test.rb | |
parent | aa09c770e9b5400683be11952673017295246de7 (diff) | |
download | rails-aaea48fe9826b9e5d2d5b92795a297b8f238c58d.tar.gz rails-aaea48fe9826b9e5d2d5b92795a297b8f238c58d.tar.bz2 rails-aaea48fe9826b9e5d2d5b92795a297b8f238c58d.zip |
* collapse 'ws' back into protocols, it just added complexity and indirection, and was hard to extend.
* extract casting into seperate support file
* ensure casting always does the right thing for return values, should fix interoperability issues with Ecto and possibly other XML-RPC clients
* add functional unit tests for scaffolding
* represent signature items with classes instead of symbols/Class objects, much more flexible
* tweak logging to always show casted versions of parameters and return values, if possible.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1072 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/test/ws/types_test.rb')
-rw-r--r-- | actionwebservice/test/ws/types_test.rb | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/actionwebservice/test/ws/types_test.rb b/actionwebservice/test/ws/types_test.rb deleted file mode 100644 index e66ae65945..0000000000 --- a/actionwebservice/test/ws/types_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -require File.dirname(__FILE__) + '/abstract_unit' - -class TypesTest < Test::Unit::TestCase - include WS - - def setup - @caster = BaseTypeCaster.new - end - - def test_base_types - assert_equal(:int, BaseTypes.canonical_type_name(:integer)) - assert_equal(:int, BaseTypes.canonical_type_name(:fixnum)) - assert_equal(Integer, BaseTypes.type_name_to_class(:bignum)) - assert_equal(Date, BaseTypes.type_name_to_class(:date)) - assert_equal(Time, BaseTypes.type_name_to_class(:timestamp)) - assert_equal(TrueClass, BaseTypes.type_name_to_class(:bool)) - assert_equal(:int, BaseTypes.class_to_type_name(Bignum)) - assert_equal(:bool, BaseTypes.class_to_type_name(FalseClass)) - assert_equal(Integer, BaseTypes.canonical_type_class(Fixnum)) - assert_raises(TypeError) do - BaseTypes.canonical_type_name(:fake) - end - end - - def test_casting - assert_equal(5, @caster.cast("5", Fixnum)) - assert_equal('50.0', @caster.cast(50.0, String)) - assert_equal(true, @caster.cast('true', FalseClass)) - assert_equal(false, @caster.cast('false', TrueClass)) - assert_equal(true, @caster.cast(1, FalseClass)) - assert_equal(false, @caster.cast(0, TrueClass)) - assert_raises(TypeError) do - @caster.cast('yes', FalseClass) - end - assert_equal(3.14159, @caster.cast('3.14159', Float)) - now1 = Time.new - now2 = @caster.cast("#{now1}", Time) - assert_equal(now1.tv_sec, now2.tv_sec) - date1 = Date.parse('2004-01-01') - date2 = @caster.cast("#{date1}", Date) - assert_equal(date1, date2) - end -end |