-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
131 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module WashoutBuilder | ||
VERSION = "0.11.1" | ||
VERSION = "0.11.2" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
require 'spec_helper' | ||
|
||
describe WashoutBuilderController do | ||
|
||
describe WashoutBuilderController, :type => :controller do | ||
|
||
let(:soap_config) { OpenStruct.new( | ||
camelize_wsdl: false, | ||
namespace: "/api/wsdl", | ||
) } | ||
|
||
before(:each) do | ||
ApiController.stubs(:soap_config).returns(soap_config) | ||
end | ||
|
||
it "gets the services" do | ||
get :all | ||
assigns(:services).should eq([{"service_name"=>"Api", "namespace"=>"/api/wsdl", "endpoint"=>"/api/action", "documentation_url"=>"http://test.host/api/doc"}]) | ||
end | ||
|
||
|
||
it "renders the template" do | ||
get :all | ||
response.should render_template("wash_with_html/all_services") | ||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#encoding:utf-8 | ||
require 'spec_helper' | ||
|
||
|
||
describe WashoutBuilder::Document::ComplexType do | ||
let(:soap_config) { OpenStruct.new( | ||
camelize_wsdl: false, | ||
namespace: "/api/wsdl", | ||
description: "some description" | ||
) } | ||
|
||
def get_wash_out_param(class_name_or_structure, soap_config = soap_config) | ||
WashOut::Param.parse_builder_def(soap_config, class_name_or_structure)[0] | ||
end | ||
|
||
let(:subject) { get_wash_out_param(ProjectType) } | ||
let(:namespaced_object) { get_wash_out_param(Api::TestType) } | ||
|
||
it "returns the complex class name" do | ||
subject.get_complex_class_name.should eq("ProjectType") | ||
end | ||
|
||
|
||
it "returns the complex class name" do | ||
subject.get_complex_class_name.should eq("ProjectType") | ||
end | ||
|
||
|
||
it "returns the complex class with namespace" do | ||
namespaced_object.get_complex_class_name.should eq("Api::TestType") | ||
end | ||
|
||
|
||
it "returns error if classname already detected (only used for hashes)" do | ||
subject.stubs(:classified?).returns(false) | ||
subject.stubs(:basic_type).returns("ProjectType") | ||
defined = [ { :class= => "ProjectType" }] | ||
defined.stubs(:detect).returns({:class => "ProjectType"}) | ||
expect {subject.get_complex_class_name(defined) }.to raise_error(RuntimeError, "Duplicate use of `ProjectType` type name. Consider using classified types.") | ||
end | ||
|
||
it "returns the param structure" do | ||
subject.get_param_structure.should eq({"project"=>"struct"}) | ||
end | ||
|
||
it "fixes the first descendant " do | ||
descendant = get_wash_out_param(ProjectType.wash_out_param_map) | ||
subject.fix_descendant_wash_out_type(soap_config, ProjectType) | ||
subject.name.should eq(descendant.name) | ||
subject.map[0].get_param_structure.should eq(descendant.map[0].get_param_structure) | ||
end | ||
|
||
it "same as ancestor" do | ||
subject.get_ancestors(ProjectType).should eq([]) | ||
end | ||
|
||
|
||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#encoding:utf-8 | ||
require 'spec_helper' | ||
|
||
class SOAPError < WashOut::Dispatcher::SOAPError | ||
|
||
end | ||
|
||
describe WashoutBuilder::Document::VirtusModel do | ||
|
||
let(:subject) { SOAPError} | ||
|
||
|
||
|
||
it "gets the strcuture" do | ||
subject.get_virtus_model_structure.should eq({"code"=>{:primitive=>"Integer", :member_type=>nil}, "message"=>{:primitive=>"String", :member_type=>nil}, "backtrace"=>{:primitive=>"String", :member_type=>nil}}) | ||
end | ||
|
||
it "gets the member type for arrays" do | ||
subject.get_virtus_member_type_primitive({:primitive=>"Array", :member_type=>"SomeInexistentClass"}).should eq("SomeInexistentClass") | ||
end | ||
|
||
it "gets the member type for clasified types" do | ||
subject.get_virtus_member_type_primitive({:primitive=>"SomeInexistentClass", :member_type=>nil}).should eq("SomeInexistentClass") | ||
end | ||
|
||
it "returns nil because is not a classified object" do | ||
subject.get_virtus_member_type_primitive({:primitive=>"integer", :member_type=>nil}).should eq(nil) | ||
end | ||
|
||
|
||
it "gets the strcuture" do | ||
subject.remove_fault_type_inheritable_elements(["code"]).should eq({ "message"=>{:primitive=>"String", :member_type=>nil}, "backtrace"=>{:primitive=>"String", :member_type=>nil}}) | ||
end | ||
|
||
end |