washout_builder 0.13.9 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/README.rdoc +1 -0
- data/app/helpers/washout_builder_method_list_helper.rb +4 -6
- data/app/helpers/washout_builder_method_return_type_helper.rb +4 -2
- data/lib/washout_builder/version.rb +2 -2
- data/spec/app/helpers/washout_builder_complex_type_helper_spec.rb +77 -3
- data/spec/app/helpers/washout_builder_fault_type_helper_spec.rb +139 -0
- data/spec/app/helpers/washout_builder_method_arguments_helper_spec.rb +108 -0
- data/spec/app/helpers/washout_builder_method_list_helper_spec.rb +65 -0
- data/spec/app/helpers/washout_builder_method_return_type_helper_spec.rb +52 -0
- data/spec/lib/washout_builder/document/exception_model_spec.rb +7 -1
- data/spec/spec_helper.rb +4 -4
- metadata +48 -41
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MWNiNjI0YTUxZjQxZmYzMjI0YThjZTVlMTMwYTY4ZTY3OGM3NWNiYg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 28e063d6a4b5eaf6ddbfa719878fb79cd1fd97a2
|
4
|
+
data.tar.gz: 2bf44c71f0a33cd2835eca1cd03dc1eab968d074
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
Nzc0ZGNhZjg4OTJkOGI2MDQzOGQ1YTgzZmJlNmNjZmM4MzFjODc0NGI2OGI3
|
11
|
-
Yjc0MDM4YmE4NDRhMTQyZjNlMmY2ZmZjMjlhN2E0ZmUyMjE1OGU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NTcwYThkMzU5ZDVjZTAxOTkyYmY5Y2IxNGM1NTIxYTFjMjFjZGMxYWFhYmI2
|
14
|
-
NWQ2YzM4MmRmNWIyMWZkMmI5YWJkM2NjNTI2Njc5ZTZhZGVkYjZhODZhOWI2
|
15
|
-
ZTZkNGRkZTRmZTU4ZGExZWNmYTcyOWNhOWNmODFhM2FjNjY4Yjc=
|
6
|
+
metadata.gz: 6537d2449d4d330dca6a4d1b8c2820dd9d47d5d7c1df3bd5e21a80a85e99f093350c743f4ee7540e5118155b3a2513cc878d60b3cda0d65051a466218eff8154
|
7
|
+
data.tar.gz: d3a9fbb41c8f68c7ea3cd828d862110ef28207ba3a09bdf1f6449a0fac2fe95b024d4c5fb4869e52639f6379f83d964f38aa68de8fe27b4cd59a05f18d0cb7ff
|
data/README.rdoc
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
{<img src="https://codeclimate.com/github/bogdanRada/washout_builder.png" />}[https://codeclimate.com/github/bogdanRada/washout_builder]
|
6
6
|
{<img src="https://reposs.herokuapp.com/?path=bogdanRada/washout_builder" alt="Repo Size"/>}[https://github.com/bogdanRada/washout_builder]
|
7
7
|
{<img src="https://ruby-gem-downloads-badge.herokuapp.com/washout_builder?type=total&style=dynamic" alt="Gem Downloads"/>}[https://rubygems.org/gems/washout_builder]
|
8
|
+
{<img src="http://stillmaintained.com/bogdanRada/washout_builder.png" alt=""/>}[https://rubygems.org/gems/washout_builder]
|
8
9
|
|
9
10
|
= Overview
|
10
11
|
WashOutBuilder is a Soap Service Documentation generator (extends WashOut https://github.com/inossidabile/wash_out/)
|
@@ -9,18 +9,16 @@ module WashoutBuilderMethodListHelper
|
|
9
9
|
|
10
10
|
|
11
11
|
def create_return_type_list_html(xml, output)
|
12
|
-
|
12
|
+
if output.nil?
|
13
|
+
xml.span("class" => "pre") { |sp| sp << "void" }
|
14
|
+
else
|
13
15
|
complex_class = output[0].get_complex_class_name
|
14
16
|
if WashoutBuilder::Type::BASIC_TYPES.include?(output[0].type)
|
15
17
|
xml.span("class" => "pre") { |xml| xml.span("class" => "blue") { |sp| sp << "#{output[0].type}" } }
|
16
18
|
else
|
17
19
|
create_return_complex_type_html(xml, complex_class, output) unless complex_class.nil?
|
18
20
|
end
|
19
|
-
else
|
20
|
-
xml.span("class" => "pre") { |sp| sp << "void" }
|
21
21
|
end
|
22
|
-
|
23
|
-
|
24
22
|
end
|
25
23
|
|
26
|
-
end
|
24
|
+
end
|
@@ -6,8 +6,10 @@ module WashoutBuilderMethodReturnTypeHelper
|
|
6
6
|
if WashoutBuilder::Type::BASIC_TYPES.include?(output[0].type)
|
7
7
|
xml.span("class" => "blue") { |y| y<< "#{output[0].type}" }
|
8
8
|
else
|
9
|
-
|
10
|
-
|
9
|
+
unless complex_class.nil?
|
10
|
+
complex_return_type = output[0].multiplied == false ? "#{complex_class}" : "Array of #{complex_class}"
|
11
|
+
pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_return_type}</span></a>"
|
12
|
+
end
|
11
13
|
end
|
12
14
|
else
|
13
15
|
pre << "void"
|
@@ -1,12 +1,86 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe WashoutBuilderComplexTypeHelper do
|
3
|
+
describe WashoutBuilderComplexTypeHelper, :type => :helper do
|
4
4
|
|
5
|
-
|
5
|
+
context '#create_element_type_html' do
|
6
|
+
let (:pre) { [] }
|
7
|
+
let(:element_name) {"custom_name"}
|
8
|
+
let(:element) {mock}
|
6
9
|
|
10
|
+
before(:each) do
|
11
|
+
element.stubs(:type).returns("text")
|
12
|
+
element.stubs(:type=).with("string")
|
13
|
+
element.stubs(:name).returns(element_name)
|
14
|
+
end
|
7
15
|
|
16
|
+
def expect_included_type_result(pre, element)
|
17
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(element.type).returns(true)
|
18
|
+
result =helper.create_element_type_html(pre, element)
|
19
|
+
result.should eq(["<span class='blue'>#{element.type}</span> <span class='bold'>#{element.name}</span>"])
|
20
|
+
end
|
21
|
+
|
22
|
+
def expect_excluded_type_result(pre, element)
|
23
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(element.type).returns(false)
|
24
|
+
helper.expects(:create_complex_element_type_html).with(pre, element)
|
25
|
+
helper.create_element_type_html(pre, element)
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
it "returns the element of type text" do
|
30
|
+
element.expects(:type=).with("string")
|
31
|
+
expect_included_type_result(pre, element)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "returns the element of type text" do
|
35
|
+
expect_excluded_type_result(pre, element)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "returns the element of type integer" do
|
39
|
+
element.stubs(:type).returns("int")
|
40
|
+
element.expects(:type=).with("integer")
|
41
|
+
expect_included_type_result(pre, element)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "returns the element of type integer" do
|
45
|
+
element.stubs(:type).returns("int")
|
46
|
+
element.expects(:type=).with("integer")
|
47
|
+
expect_excluded_type_result(pre, element)
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
context "create_complex_element_type_html" do
|
55
|
+
let (:pre) { [] }
|
56
|
+
let(:element_name) {"custom_name"}
|
57
|
+
let(:complex_class) {"SomeClass"}
|
58
|
+
let(:element) {mock}
|
59
|
+
|
60
|
+
before(:each) do
|
61
|
+
element.stubs(:get_complex_class_name).returns(complex_class)
|
62
|
+
element.stubs(:multiplied).returns(false)
|
63
|
+
element.stubs(:name).returns(element_name)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "returna simple type element description" do
|
67
|
+
result = helper.create_complex_element_type_html(pre, element)
|
68
|
+
result.should eq(["<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a> <span class='bold'>#{element.name}</span>"])
|
69
|
+
end
|
70
|
+
|
71
|
+
it "returns an array type element description" do
|
72
|
+
element.stubs(:multiplied).returns(true)
|
73
|
+
result = helper.create_complex_element_type_html(pre, element)
|
74
|
+
result.should eq(["<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a> <span class='bold'>#{element.name}</span>"])
|
75
|
+
end
|
76
|
+
|
77
|
+
it "returns empty if no complex class" do
|
78
|
+
element.stubs(:get_complex_class_name).returns(nil)
|
79
|
+
result = helper.create_complex_element_type_html(pre, element)
|
80
|
+
result.should eq(nil)
|
81
|
+
end
|
8
82
|
|
9
83
|
end
|
10
84
|
|
11
85
|
|
12
|
-
end
|
86
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe WashoutBuilderFaultTypeHelper, :type => :helper do
|
4
|
+
|
5
|
+
context " create_fault_model_complex_element_type" do
|
6
|
+
let(:pre) { [] }
|
7
|
+
let(:attr_primitive){ "string"}
|
8
|
+
let(:attribute) {"custom_attribute"}
|
9
|
+
|
10
|
+
def check_result(array)
|
11
|
+
attribute_primitive = array == true ? "Array of #{attr_primitive}" : "#{attr_primitive}"
|
12
|
+
result = helper. create_fault_model_complex_element_type(pre, attr_primitive, attribute, array)
|
13
|
+
result.should eq(["<a href='##{attr_primitive}'><span class='lightBlue'> #{attribute_primitive}</span></a> <span class='bold'>#{attribute}</span>"])
|
14
|
+
end
|
15
|
+
|
16
|
+
it "creates an array element " do
|
17
|
+
check_result(true)
|
18
|
+
end
|
19
|
+
it "creates an simple element " do
|
20
|
+
check_result(false)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "member_type_is_basic?" do
|
25
|
+
|
26
|
+
it "returns a basic type" do
|
27
|
+
attr_details = {:member_type => "STRING"}
|
28
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(attr_details[:member_type].to_s.downcase).returns(true)
|
29
|
+
result = helper.member_type_is_basic?(attr_details)
|
30
|
+
result.should eq(attr_details[:member_type].to_s.downcase)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "returns a non-basic type" do
|
34
|
+
attr_details = {:member_type => "STRING" }
|
35
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(attr_details[:member_type].to_s.downcase).returns(false)
|
36
|
+
result = helper.member_type_is_basic?(attr_details)
|
37
|
+
result.should eq(attr_details[:member_type])
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
context "primitive_type_is_basic?" do
|
43
|
+
|
44
|
+
it "returns true" do
|
45
|
+
attr_details = {:primitive => "STRING"}
|
46
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(attr_details[:primitive].to_s.downcase).returns(true)
|
47
|
+
helper.primitive_type_is_basic?(attr_details).should eq(true)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "returns false" do
|
51
|
+
attr_details = {:primitive => "STRING"}
|
52
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(attr_details[:primitive].to_s.downcase).returns(false)
|
53
|
+
helper.primitive_type_is_basic?(attr_details).should eq(false)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
context "get_primitive_type_string" do
|
59
|
+
|
60
|
+
["NILCLASS", "nilclass"].each do |primitive|
|
61
|
+
it "returns string in case of nilclass" do
|
62
|
+
attr_details = {:primitive => primitive}
|
63
|
+
helper.get_primitive_type_string(attr_details).should eq("string")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
["BLA", "bla"].each do |primitive|
|
68
|
+
it "returns the primitive if not niclass" do
|
69
|
+
attr_details = {:primitive => primitive}
|
70
|
+
helper.get_primitive_type_string(attr_details).should eq(primitive.to_s.downcase)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
context "get_member_type_string" do
|
77
|
+
|
78
|
+
["Array", "array"].each do |primitive|
|
79
|
+
it "checks the member type to be basic if primitive type array" do
|
80
|
+
attr_details = {:primitive => primitive}
|
81
|
+
helper.expects(:member_type_is_basic?).with(attr_details).returns(true)
|
82
|
+
helper.get_member_type_string(attr_details).should eq(true)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
["BLA", "Bla", "bla"].each do |primitive|
|
88
|
+
it "returns the primitive type as it is if not array" do
|
89
|
+
attr_details = {:primitive => primitive}
|
90
|
+
helper.get_member_type_string(attr_details).should eq(primitive)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
context "create_html_fault_model_element_type" do
|
97
|
+
let(:pre) {[]}
|
98
|
+
let(:attribute) {"some_attribute"}
|
99
|
+
|
100
|
+
before(:each) do
|
101
|
+
helper.stubs(:primitive_type_is_basic?).returns(false)
|
102
|
+
end
|
103
|
+
|
104
|
+
def expect_type_string_elem_type(attr_details)
|
105
|
+
type_string = "string"
|
106
|
+
helper.expects(:get_primitive_type_string).with(attr_details).returns(type_string)
|
107
|
+
result =helper.create_html_fault_model_element_type(pre, attribute, attr_details)
|
108
|
+
result.should eq([ "<span class='blue'>#{type_string}</span> <span class='bold'>#{attribute}</span>"])
|
109
|
+
end
|
110
|
+
|
111
|
+
it "returns the string element if primitive type is nilclass" do
|
112
|
+
attr_details = {:primitive => "nilclass"}
|
113
|
+
expect_type_string_elem_type(attr_details)
|
114
|
+
end
|
115
|
+
|
116
|
+
["NILCLASS", "Nilclass", "BLA"].each do |primitive|
|
117
|
+
it "returns the string type is primitive is basic but not nilclass" do
|
118
|
+
attr_details = {:primitive => primitive}
|
119
|
+
helper.expects(:primitive_type_is_basic?).with(attr_details).returns(true)
|
120
|
+
expect_type_string_elem_type(attr_details)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
["NILCLASS", "Nilclass", "BLA"].each do |primitive|
|
125
|
+
it "returns the complex type if not basic and not nilclass" do
|
126
|
+
attr_details = {:primitive => primitive}
|
127
|
+
member_type = "SomeMemberType"
|
128
|
+
expected= "Some expected string"
|
129
|
+
helper.expects(:primitive_type_is_basic?).with(attr_details).returns(false)
|
130
|
+
helper.expects(:get_member_type_string).with(attr_details).returns(member_type)
|
131
|
+
helper.expects(:create_fault_model_complex_element_type).with(pre, member_type, attribute, true ).returns(expected)
|
132
|
+
result =helper.create_html_fault_model_element_type(pre, attribute, attr_details)
|
133
|
+
result.should eq(expected)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WashoutBuilderMethodArgumentsHelper, :type => :helper do
|
4
|
+
let!(:xml) { Builder::XmlMarkup.new}
|
5
|
+
|
6
|
+
context "create_method_argument_element" do
|
7
|
+
let(:spacer) { " "}
|
8
|
+
let(:pre){[]}
|
9
|
+
let(:param){ mock}
|
10
|
+
let(:complex_class) {"SomeComplexClass"}
|
11
|
+
let(:param_type) {"string"}
|
12
|
+
let(:param_name) {"some_param_name"}
|
13
|
+
|
14
|
+
before(:each) do
|
15
|
+
param.stubs(:get_complex_class_name).returns(complex_class)
|
16
|
+
param.stubs(:type).returns(param_type)
|
17
|
+
param.stubs(:name).returns(param_name)
|
18
|
+
end
|
19
|
+
|
20
|
+
def expect_method_arg_basic_type(mlen)
|
21
|
+
use_spacer = mlen > 1 ? true : false
|
22
|
+
result = helper.create_method_argument_element( pre, param, mlen)
|
23
|
+
result.should eq(["#{use_spacer ? spacer: ''}<span class='blue'>#{param.type}</span> <span class='bold'>#{param.name}</span>"])
|
24
|
+
end
|
25
|
+
|
26
|
+
[0, 1 , 2, 3, 4].each do |mlen|
|
27
|
+
it "returns a basic type" do
|
28
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(param.type).returns(true)
|
29
|
+
expect_method_arg_basic_type(mlen)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
[0, 1 , 2, 3, 4].each do |mlen|
|
34
|
+
it "returns array of complex type" do
|
35
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(param.type).returns(false)
|
36
|
+
param.expects(:multiplied).returns(true)
|
37
|
+
use_spacer = mlen > 1 ? true : false
|
38
|
+
result = helper.create_method_argument_element( pre, param, mlen)
|
39
|
+
result.should eq( ["#{use_spacer ? spacer: ''}<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a> <span class='bold'>#{param.name}</span>"])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
[0, 1 , 2, 3, 4].each do |mlen|
|
44
|
+
it "returns simple complex type" do
|
45
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(param.type).returns(false)
|
46
|
+
param.expects(:multiplied).returns(false)
|
47
|
+
use_spacer = mlen > 1 ? true : false
|
48
|
+
result = helper.create_method_argument_element( pre, param, mlen)
|
49
|
+
result.should eq( ["#{use_spacer ? spacer: ''}<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a> <span class='bold'>#{param.name}</span>"])
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
context "create_argument_element_spacer" do
|
57
|
+
|
58
|
+
it "returns only the ) in bold " do
|
59
|
+
result = helper.create_argument_element_spacer(xml, 0, 1)
|
60
|
+
xml.target!.should eq("<span class=\"bold\">)</span>")
|
61
|
+
end
|
62
|
+
|
63
|
+
it "returns only the span with comma" do
|
64
|
+
result = helper.create_argument_element_spacer(xml, -2, 1)
|
65
|
+
xml.target!.should eq("<span>, </span>")
|
66
|
+
end
|
67
|
+
|
68
|
+
it "returns only the span with comma and a break " do
|
69
|
+
result = helper.create_argument_element_spacer(xml, 1, 3)
|
70
|
+
xml.target!.should eq("<span>, </span><br/>")
|
71
|
+
end
|
72
|
+
|
73
|
+
it "returns a break and a ) sign " do
|
74
|
+
result = helper.create_argument_element_spacer(xml, 2, 3)
|
75
|
+
xml.target!.should eq("<br/><span class=\"bold\">)</span>")
|
76
|
+
end
|
77
|
+
|
78
|
+
[3, 4, 4, 5, 6].each do |j_value|
|
79
|
+
it "returns only the span with comma " do
|
80
|
+
result = helper.create_argument_element_spacer(xml, j_value, 3)
|
81
|
+
xml.target!.should eq("<br/>")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
context "create_html_public_method_arguments" do
|
90
|
+
let(:pre) {[]}
|
91
|
+
let(:element) {mock}
|
92
|
+
let(:second_element){mock}
|
93
|
+
|
94
|
+
it "returns only the span with comma " do
|
95
|
+
input = [element, second_element]
|
96
|
+
|
97
|
+
helper.stubs(:create_method_argument_element).returns("bla")
|
98
|
+
helper.stubs(:create_argument_element_spacer).returns("blabla")
|
99
|
+
result = helper. create_html_public_method_arguments(xml, pre, input)
|
100
|
+
xml.target!.should eq("<br/>")
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WashoutBuilderMethodListHelper, :type => :helper do
|
4
|
+
let!(:xml) { Builder::XmlMarkup.new}
|
5
|
+
|
6
|
+
|
7
|
+
context "create_return_complex_type_list_html" do
|
8
|
+
let(:complex_class) {"SomeComplexClass"}
|
9
|
+
let (:builder_elem) {mock}
|
10
|
+
let(:builder_out) {[builder_elem]}
|
11
|
+
|
12
|
+
it "returns simple type " do
|
13
|
+
builder_elem.expects(:multiplied).returns(false)
|
14
|
+
result = helper.create_return_complex_type_list_html(xml, complex_class, builder_out)
|
15
|
+
result.should eq("<span class=\"pre\"><a href=\"#SomeComplexClass\"><span class=\"lightBlue\">SomeComplexClass</span></a></span>")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns array type " do
|
19
|
+
builder_elem.expects(:multiplied).returns(true)
|
20
|
+
result = helper.create_return_complex_type_list_html(xml, complex_class, builder_out)
|
21
|
+
result.should eq("<span class=\"pre\"><a href=\"#SomeComplexClass\"><span class=\"lightBlue\">Array of SomeComplexClass</span></a></span>")
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
context "create_return_type_list_html" do
|
28
|
+
let(:complex_class) {"SomeComplexClass"}
|
29
|
+
let (:builder_elem) {mock}
|
30
|
+
let(:output) {[builder_elem]}
|
31
|
+
let(:type) {"string"}
|
32
|
+
|
33
|
+
before(:each) do
|
34
|
+
builder_elem.stubs(:get_complex_class_name).returns(complex_class)
|
35
|
+
builder_elem.stubs(:type).returns(type)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "returns void for nil" do
|
39
|
+
helper.create_return_type_list_html(xml, nil)
|
40
|
+
xml.target!.should eq("<span class=\"pre\">void</span>")
|
41
|
+
end
|
42
|
+
|
43
|
+
it "returns basic type" do
|
44
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(true)
|
45
|
+
helper.create_return_type_list_html(xml, output)
|
46
|
+
xml.target!.should eq("<span class=\"pre\"><span class=\"blue\">string</span></span>")
|
47
|
+
end
|
48
|
+
it "returns complex type" do
|
49
|
+
expected ="some expected string"
|
50
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(false)
|
51
|
+
helper.expects(:create_return_complex_type_html).with(instance_of(Builder::XmlMarkup), complex_class, output).returns(expected)
|
52
|
+
result = helper.create_return_type_list_html(xml, output)
|
53
|
+
result.should eq(expected)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "returns nil if complex class is nil" do
|
57
|
+
builder_elem.stubs(:get_complex_class_name).returns(nil)
|
58
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(false)
|
59
|
+
result = helper.create_return_type_list_html(xml, output)
|
60
|
+
result.should eq(nil)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe WashoutBuilderMethodReturnTypeHelper, :type => :helper do
|
4
|
+
let!(:xml) { Builder::XmlMarkup.new}
|
5
|
+
let(:pre) {[]}
|
6
|
+
|
7
|
+
context "create_html_public_method_return_type" do
|
8
|
+
let(:complex_class) {"SomeComplexClass"}
|
9
|
+
let (:builder_elem) {mock}
|
10
|
+
let(:output) {[builder_elem]}
|
11
|
+
let(:type) {"string"}
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
builder_elem.stubs(:get_complex_class_name).returns(complex_class)
|
15
|
+
builder_elem.stubs(:type).returns(type)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns void if output nil" do
|
19
|
+
result = helper.create_html_public_method_return_type(xml, pre, nil)
|
20
|
+
result.should eq(["void"])
|
21
|
+
end
|
22
|
+
|
23
|
+
it "returns basic type" do
|
24
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(true)
|
25
|
+
result = helper.create_html_public_method_return_type(xml, pre, output)
|
26
|
+
result.should eq("<span class=\"blue\">#{type}</span>")
|
27
|
+
end
|
28
|
+
|
29
|
+
it "returns simeple complex typel" do
|
30
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(false)
|
31
|
+
builder_elem.expects(:multiplied).returns(false)
|
32
|
+
result = helper.create_html_public_method_return_type(xml, pre, output)
|
33
|
+
result.should eq(["<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a>"])
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns array of complex typel" do
|
37
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(false)
|
38
|
+
builder_elem.expects(:multiplied).returns(true)
|
39
|
+
result = helper.create_html_public_method_return_type(xml, pre, output)
|
40
|
+
result.should eq(["<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a>"])
|
41
|
+
end
|
42
|
+
|
43
|
+
it "returns nil if complex class is nil" do
|
44
|
+
WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(false)
|
45
|
+
builder_elem.expects(:get_complex_class_name).returns(nil)
|
46
|
+
result = helper.create_html_public_method_return_type(xml, pre, output)
|
47
|
+
result.should eq(nil)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
#encoding:utf-8
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
+
class InheritedExceptionModel
|
5
|
+
include WashoutBuilder::Document::ExceptionModel
|
6
|
+
|
7
|
+
end
|
8
|
+
|
4
9
|
|
5
10
|
describe WashoutBuilder::Document::ExceptionModel do
|
6
11
|
|
@@ -16,6 +21,7 @@ describe WashoutBuilder::Document::ExceptionModel do
|
|
16
21
|
specify { described_class.included_modules.should include(extension) }
|
17
22
|
end
|
18
23
|
|
24
|
+
specify {InheritedExceptionModel.included_modules.should include(WashoutBuilder::Document::SharedComplexType) }
|
19
25
|
|
20
26
|
def fault_ancestor_hash(subject, structure, ancestors)
|
21
27
|
{:fault => subject,:structure =>structure ,:ancestors => ancestors }
|
@@ -79,4 +85,4 @@ describe WashoutBuilder::Document::ExceptionModel do
|
|
79
85
|
subject.get_fault_class_ancestors([])
|
80
86
|
end
|
81
87
|
|
82
|
-
end
|
88
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -15,10 +15,10 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[*formatters]
|
|
15
15
|
|
16
16
|
|
17
17
|
Coveralls.wear!
|
18
|
-
SimpleCov.start do
|
18
|
+
SimpleCov.start "rails" do
|
19
19
|
add_filter 'spec'
|
20
|
-
add_group 'Library', 'lib'
|
21
|
-
|
20
|
+
#add_group 'Library', 'lib'
|
21
|
+
# add_group 'App', 'app'
|
22
22
|
|
23
23
|
at_exit do; end
|
24
24
|
end
|
@@ -116,4 +116,4 @@ end
|
|
116
116
|
|
117
117
|
def get_wash_out_param(class_name_or_structure, soap_config = soap_config)
|
118
118
|
WashOut::Param.parse_builder_def(soap_config, class_name_or_structure)[0]
|
119
|
-
end
|
119
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: washout_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wash_out
|
@@ -17,7 +17,7 @@ dependencies:
|
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.9.1
|
20
|
-
- -
|
20
|
+
- - '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 0.9.1
|
23
23
|
type: :runtime
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.9.1
|
30
|
-
- -
|
30
|
+
- - '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.9.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
@@ -37,7 +37,7 @@ dependencies:
|
|
37
37
|
- - ~>
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '3.3'
|
40
|
-
- -
|
40
|
+
- - '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '3.3'
|
43
43
|
type: :development
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '3.3'
|
50
|
-
- -
|
50
|
+
- - '>='
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '3.3'
|
53
53
|
- !ruby/object:Gem::Dependency
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
- - ~>
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '2.5'
|
60
|
-
- -
|
60
|
+
- - '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '2.5'
|
63
63
|
type: :development
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '2.5'
|
70
|
-
- -
|
70
|
+
- - '>='
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '2.5'
|
73
73
|
- !ruby/object:Gem::Dependency
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
- - ~>
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '2.1'
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2.1'
|
83
83
|
type: :development
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '2.1'
|
90
|
-
- -
|
90
|
+
- - '>='
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '2.1'
|
93
93
|
- !ruby/object:Gem::Dependency
|
@@ -97,7 +97,7 @@ dependencies:
|
|
97
97
|
- - ~>
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '1.6'
|
100
|
-
- -
|
100
|
+
- - '>='
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '1.6'
|
103
103
|
type: :development
|
@@ -107,7 +107,7 @@ dependencies:
|
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '1.6'
|
110
|
-
- -
|
110
|
+
- - '>='
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '1.6'
|
113
113
|
- !ruby/object:Gem::Dependency
|
@@ -117,7 +117,7 @@ dependencies:
|
|
117
117
|
- - ~>
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '2.0'
|
120
|
-
- -
|
120
|
+
- - '>='
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '2.0'
|
123
123
|
type: :development
|
@@ -127,7 +127,7 @@ dependencies:
|
|
127
127
|
- - ~>
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '2.0'
|
130
|
-
- -
|
130
|
+
- - '>='
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '2.0'
|
133
133
|
- !ruby/object:Gem::Dependency
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- - ~>
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: 2.6.1
|
140
|
-
- -
|
140
|
+
- - '>='
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '2.6'
|
143
143
|
type: :development
|
@@ -147,7 +147,7 @@ dependencies:
|
|
147
147
|
- - ~>
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: 2.6.1
|
150
|
-
- -
|
150
|
+
- - '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '2.6'
|
153
153
|
- !ruby/object:Gem::Dependency
|
@@ -157,7 +157,7 @@ dependencies:
|
|
157
157
|
- - ~>
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: 4.2.9
|
160
|
-
- -
|
160
|
+
- - '>='
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '4.2'
|
163
163
|
type: :development
|
@@ -167,7 +167,7 @@ dependencies:
|
|
167
167
|
- - ~>
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: 4.2.9
|
170
|
-
- -
|
170
|
+
- - '>='
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '4.2'
|
173
173
|
- !ruby/object:Gem::Dependency
|
@@ -177,7 +177,7 @@ dependencies:
|
|
177
177
|
- - ~>
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: '1.0'
|
180
|
-
- -
|
180
|
+
- - '>='
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: '1.0'
|
183
183
|
type: :development
|
@@ -187,7 +187,7 @@ dependencies:
|
|
187
187
|
- - ~>
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '1.0'
|
190
|
-
- -
|
190
|
+
- - '>='
|
191
191
|
- !ruby/object:Gem::Version
|
192
192
|
version: '1.0'
|
193
193
|
- !ruby/object:Gem::Dependency
|
@@ -197,7 +197,7 @@ dependencies:
|
|
197
197
|
- - ~>
|
198
198
|
- !ruby/object:Gem::Version
|
199
199
|
version: '0.9'
|
200
|
-
- -
|
200
|
+
- - '>='
|
201
201
|
- !ruby/object:Gem::Version
|
202
202
|
version: '0.9'
|
203
203
|
type: :development
|
@@ -207,7 +207,7 @@ dependencies:
|
|
207
207
|
- - ~>
|
208
208
|
- !ruby/object:Gem::Version
|
209
209
|
version: '0.9'
|
210
|
-
- -
|
210
|
+
- - '>='
|
211
211
|
- !ruby/object:Gem::Version
|
212
212
|
version: '0.9'
|
213
213
|
- !ruby/object:Gem::Dependency
|
@@ -217,7 +217,7 @@ dependencies:
|
|
217
217
|
- - ~>
|
218
218
|
- !ruby/object:Gem::Version
|
219
219
|
version: 0.0.4
|
220
|
-
- -
|
220
|
+
- - '>='
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: 0.0.4
|
223
223
|
type: :development
|
@@ -227,7 +227,7 @@ dependencies:
|
|
227
227
|
- - ~>
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: 0.0.4
|
230
|
-
- -
|
230
|
+
- - '>='
|
231
231
|
- !ruby/object:Gem::Version
|
232
232
|
version: 0.0.4
|
233
233
|
- !ruby/object:Gem::Dependency
|
@@ -237,7 +237,7 @@ dependencies:
|
|
237
237
|
- - ~>
|
238
238
|
- !ruby/object:Gem::Version
|
239
239
|
version: '1.1'
|
240
|
-
- -
|
240
|
+
- - '>='
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: '1.1'
|
243
243
|
type: :development
|
@@ -247,7 +247,7 @@ dependencies:
|
|
247
247
|
- - ~>
|
248
248
|
- !ruby/object:Gem::Version
|
249
249
|
version: '1.1'
|
250
|
-
- -
|
250
|
+
- - '>='
|
251
251
|
- !ruby/object:Gem::Version
|
252
252
|
version: '1.1'
|
253
253
|
- !ruby/object:Gem::Dependency
|
@@ -257,7 +257,7 @@ dependencies:
|
|
257
257
|
- - ~>
|
258
258
|
- !ruby/object:Gem::Version
|
259
259
|
version: '0.7'
|
260
|
-
- -
|
260
|
+
- - '>='
|
261
261
|
- !ruby/object:Gem::Version
|
262
262
|
version: '0.7'
|
263
263
|
type: :development
|
@@ -267,7 +267,7 @@ dependencies:
|
|
267
267
|
- - ~>
|
268
268
|
- !ruby/object:Gem::Version
|
269
269
|
version: '0.7'
|
270
|
-
- -
|
270
|
+
- - '>='
|
271
271
|
- !ruby/object:Gem::Version
|
272
272
|
version: '0.7'
|
273
273
|
- !ruby/object:Gem::Dependency
|
@@ -277,7 +277,7 @@ dependencies:
|
|
277
277
|
- - ~>
|
278
278
|
- !ruby/object:Gem::Version
|
279
279
|
version: '1.1'
|
280
|
-
- -
|
280
|
+
- - '>='
|
281
281
|
- !ruby/object:Gem::Version
|
282
282
|
version: '1.1'
|
283
283
|
type: :development
|
@@ -287,7 +287,7 @@ dependencies:
|
|
287
287
|
- - ~>
|
288
288
|
- !ruby/object:Gem::Version
|
289
289
|
version: '1.1'
|
290
|
-
- -
|
290
|
+
- - '>='
|
291
291
|
- !ruby/object:Gem::Version
|
292
292
|
version: '1.1'
|
293
293
|
- !ruby/object:Gem::Dependency
|
@@ -297,7 +297,7 @@ dependencies:
|
|
297
297
|
- - ~>
|
298
298
|
- !ruby/object:Gem::Version
|
299
299
|
version: '2.2'
|
300
|
-
- -
|
300
|
+
- - '>='
|
301
301
|
- !ruby/object:Gem::Version
|
302
302
|
version: 2.2.1
|
303
303
|
type: :development
|
@@ -307,7 +307,7 @@ dependencies:
|
|
307
307
|
- - ~>
|
308
308
|
- !ruby/object:Gem::Version
|
309
309
|
version: '2.2'
|
310
|
-
- -
|
310
|
+
- - '>='
|
311
311
|
- !ruby/object:Gem::Version
|
312
312
|
version: 2.2.1
|
313
313
|
- !ruby/object:Gem::Dependency
|
@@ -317,7 +317,7 @@ dependencies:
|
|
317
317
|
- - ~>
|
318
318
|
- !ruby/object:Gem::Version
|
319
319
|
version: '2.41'
|
320
|
-
- -
|
320
|
+
- - '>='
|
321
321
|
- !ruby/object:Gem::Version
|
322
322
|
version: 2.41.0
|
323
323
|
type: :development
|
@@ -327,7 +327,7 @@ dependencies:
|
|
327
327
|
- - ~>
|
328
328
|
- !ruby/object:Gem::Version
|
329
329
|
version: '2.41'
|
330
|
-
- -
|
330
|
+
- - '>='
|
331
331
|
- !ruby/object:Gem::Version
|
332
332
|
version: 2.41.0
|
333
333
|
- !ruby/object:Gem::Dependency
|
@@ -337,7 +337,7 @@ dependencies:
|
|
337
337
|
- - ~>
|
338
338
|
- !ruby/object:Gem::Version
|
339
339
|
version: '1.0'
|
340
|
-
- -
|
340
|
+
- - '>='
|
341
341
|
- !ruby/object:Gem::Version
|
342
342
|
version: 1.0.1
|
343
343
|
type: :development
|
@@ -347,11 +347,10 @@ dependencies:
|
|
347
347
|
- - ~>
|
348
348
|
- !ruby/object:Gem::Version
|
349
349
|
version: '1.0'
|
350
|
-
- -
|
350
|
+
- - '>='
|
351
351
|
- !ruby/object:Gem::Version
|
352
352
|
version: 1.0.1
|
353
|
-
description:
|
354
|
-
https://github.com/inossidabile/wash_out/) '
|
353
|
+
description: 'WashOut Soap Service HTML-Documentation generator (extends WashOut https://github.com/inossidabile/wash_out/) '
|
355
354
|
email: raoul_ice@yahoo.com
|
356
355
|
executables: []
|
357
356
|
extensions: []
|
@@ -392,6 +391,10 @@ files:
|
|
392
391
|
- lib/washout_builder/version.rb
|
393
392
|
- spec/app/controllers/washout_builder_controller_spec.rb
|
394
393
|
- spec/app/helpers/washout_builder_complex_type_helper_spec.rb
|
394
|
+
- spec/app/helpers/washout_builder_fault_type_helper_spec.rb
|
395
|
+
- spec/app/helpers/washout_builder_method_arguments_helper_spec.rb
|
396
|
+
- spec/app/helpers/washout_builder_method_list_helper_spec.rb
|
397
|
+
- spec/app/helpers/washout_builder_method_return_type_helper_spec.rb
|
395
398
|
- spec/app/integration/washout_builder_all_services_spec.rb
|
396
399
|
- spec/app/integration/washout_builder_service_spec.rb
|
397
400
|
- spec/dummy/Rakefile
|
@@ -438,23 +441,27 @@ require_paths:
|
|
438
441
|
- lib
|
439
442
|
required_ruby_version: !ruby/object:Gem::Requirement
|
440
443
|
requirements:
|
441
|
-
- -
|
444
|
+
- - '>='
|
442
445
|
- !ruby/object:Gem::Version
|
443
446
|
version: '0'
|
444
447
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
445
448
|
requirements:
|
446
|
-
- -
|
449
|
+
- - '>='
|
447
450
|
- !ruby/object:Gem::Version
|
448
451
|
version: '0'
|
449
452
|
requirements: []
|
450
453
|
rubyforge_project:
|
451
|
-
rubygems_version: 2.
|
454
|
+
rubygems_version: 2.4.2
|
452
455
|
signing_key:
|
453
456
|
specification_version: 4
|
454
457
|
summary: WashOut Soap Service HTML-Documentation generator (extends WashOut https://github.com/inossidabile/wash_out/)
|
455
458
|
test_files:
|
456
459
|
- spec/app/controllers/washout_builder_controller_spec.rb
|
457
460
|
- spec/app/helpers/washout_builder_complex_type_helper_spec.rb
|
461
|
+
- spec/app/helpers/washout_builder_fault_type_helper_spec.rb
|
462
|
+
- spec/app/helpers/washout_builder_method_arguments_helper_spec.rb
|
463
|
+
- spec/app/helpers/washout_builder_method_list_helper_spec.rb
|
464
|
+
- spec/app/helpers/washout_builder_method_return_type_helper_spec.rb
|
458
465
|
- spec/app/integration/washout_builder_all_services_spec.rb
|
459
466
|
- spec/app/integration/washout_builder_service_spec.rb
|
460
467
|
- spec/dummy/Rakefile
|