From 0c0e767f5bd70a18b5cee966fdc635df7e9b6b50 Mon Sep 17 00:00:00 2001 From: bogdanRada Date: Tue, 17 Dec 2013 17:10:04 +0200 Subject: [PATCH] tests --- spec/support/complex_types/fluffy.rb | 6 ++++++ spec/support/complex_types/fluffy_container.rb | 4 ++++ spec/support/complex_types/project_type.rb | 9 +++++++++ spec/support/exceptions/another_exception.rb | 7 +++++++ spec/support/exceptions/base_exception.rb | 15 +++++++++++++++ spec/support/exceptions/custom2.rb | 7 +++++++ spec/support/exceptions/ex_model.rb | 8 ++++++++ spec/support/exceptions/name_mod.rb | 5 +++++ spec/support/exceptions/name_model.rb | 5 +++++ spec/support/exceptions/value_object_model.rb | 8 ++++++++ 10 files changed, 74 insertions(+) create mode 100644 spec/support/complex_types/fluffy.rb create mode 100644 spec/support/complex_types/fluffy_container.rb create mode 100644 spec/support/complex_types/project_type.rb create mode 100644 spec/support/exceptions/another_exception.rb create mode 100644 spec/support/exceptions/base_exception.rb create mode 100644 spec/support/exceptions/custom2.rb create mode 100644 spec/support/exceptions/ex_model.rb create mode 100644 spec/support/exceptions/name_mod.rb create mode 100644 spec/support/exceptions/name_model.rb create mode 100644 spec/support/exceptions/value_object_model.rb diff --git a/spec/support/complex_types/fluffy.rb b/spec/support/complex_types/fluffy.rb new file mode 100644 index 0000000..7039f36 --- /dev/null +++ b/spec/support/complex_types/fluffy.rb @@ -0,0 +1,6 @@ +class Fluffy < WashOut::Type + map :universe => { + :name => :string, + :age => :int + } +end diff --git a/spec/support/complex_types/fluffy_container.rb b/spec/support/complex_types/fluffy_container.rb new file mode 100644 index 0000000..91fed91 --- /dev/null +++ b/spec/support/complex_types/fluffy_container.rb @@ -0,0 +1,4 @@ +class FluffyContainer < WashOut::Type + type_name 'fluffy_con' + map :fluffy => Fluffy +end \ No newline at end of file diff --git a/spec/support/complex_types/project_type.rb b/spec/support/complex_types/project_type.rb new file mode 100644 index 0000000..32ecd88 --- /dev/null +++ b/spec/support/complex_types/project_type.rb @@ -0,0 +1,9 @@ +class ProjectType < WashOut::Type + map :project => { + :name => :string, + :description => :string, + :users => [{:mail => :string }], + # 'dada' => [Project] + } +end + diff --git a/spec/support/exceptions/another_exception.rb b/spec/support/exceptions/another_exception.rb new file mode 100644 index 0000000..e1b6a1b --- /dev/null +++ b/spec/support/exceptions/another_exception.rb @@ -0,0 +1,7 @@ +class AnotherException < SOAPError + + attribute :ex3_name, String + attribute :ex3_id, Integer + +end + diff --git a/spec/support/exceptions/base_exception.rb b/spec/support/exceptions/base_exception.rb new file mode 100644 index 0000000..1dc3f08 --- /dev/null +++ b/spec/support/exceptions/base_exception.rb @@ -0,0 +1,15 @@ +Dir["#{File.dirname(__FILE__)}/**/*.rb"].each { |f| require f } +class BaseException < AnotherException + + attribute :custom_attribute, String + attribute :other_custom_attribute, Integer + attribute :errors,Array[Integer] + attribute :custom, Array[ExModel] + attribute :custom2, ExModel + attribute :errors_2, Array[Custom2] + attribute :error, Custom2 + attribute :module, NameModel + attribute :geo, ValueObjectModel + +end + diff --git a/spec/support/exceptions/custom2.rb b/spec/support/exceptions/custom2.rb new file mode 100644 index 0000000..7bda0f5 --- /dev/null +++ b/spec/support/exceptions/custom2.rb @@ -0,0 +1,7 @@ +class Custom2 < WashOut::SOAPError + + attribute :ex2_name, String + attribute :ex2_id, Integer + +end + diff --git a/spec/support/exceptions/ex_model.rb b/spec/support/exceptions/ex_model.rb new file mode 100644 index 0000000..3d68dbb --- /dev/null +++ b/spec/support/exceptions/ex_model.rb @@ -0,0 +1,8 @@ +class ExModel + include Virtus.model + + attribute :name, String + attribute :id, Integer + +end + diff --git a/spec/support/exceptions/name_mod.rb b/spec/support/exceptions/name_mod.rb new file mode 100644 index 0000000..118e7c1 --- /dev/null +++ b/spec/support/exceptions/name_mod.rb @@ -0,0 +1,5 @@ +module NameMod + include Virtus.module + + attribute :name, String +end \ No newline at end of file diff --git a/spec/support/exceptions/name_model.rb b/spec/support/exceptions/name_model.rb new file mode 100644 index 0000000..393180b --- /dev/null +++ b/spec/support/exceptions/name_model.rb @@ -0,0 +1,5 @@ +require_relative "./name_mod" + +class NameModel + include NameMod +end \ No newline at end of file diff --git a/spec/support/exceptions/value_object_model.rb b/spec/support/exceptions/value_object_model.rb new file mode 100644 index 0000000..a736f86 --- /dev/null +++ b/spec/support/exceptions/value_object_model.rb @@ -0,0 +1,8 @@ +class ValueObjectModel + include Virtus.value_object + + values do + attribute :latitude, Float + attribute :longitude, Float + end +end \ No newline at end of file