washout_builder 0.13.7 → 0.13.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTIzNTdkZDJlMzA5Y2I2NmZmMDAzNmI3OTcwZGZiMzYyNzE1ZjJlNQ==
4
+ NDBmZWYxODM5YTU5YmZjZmZkNGYwZWJmNWZiN2Y5ODg5YTkwZjE4MA==
5
5
  data.tar.gz: !binary |-
6
- NWExMWI3ZGFjNDU3NGNkN2E0NjMzMmNiMjQ5ZWJiM2U0YjBiZWNmNQ==
6
+ ZGRjMDc3YmI2YWFiOGFkMzk3N2Y4Nzc5MGM0ZWMwNmZlYWM2NzY0NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWMxYzQ0OTU1ZGFiOTFkNjA2OTg1ZDc2OWZmM2ZkZTM2YWIxNGM0ZmRhZjQ1
10
- MjIyOGFjNTAzN2U0YmI1YTQ4OTA4NmU1ZDhkZjZmMzJlMWIwODMzMDZjZjE5
11
- YTgxYTNjMjkzZDM0Zjg4NmM5ZTNjMDY2YWVmZjAxOGY4NGQ4NDg=
9
+ MzQyZjY1MGUyMTY4OTA4YTNhYmRiYjNlM2IyOThlMGUwZmVjNjc1NDExOTc1
10
+ NTJmYTlmNmJiZjkxNTVkNjg5ZmVmYjU2YzUxYTc3OTM5ZTM2NGZlZDY1NzAy
11
+ MWE0ZmYxZjkwYzU5OTQ2YjY0ZWU0ODk2YzYzM2U1NmQwMjZiMWI=
12
12
  data.tar.gz: !binary |-
13
- NTdjNTM1MGRkYTdmYWIxOTY0MTE3NGVmYTc4M2RkN2RjNTI5YTY4MjJlYmVl
14
- ZTE3MzM2YmY0MDA2OWE5OTgzMzM0MTg5Mzk4ODQwNmNmYzYxYTZmNTA3OWFl
15
- NDhkMTAyN2Q5OTIwNTk0MmU1ZjNlZGIxMGI2ZjJmOTVlOTY5NmM=
13
+ MjJiM2VhOTIxYjU4NGJjOThkZWQ5MTNmM2E0ZTc2NTQyYWU5ZDA3ZmQ0NjZh
14
+ YzZkNjFhNDZjOWJlZWUwNWQ0MjVjYWMyYjI4YzY4NzI0MjJkMzMzZWU0MDZk
15
+ MWE4NzI0MzNlNGFiNTdmODk2ZjU2ZGU5YWUzMDE1NmJjNDk5ODc=
data/Appraisals CHANGED
@@ -16,4 +16,8 @@ end
16
16
 
17
17
  appraise "rails-4.1.1" do
18
18
  gem "rails", "4.1.1"
19
+ end
20
+
21
+ appraise "rails-4.1.4" do
22
+ gem "rails", "4.1.4"
19
23
  end
