+
We're sorry, but something went wrong.
+
We've been notified about this issue and we'll take a look at it shortly.
+
+
+
diff --git a/spec/dummy/public/favicon.ico b/spec/dummy/public/favicon.ico
new file mode 100644
index 0000000..e69de29
diff --git a/spec/dummy/public/stylesheets/.gitkeep b/spec/dummy/public/stylesheets/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/spec/dummy/script/rails b/spec/dummy/script/rails
new file mode 100644
index 0000000..f8da2cf
--- /dev/null
+++ b/spec/dummy/script/rails
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
+
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require File.expand_path('../../config/boot', __FILE__)
+require 'rails/commands'
diff --git a/spec/lib/washout_builder/dispatcher_spec.rb b/spec/lib/washout_builder/dispatcher_spec.rb
new file mode 100644
index 0000000..e2f8b3e
--- /dev/null
+++ b/spec/lib/washout_builder/dispatcher_spec.rb
@@ -0,0 +1,51 @@
+#encoding:utf-8
+
+require 'spec_helper'
+
+describe WashoutBuilder::Dispatcher do
+
+ class Dispatcher < ApplicationController
+ soap_service
+
+ def params
+ @_params
+ end
+ end
+
+
+
+
+ describe "#_load_params" do
+ let(:dispatcher) { Dispatcher.new }
+ let(:soap_config) {
+ OpenStruct.new(
+ WashOut::Rails::Engine.config.wash_out.merge( { camelize_wsdl: false })
+ )
+ }
+ it "should load params for an array" do
+ spec = WashOut::Param.parse_def(soap_config, {:my_array => [:integer] } )
+ xml_data = {:my_array => [1, 2, 3]}
+ dispatcher._load_params(spec, xml_data).should == {"my_array" => [1, 2, 3]}
+ end
+
+ it "should load params for an empty array" do
+ spec = WashOut::Param.parse_def(soap_config, {:my_array => [:integer] } )
+ xml_data = {}
+ dispatcher._load_params(spec, xml_data).should == {}
+ end
+
+ it "should load params for a nested array" do
+ spec = WashOut::Param.parse_def(soap_config, {:nested => {:my_array => [:integer]}} )
+ xml_data = {:nested => {:my_array => [1, 2, 3]}}
+ dispatcher._load_params(spec, xml_data).should == {"nested" => {"my_array" => [1, 2, 3]}}
+ end
+
+ it "should load params for an empty nested array" do
+ spec = WashOut::Param.parse_def(soap_config, {:nested => {:empty => [:integer] }} )
+ xml_data = {:nested => nil}
+ dispatcher._load_params(spec, xml_data).should == {"nested" => {}}
+ end
+
+ end
+
+end
diff --git a/spec/lib/washout_builder/document/complex_type_spec.rb b/spec/lib/washout_builder/document/complex_type_spec.rb
new file mode 100644
index 0000000..e69de29
diff --git a/spec/lib/washout_builder/document/generator_spec.rb b/spec/lib/washout_builder/document/generator_spec.rb
new file mode 100644
index 0000000..e69de29
diff --git a/spec/lib/washout_builder/document/virtus_model_spec.rb b/spec/lib/washout_builder/document/virtus_model_spec.rb
new file mode 100644
index 0000000..e69de29
diff --git a/spec/lib/washout_builder/engine_spec.rb b/spec/lib/washout_builder/engine_spec.rb
new file mode 100644
index 0000000..bce3191
--- /dev/null
+++ b/spec/lib/washout_builder/engine_spec.rb
@@ -0,0 +1,6 @@
+require 'spec_helper'
+
+
+describe WashoutBuilder::Engine do
+
+end
\ No newline at end of file
diff --git a/spec/lib/washout_builder/soap_spec.rb b/spec/lib/washout_builder/soap_spec.rb
new file mode 100644
index 0000000..d9386d8
--- /dev/null
+++ b/spec/lib/washout_builder/soap_spec.rb
@@ -0,0 +1,15 @@
+#encoding:utf-8
+
+require 'spec_helper'
+
+describe WashoutBuilder::SOAP do
+
+# [
+# WashoutBuilder::Dispatcher,
+# WashOut::Rails::Controller
+# ].each do |extension|
+# specify { WashoutBuilder::SOAP.included_modules.should include(extension) }
+# end
+#
+
+end
diff --git a/spec/lib/washout_builder/type_spec.rb b/spec/lib/washout_builder/type_spec.rb
new file mode 100644
index 0000000..ee779f7
--- /dev/null
+++ b/spec/lib/washout_builder/type_spec.rb
@@ -0,0 +1,21 @@
+#encoding:utf-8
+
+require 'spec_helper'
+
+describe WashoutBuilder::Type do
+
+ [ "string",
+ "integer",
+ "double",
+ "boolean",
+ "date",
+ "datetime",
+ "float",
+ "time",
+ "int"].each do |type|
+ it "defines a list of types" do
+ WashoutBuilder::Type::BASIC_TYPES.should include(type)
+ end
+ end
+
+end
\ No newline at end of file
diff --git a/spec/lib/washout_builder_spec.rb b/spec/lib/washout_builder_spec.rb
new file mode 100644
index 0000000..f7fad37
--- /dev/null
+++ b/spec/lib/washout_builder_spec.rb
@@ -0,0 +1,697 @@
+#encoding:utf-8
+
+require 'spec_helper'
+
+describe WashoutBuilder do
+
+ before(:each) do
+ WashOut::Rails::Engine.config.wash_out[:wsdl_style] = 'rpc'
+ WashOut::Rails::Engine.config.wash_out[:parser] = :nokogiri
+ WashOut::Rails::Engine.config.wash_out[:catch_xml_errors] = true
+ end
+
+ let :nori do
+ Nori.new(
+ :strip_namespaces => true,
+ :advanced_typecasting => true,
+ :convert_tags_to => lambda {|x| x.snakecase.to_sym}
+ )
+ end
+
+ def savon(method, message={}, &block)
+ message = {:value => message} unless message.is_a?(Hash)
+
+ savon_client = Savon::Client.new(:log => false, :wsdl => 'http://app/api/wsdl', &block)
+ result = savon_client.call(method, :message => message)
+ result.respond_to?(:to_hash) ? result.to_hash : result
+ end
+
+ def savon!(method, message={}, &block)
+ message = {:value => message} unless message.is_a?(Hash)
+
+ savon_client = Savon::Client.new(:log => true, :wsdl => 'http://app/api/wsdl', &block)
+ result = savon_client.call(method, :message => message)
+ result.respond_to?(:to_hash) ? result.to_hash : result
+ end
+
+ describe "Module" do
+ it "includes" do
+ lambda {
+ mock_controller do
+ # nothing
+ end
+ }.should_not raise_exception
+ end
+
+ it "allows definition of a simple action" do
+ lambda {
+ mock_controller do
+ soap_action "answer", :args => nil, :return => :integer
+ end
+ }.should_not raise_exception
+ end
+ end
+
+ describe "WSDL" do
+ let :wsdl do
+ mock_controller do
+ soap_action :result, :args => nil, :return => :int
+
+ soap_action "getArea", :args => {
+ :circle => [{
+ :center => { :x => [:integer], :y => :integer },
+ :radius => :double
+ }]},
+ :return => { :area => :double }
+ soap_action "rocky", :args => { :circle1 => { :x => :integer } },
+ :return => { :circle2 => { :y => :integer } }
+ end
+
+ HTTPI.get("http://app/api/wsdl").body
+ end
+
+ let :xml do
+ nori.parse wsdl
+ end
+
+ it "lists operations" do
+ operations = xml[:definitions][:binding][:operation]
+ operations.should be_a_kind_of(Array)
+
+ operations.map{|e| e[:'@name']}.sort.should == ['Result', 'getArea', 'rocky'].sort
+ end
+
+ it "defines complex types" do
+ wsdl.include?('