data/README.rdoc CHANGED
@@ -4,7 +4,8 @@
4
4
  {<img src="https://coveralls.io/repos/bogdanRada/washout_builder/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/bogdanRada/washout_builder]
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
- {<img src="https://gem-download-badge.herokuapp.com/?gem=washout_builder&type=total" alt="Version Downloads"/>}[https://rubygems.org/gems/washout_builder]
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
+
8
9
  = Overview
9
10
  WashOutBuilder is a Soap Service Documentation generator (extends WashOut https://github.com/inossidabile/wash_out/)
10
11
 
@@ -1,11 +1,8 @@
1
1
  module WashoutBuilder
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace WashoutBuilder
4
- initializer "wash_out.configuration" do |app|
5
- if app.config.wash_out[:catch_xml_errors]
6
- app.config.middleware.insert_after 'ActionDispatch::ShowExceptions', WashOut::Middleware if defined?(WashOut::Middleware)
7
- app.config.middleware.insert_after 'ActionDispatch::ShowExceptions', WashOut::Middlewares::Catcher if defined?(WashOut::Middlewares::Catcher)
8
- end
4
+ initializer "washout_builder.configuration" do |app|
5
+
9
6
  end
10
- end
7
+ end
11
8
  end
@@ -1,3 +1,14 @@
1
- module WashoutBuilder
2
- VERSION = "0.13.7"
1
+ module WashoutBuilder # Returns the version of the currently loaded Rails as a <tt>Gem::Version</tt>
2
+ def self.gem_version
3
+ Gem::Version.new VERSION::STRING
4
+ end
5
+
6
+ module VERSION
7
+ MAJOR = 0
8
+ MINOR = 13
9
+ TINY = 8
10
+ PRE = nil
11
+
12
+ STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
13
+ end
3
14
  end
@@ -30,8 +30,7 @@ describe WashoutBuilder::Document::ComplexType do
30
30
  it "returns error if classname already detected (only used for hashes)" do
31
31
  subject.stubs(:classified?).returns(false)
32
32
  subject.stubs(:basic_type).returns("ProjectType")
33
- defined = [ { :class= => "ProjectType" }]
34
- defined.stubs(:detect).returns({:class => "ProjectType"})
33
+ defined = [ { :class => "ProjectType" }]
35
34
  expect {subject.get_complex_class_name(defined) }.to raise_error(RuntimeError, "Duplicate use of `ProjectType` type name. Consider using classified types.")
36
35
  end
37
36
 
@@ -50,8 +49,143 @@ describe WashoutBuilder::Document::ComplexType do
50
49
  subject.get_ancestors(ProjectType).should eq([])
51
50
  end
52
51
 
52
+ it "same as ancestor" do
53
+ subject.get_ancestors("WashoutBuilderSomeInexistentClass").should eq(nil)
54
+ end
55
+
56
+ it "returns the complex type ancestors" do
57
+ expected = "some_name"
58
+ subject.stubs(:classified?).returns(true)
59
+ subject.expects(:get_class_ancestors).with(soap_config, ProjectType, []).returns(expected)
60
+ subject.complex_type_ancestors(soap_config, ProjectType, [] ).should eq(expected)
61
+ end
62
+
63
+ it "returns nil for unclassified objects" do
64
+ subject.stubs(:classified?).returns(false)
65
+ subject.complex_type_ancestors(soap_config, ProjectType, [] ).should eq(nil)
66
+ end
67
+
68
+ it "should remove inheritable elements" do
69
+ subject_dup = subject.dup
70
+ subject_dup.remove_type_inheritable_elements(["name"])
71
+ subject_dup.map.detect {|element| element.name == "name" }.should eq(nil)
72
+ end
73
+
74
+
75
+ it "should return true if same structure" do
76
+ subject.same_structure_as_ancestor?(subject).should eq(true)
77
+ end
78
+
79
+
80
+
81
+ it "should return true if same structure" do
82
+ subject.same_structure_as_ancestor?(get_wash_out_param(Fluffy)).should eq(false)
83
+ end
84
+
85
+
86
+ describe '#complex_type_descendants' do
87
+
88
+ it "returns empty array if not struct?" do
89
+ defined = []
90
+ subject.stubs(:struct?).returns(false)
91
+ subject.complex_type_descendants(soap_config, defined).should eq(defined)
92
+ end
93
+
94
+ it "returns the descendants if struct?" do
95
+ defined = []
96
+ subject.map.each { |obj|
97
+ obj.expects(:get_nested_complex_types).with(soap_config, defined).returns([obj.name])
98
+ }
99
+ subject.stubs(:struct?).returns(true)
100
+ subject.complex_type_descendants(soap_config, defined).should eq(subject.map.collect{|x| x.name } )
101
+ end
102
+
103
+ end
53
104
 
105
+
106
+ describe "#get_nested_complex_types" do
107
+
108
+ let(:complex_class) {"ProjectType" }
109
+ let(:ancestors) { ["something"]}
110
+ let(:complex_type_hash) { {:class =>complex_class, :obj =>subject , :ancestors => ancestors }}
111
+ let(:expected) { [complex_type_hash]}
112
+
113
+ it "returns the complex class ancestors" do
114
+ defined = []
115
+ subject.expects(:get_complex_class_name).with(defined).returns(complex_class)
116
+ subject.expects(:fix_descendant_wash_out_type).with(soap_config, complex_class).returns(true)
117
+ subject.expects(:complex_type_ancestors).with(soap_config, complex_class, defined).returns(ancestors)
118
+ subject.expects(:complex_type_hash).with(complex_class, subject, ancestors ).returns(complex_type_hash)
119
+ subject.expects(:complex_type_descendants).with(soap_config, [complex_type_hash]).returns(expected)
120
+ subject.get_nested_complex_types(soap_config, defined).should eq(expected)
121
+ end
122
+
123
+ it "returns the the descendants" do
124
+ defined = nil
125
+ subject.expects(:get_complex_class_name).with([]).returns(nil)
126
+ subject.expects(:fix_descendant_wash_out_type).with(soap_config, nil).returns(true)
127
+ subject.expects(:complex_type_descendants).with(soap_config, []).returns(expected)
128
+ subject.get_nested_complex_types(soap_config, defined).should eq(expected)
129
+ end
130
+
131
+ end
132
+
133
+
134
+ describe '#ancestor_structure' do
135
+ let(:ancestor_class) {ProjectType}
136
+ let(:ancestors) { [ancestor_class] }
137
+
138
+
139
+ it "returns the ancestor structure" do
140
+ subject.ancestor_structure(ancestors).should eq({ ancestors[0].to_s.downcase => ancestors[0].wash_out_param_map })
141
+ end
142
+
143
+ end
54
144
 
55
145
 
146
+ describe '#complex_type_hash' do
147
+ let(:complex_class) {"ProjectType" }
148
+ let(:ancestors) { ["something"]}
149
+
150
+
151
+ it "returns the complex_type_hash" do
152
+ subject.complex_type_hash(complex_class, subject, ancestors).should eq({:class =>complex_class, :obj =>subject , :ancestors => ancestors })
153
+ end
154
+
155
+ end
156
+
157
+
158
+ describe '#get_class_ancestors' do
159
+ let(:class_name) {"ProjectType" }
160
+ let(:defined) { [] }
161
+ let(:ancestors) { ["SomeInexistentClass"] }
162
+ let(:ancestor_structure) {{ ancestors[0].to_s.downcase => "bla" }}
163
+ let(:top_ancestors){}
164
+ let(:complex_type_hash) { {:class =>class_name, :obj =>subject , :ancestors => ancestors }}
165
+
166
+ it "returns nil if no ancestors" do
167
+ subject.expects(:get_ancestors).with(class_name).returns(nil)
168
+ subject.get_class_ancestors(soap_config, class_name, defined).should eq(nil)
169
+ end
170
+
171
+ it "returns the ancestors and the top ones" do
172
+ skip "recursion problem"
173
+ subject.expects(:get_ancestors).with(class_name).returns(ancestors)
174
+ subject.expects(:ancestor_structure).with(ancestors).returns(ancestor_structure)
175
+ WashOut::Param.stubs(:parse_def).returns([namespaced_object])
176
+ subject.expects(:same_structure_as_ancestor?).with(namespaced_object).returns(false)
177
+ subject.expects(:complex_type_hash).returns(complex_type_hash)
178
+ subject.get_class_ancestors(soap_config, class_name, defined).should eq([complex_type_hash])
179
+ end
180
+
181
+ it "returns nil if same structure as ancestor" do
182
+ subject.expects(:get_ancestors).with(class_name).returns(ancestors)
183
+ subject.expects(:ancestor_structure).with(ancestors).returns(ancestor_structure)
184
+ WashOut::Param.stubs(:parse_def).returns([namespaced_object])
185
+ subject.expects(:same_structure_as_ancestor?).with(namespaced_object).returns(true)
186
+ subject.get_class_ancestors(soap_config, class_name, defined).should eq(nil)
187
+ end
188
+
189
+ end
56
190
 
57
191
  end
@@ -10,6 +10,13 @@ describe WashoutBuilder::Document::ExceptionModel do
10
10
  let(:base_structure) { {"code"=>{:primitive=>"integer", :member_type=>nil}, "message"=>{:primitive=>"string", :member_type=>nil}, "backtrace"=>{:primitive=>"string", :member_type=>nil}}}
11
11
  let(:ancestors) {[base_exception]}
12
12
 
13
+ [
14
+ WashoutBuilder::Document::SharedComplexType
15
+ ].each do |extension|
16
+ specify { described_class.included_modules.should include(extension) }
17
+ end
18
+
19
+
13
20
  def fault_ancestor_hash(subject, structure, ancestors)
14
21
  {:fault => subject,:structure =>structure ,:ancestors => ancestors }
15
22
  end
@@ -46,6 +53,11 @@ describe WashoutBuilder::Document::ExceptionModel do
46
53
  subject.fault_ancestors.should eq ancestors
47
54
  end
48
55
 
56
+ it "gets the attribute type" do
57
+ subject.get_fault_type_method("some_name").should eq "string"
58
+ end
59
+
60
+
49
61
  it "gets the fault_without_inheritable_elements" do
50
62
  ancestors[0].expects(:get_fault_model_structure).returns(structure)
51
63
  subject.expects(:remove_fault_type_inheritable_elements).with(structure.keys)
@@ -60,7 +72,7 @@ describe WashoutBuilder::Document::ExceptionModel do
60
72
  end
61
73
 
62
74
  it "gets the ancestors" do
63
- expected_defined = fault_ancestor_hash(subject, structure, ancestors)
75
+ expected_defined = fault_ancestor_hash(subject, structure, ancestors)
64
76
  subject.expects(:fault_ancestors).returns(ancestors)
65
77
  subject.expects(:fault_without_inheritable_elements).with(ancestors).returns(structure)
66
78
  subject.expects(:fault_ancestor_hash).returns(expected_defined)
@@ -34,7 +34,7 @@ describe WashoutBuilder do
34
34
  result = savon_client.call(method, :message => message)
35
35
  result.respond_to?(:to_hash) ? result.to_hash : result
36
36
  end
37
-
37
+
38
38
  describe "Module" do
39
39
  it "includes" do
40
40
  lambda {
@@ -2,7 +2,7 @@ require File.expand_path("../lib/washout_builder/version", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "washout_builder"
5
- s.version = WashoutBuilder::VERSION
5
+ s.version = WashoutBuilder.gem_version
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.summary = "WashOut Soap Service HTML-Documentation generator (extends WashOut https://github.com/inossidabile/wash_out/)"
8
8
  s.email = "raoul_ice@yahoo.com"
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.13.7
4
+ version: 0.13.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-05 00:00:00.000000000 Z
11
+ date: 2014-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: wash_out