washout_builder 0.14.1 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -2
  3. data/.rubocop.yml +68 -0
  4. data/.travis.yml +1 -1
  5. data/Appraisals +9 -1
  6. data/Gemfile +2 -3
  7. data/Rakefile +17 -20
  8. data/app/controllers/washout_builder/washout_builder_controller.rb +79 -79
  9. data/app/helpers/washout_builder_complex_type_helper.rb +16 -23
  10. data/app/helpers/washout_builder_fault_type_helper.rb +12 -13
  11. data/app/helpers/washout_builder_method_arguments_helper.rb +24 -26
  12. data/app/helpers/washout_builder_method_list_helper.rb +16 -11
  13. data/app/helpers/washout_builder_method_return_type_helper.rb +14 -12
  14. data/app/views/wash_with_html/doc.builder +2 -2
  15. data/bin/appraisal +16 -0
  16. data/bin/autospec +16 -0
  17. data/bin/bundler +16 -0
  18. data/bin/cdiff +16 -0
  19. data/bin/coderay +16 -0
  20. data/bin/colortab +16 -0
  21. data/bin/coveralls +16 -0
  22. data/bin/decolor +16 -0
  23. data/bin/erubis +16 -0
  24. data/bin/guard +16 -0
  25. data/bin/htmldiff +16 -0
  26. data/bin/ldiff +16 -0
  27. data/bin/listen +16 -0
  28. data/bin/nokogiri +16 -0
  29. data/bin/phare +16 -0
  30. data/bin/pry +16 -0
  31. data/bin/rackup +16 -0
  32. data/bin/rails +16 -0
  33. data/bin/rake +16 -0
  34. data/bin/restclient +16 -0
  35. data/bin/rspec +16 -0
  36. data/bin/rubocop +16 -0
  37. data/bin/ruby-parse +16 -0
  38. data/bin/ruby-rewrite +16 -0
  39. data/bin/sass +16 -0
  40. data/bin/sass-convert +16 -0
  41. data/bin/scss +16 -0
  42. data/bin/scss-lint +16 -0
  43. data/bin/term_display +16 -0
  44. data/bin/term_mandel +16 -0
  45. data/bin/thor +16 -0
  46. data/bin/uuid +16 -0
  47. data/config/routes.rb +3 -3
  48. data/init.rb +1 -1
  49. data/lib/washout_builder.rb +20 -29
  50. data/lib/washout_builder/document/complex_type.rb +70 -75
  51. data/lib/washout_builder/document/exception_model.rb +46 -51
  52. data/lib/washout_builder/document/generator.rb +56 -66
  53. data/lib/washout_builder/document/shared_complex_type.rb +2 -4
  54. data/lib/washout_builder/engine.rb +1 -2
  55. data/lib/washout_builder/soap.rb +6 -10
  56. data/lib/washout_builder/type.rb +9 -23
  57. data/lib/washout_builder/version.rb +5 -5
  58. data/spec/app/controllers/washout_builder_controller_spec.rb +26 -28
  59. data/spec/app/helpers/washout_builder_complex_type_helper_spec.rb +37 -45
  60. data/spec/app/helpers/washout_builder_fault_type_helper_spec.rb +65 -77
  61. data/spec/app/helpers/washout_builder_method_arguments_helper_spec.rb +65 -76
  62. data/spec/app/helpers/washout_builder_method_list_helper_spec.rb +30 -35
  63. data/spec/app/helpers/washout_builder_method_return_type_helper_spec.rb +25 -27
  64. data/spec/dummy/config/application.rb +4 -4
  65. data/spec/dummy/config/boot.rb +1 -1
  66. data/spec/dummy/config/environments/development.rb +2 -3
  67. data/spec/dummy/config/environments/test.rb +3 -3
  68. data/spec/dummy/config/initializers/secret_token.rb +1 -1
  69. data/spec/dummy/config/initializers/session_store.rb +1 -1
  70. data/spec/dummy/config/routes.rb +0 -1
  71. data/spec/dummy/script/rails +2 -2
  72. data/spec/integration/washout_builder_all_services_spec.rb +2 -5
  73. data/spec/integration/washout_builder_service_spec.rb +2 -5
  74. data/spec/lib/washout_builder/document/complex_type_spec.rb +98 -118
  75. data/spec/lib/washout_builder/document/exception_model_spec.rb +49 -54
  76. data/spec/lib/washout_builder/document/generator_spec.rb +93 -118
  77. data/spec/lib/washout_builder/type_spec.rb +17 -29
  78. data/spec/lib/washout_builder_spec.rb +293 -308
  79. data/spec/spec_helper.rb +24 -30
  80. data/spec/support/complex_types/fluffy.rb +3 -3
  81. data/spec/support/complex_types/fluffy_container.rb +3 -3
  82. data/spec/support/complex_types/project_type.rb +4 -5
  83. data/spec/support/complex_types/test_type.rb +4 -4
  84. data/washout_builder.gemspec +5 -2
  85. metadata +78 -3
@@ -1,65 +1,60 @@
1
1
  require 'spec_helper'
2
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
3
+ describe WashoutBuilderMethodListHelper, type: :helper do
4
+ let!(:xml) { Builder::XmlMarkup.new }
5
+
6
+ context 'create_return_complex_type_list_html' do
7
+ let(:complex_class) { 'SomeComplexClass' }
8
+ let(:builder_elem) { mock }
9
+ let(:builder_out) { [builder_elem] }
10
+
11
+ it 'returns simple type ' do
13
12
  builder_elem.expects(:multiplied).returns(false)
14
- result = helper.create_return_complex_type_list_html(xml, complex_class, builder_out)
13
+ result = helper.create_return_complex_type_list_html(xml, complex_class, builder_out)
15
14
  result.should eq("<span class=\"pre\"><a href=\"#SomeComplexClass\"><span class=\"lightBlue\">SomeComplexClass</span></a></span>")
16
15
  end
17
-
18
- it "returns array type " do
16
+
17
+ it 'returns array type ' do
19
18
  builder_elem.expects(:multiplied).returns(true)
20
- result = helper.create_return_complex_type_list_html(xml, complex_class, builder_out)
19
+ result = helper.create_return_complex_type_list_html(xml, complex_class, builder_out)
21
20
  result.should eq("<span class=\"pre\"><a href=\"#SomeComplexClass\"><span class=\"lightBlue\">Array of SomeComplexClass</span></a></span>")
22
21
  end
23
-
24
22
  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
-
23
+
24
+ context 'create_return_type_list_html' do
25
+ let(:complex_class) { 'SomeComplexClass' }
26
+ let(:builder_elem) { mock }
27
+ let(:output) { [builder_elem] }
28
+ let(:type) { 'string' }
29
+
33
30
  before(:each) do
34
- builder_elem.stubs(:get_complex_class_name).returns(complex_class)
31
+ builder_elem.stubs(:find_complex_class_name).returns(complex_class)
35
32
  builder_elem.stubs(:type).returns(type)
36
33
  end
37
-
38
- it "returns void for nil" do
34
+
35
+ it 'returns void for nil' do
39
36
  helper.create_return_type_list_html(xml, nil)
40
37
  xml.target!.should eq("<span class=\"pre\">void</span>")
41
38
  end
42
-
43
- it "returns basic type" do
39
+
40
+ it 'returns basic type' do
44
41
  WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(true)
45
42
  helper.create_return_type_list_html(xml, output)
46
43
  xml.target!.should eq("<span class=\"pre\"><span class=\"blue\">string</span></span>")
47
44
  end
48
- it "returns complex type" do
49
- expected ="some expected string"
45
+ it 'returns complex type' do
46
+ expected = 'some expected string'
50
47
  WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(false)
51
48
  helper.expects(:create_return_complex_type_html).with(instance_of(Builder::XmlMarkup), complex_class, output).returns(expected)
52
49
  result = helper.create_return_type_list_html(xml, output)
53
50
  result.should eq(expected)
54
51
  end
55
-
56
- it "returns nil if complex class is nil" do
57
- builder_elem.stubs(:get_complex_class_name).returns(nil)
52
+
53
+ it 'returns nil if complex class is nil' do
54
+ builder_elem.stubs(:find_complex_class_name).returns(nil)
58
55
  WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(false)
59
56
  result = helper.create_return_type_list_html(xml, output)
60
57
  result.should eq(nil)
61
58
  end
62
-
63
59
  end
64
-
65
60
  end
@@ -1,52 +1,50 @@
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
-
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
13
  before(:each) do
14
- builder_elem.stubs(:get_complex_class_name).returns(complex_class)
14
+ builder_elem.stubs(:find_complex_class_name).returns(complex_class)
15
15
  builder_elem.stubs(:type).returns(type)
16
16
  end
17
-
18
- it "returns void if output nil" do
17
+
18
+ it 'returns void if output nil' do
19
19
  result = helper.create_html_public_method_return_type(xml, pre, nil)
20
- result.should eq(["void"])
20
+ result.should eq(['void'])
21
21
  end
22
-
23
- it "returns basic type" do
22
+
23
+ it 'returns basic type' do
24
24
  WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(true)
25
25
  result = helper.create_html_public_method_return_type(xml, pre, output)
26
26
  result.should eq("<span class=\"blue\">#{type}</span>")
27
27
  end
28
-
29
- it "returns simeple complex typel" do
28
+
29
+ it 'returns simeple complex typel' do
30
30
  WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(false)
31
31
  builder_elem.expects(:multiplied).returns(false)
32
32
  result = helper.create_html_public_method_return_type(xml, pre, output)
33
33
  result.should eq(["<a href='##{complex_class}'><span class='lightBlue'>#{complex_class}</span></a>"])
34
34
  end
35
-
36
- it "returns array of complex typel" do
35
+
36
+ it 'returns array of complex typel' do
37
37
  WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(false)
38
38
  builder_elem.expects(:multiplied).returns(true)
39
39
  result = helper.create_html_public_method_return_type(xml, pre, output)
40
40
  result.should eq(["<a href='##{complex_class}'><span class='lightBlue'>Array of #{complex_class}</span></a>"])
41
41
  end
42
-
43
- it "returns nil if complex class is nil" do
42
+
43
+ it 'returns nil if complex class is nil' do
44
44
  WashoutBuilder::Type::BASIC_TYPES.expects(:include?).with(builder_elem.type).returns(false)
45
- builder_elem.expects(:get_complex_class_name).returns(nil)
45
+ builder_elem.expects(:find_complex_class_name).returns(nil)
46
46
  result = helper.create_html_public_method_return_type(xml, pre, output)
47
47
  result.should eq(nil)
48
48
  end
49
-
50
49
  end
51
-
52
50
  end
@@ -1,7 +1,7 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require "action_controller/railtie"
4
- require "rails/test_unit/railtie"
3
+ require 'action_controller/railtie'
4
+ require 'rails/test_unit/railtie'
5
5
 
6
6
  if Rails::VERSION::MAJOR >= 4
7
7
  # Ugly hack to make Rails 4 JRuby-compatible to escape Travis errors
@@ -13,7 +13,7 @@ if Rails::VERSION::MAJOR >= 4
13
13
  end
14
14
 
15
15
  Bundler.require
16
- require "wash_out"
16
+ require 'wash_out'
17
17
 
18
18
  module Dummy
19
19
  class Application < Rails::Application
@@ -43,7 +43,7 @@ module Dummy
43
43
  # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
44
44
 
45
45
  # Configure the default encoding used in templates for Ruby 1.9.
46
- config.encoding = "utf-8"
46
+ config.encoding = 'utf-8'
47
47
 
48
48
  # Configure sensitive parameters which will be filtered from the log file.
49
49
  config.filter_parameters += [:password]
@@ -7,4 +7,4 @@ if File.exist?(gemfile)
7
7
  Bundler.setup
8
8
  end
9
9
 
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
10
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -10,8 +10,8 @@ Dummy::Application.configure do
10
10
  config.whiny_nils = true
11
11
 
12
12
  # Show full error reports and disable caching
13
- config.consider_all_requests_local = true
14
- config.action_view.debug_rjs = true
13
+ config.consider_all_requests_local = true
14
+ config.action_view.debug_rjs = true
15
15
  config.action_controller.perform_caching = false
16
16
 
17
17
  # Print deprecation notices to the Rails logger
@@ -20,4 +20,3 @@ Dummy::Application.configure do
20
20
  # Only use best-standards-support built into browsers
21
21
  config.action_dispatch.best_standards_support = :builtin
22
22
  end
23
-
@@ -10,14 +10,14 @@ Dummy::Application.configure do
10
10
  config.eager_load = true
11
11
 
12
12
  # Show full error reports and disable caching
13
- config.consider_all_requests_local = true
13
+ config.consider_all_requests_local = true
14
14
  config.action_controller.perform_caching = false
15
-
15
+ config.active_support.test_order = :sorted
16
16
  # Raise exceptions instead of rendering exception templates
17
17
  config.action_dispatch.show_exceptions = false
18
18
 
19
19
  # Disable request forgery protection in test environment
20
- config.action_controller.allow_forgery_protection = false
20
+ config.action_controller.allow_forgery_protection = false
21
21
 
22
22
  # Use SQL instead of Active Record's schema dumper when creating the test database.
23
23
  # This is necessary if your schema can't be completely dumped by the schema dumper,
@@ -5,4 +5,4 @@
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
7
  Dummy::Application.config.secret_token = 'b8d5d5687c012c2ef1a7a6e8006172402c48a3dcccca67c076eaad81c4712ad236ca2717c3706df7b286468c749d223f22acb0d96c27bdf33bbdbb9684ad46e5'
8
- Dummy::Application.config.secret_key_base = 'ed27a919186a27649accc93ad8c2750a022ef255780e8a15a439658e9f8c520ed70ea071e596b2d23ed41163cf36c21ff5afcd31d19439bb1e4c420f2a57bce6'
8
+ Dummy::Application.config.secret_key_base = 'ed27a919186a27649accc93ad8c2750a022ef255780e8a15a439658e9f8c520ed70ea071e596b2d23ed41163cf36c21ff5afcd31d19439bb1e4c420f2a57bce6'
@@ -1,6 +1,6 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
4
 
5
5
  # Use the database for sessions instead of the cookie-based default,
6
6
  # which shouldn't be used to store highly confidential information
@@ -55,5 +55,4 @@ Dummy::Application.routes.draw do
55
55
  # This is a legacy wild controller route that's not recommended for RESTful applications.
56
56
  # Note: This route will make all actions in every controller accessible via GET requests.
57
57
  # match ':controller(/:action(/:id(.:format)))'
58
-
59
58
  end
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
3
 
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
6
  require 'rails/commands'
@@ -1,7 +1,4 @@
1
1
  require 'spec_helper'
2
2
 
3
- feature "All Services" do
4
-
5
-
6
-
7
- end
3
+ feature 'All Services' do
4
+ end
@@ -1,7 +1,4 @@
1
1
  require 'spec_helper'
2
2
 
3
- feature "Service" do
4
-
5
-
6
-
7
- end
3
+ feature 'Service' do
4
+ end
@@ -1,175 +1,157 @@
1
- #encoding:utf-8
1
+ # encoding:utf-8
2
2
  require 'spec_helper'
3
3
 
4
-
5
4
  describe WashoutBuilder::Document::ComplexType do
6
- let(:soap_config) { OpenStruct.new(
5
+ let(:soap_config) do
6
+ OpenStruct.new(
7
7
  camelize_wsdl: false,
8
- namespace: "/api/wsdl",
9
- description: "some description"
10
- ) }
11
-
12
- let(:subject) { get_wash_out_param(ProjectType) }
8
+ namespace: '/api/wsdl',
9
+ description: 'some description'
10
+ )
11
+ end
12
+
13
+ let(:subject) { get_wash_out_param(ProjectType) }
13
14
  let(:namespaced_object) { get_wash_out_param(Api::TestType) }
14
-
15
- it "returns the complex class name" do
16
- subject.get_complex_class_name.should eq("ProjectType")
17
- end
18
-
19
-
20
- it "returns the complex class name" do
21
- subject.get_complex_class_name.should eq("ProjectType")
22
- end
23
-
24
-
25
- it "returns the complex class with namespace" do
26
- namespaced_object.get_complex_class_name.should eq("Api::TestType")
27
- end
28
-
29
-
30
- it "returns error if classname already detected (only used for hashes)" do
15
+
16
+ it 'returns the complex class name' do
17
+ subject.find_complex_class_name.should eq('ProjectType')
18
+ end
19
+
20
+ it 'returns the complex class name' do
21
+ subject.find_complex_class_name.should eq('ProjectType')
22
+ end
23
+
24
+ it 'returns the complex class with namespace' do
25
+ namespaced_object.find_complex_class_name.should eq('Api::TestType')
26
+ end
27
+
28
+ it 'returns error if classname already detected (only used for hashes)' do
31
29
  subject.stubs(:classified?).returns(false)
32
- subject.stubs(:basic_type).returns("ProjectType")
33
- defined = [ { :class => "ProjectType" }]
34
- expect {subject.get_complex_class_name(defined) }.to raise_error(RuntimeError, "Duplicate use of `ProjectType` type name. Consider using classified types.")
30
+ subject.stubs(:basic_type).returns('ProjectType')
31
+ defined = [{ class: 'ProjectType' }]
32
+ expect { subject.find_complex_class_name(defined) }.to raise_error(RuntimeError, 'Duplicate use of `ProjectType` type name. Consider using classified types.')
35
33
  end
36
-
37
- it "returns the param structure" do
38
- subject.get_param_structure.should eq({"project"=>"struct"})
34
+
35
+ it 'returns the param structure' do
36
+ subject.find_param_structure.should eq('project' => 'struct')
39
37
  end
40
-
41
- it "fixes the first descendant " do
38
+
39
+ it 'fixes the first descendant ' do
42
40
  descendant = get_wash_out_param(ProjectType.wash_out_param_map)
43
41
  subject.fix_descendant_wash_out_type(soap_config, ProjectType)
44
42
  subject.name.should eq(descendant.name)
45
- subject.map[0].get_param_structure.should eq(descendant.map[0].get_param_structure)
43
+ subject.map[0].find_param_structure.should eq(descendant.map[0].find_param_structure)
46
44
  end
47
-
48
- it "same as ancestor" do
45
+
46
+ it 'same as ancestor' do
49
47
  subject.get_ancestors(ProjectType).should eq([])
50
48
  end
51
-
52
- it "same as ancestor" do
53
- subject.get_ancestors("WashoutBuilderSomeInexistentClass").should eq(nil)
49
+
50
+ it 'same as ancestor' do
51
+ subject.get_ancestors('WashoutBuilderSomeInexistentClass').should eq(nil)
54
52
  end
55
-
56
- it "returns the complex type ancestors" do
57
- expected = "some_name"
53
+
54
+ it 'returns the complex type ancestors' do
55
+ expected = 'some_name'
58
56
  subject.stubs(:classified?).returns(true)
59
57
  subject.expects(:get_class_ancestors).with(soap_config, ProjectType, []).returns(expected)
60
- subject.complex_type_ancestors(soap_config, ProjectType, [] ).should eq(expected)
58
+ subject.complex_type_ancestors(soap_config, ProjectType, []).should eq(expected)
61
59
  end
62
-
63
- it "returns nil for unclassified objects" do
60
+
61
+ it 'returns nil for unclassified objects' do
64
62
  subject.stubs(:classified?).returns(false)
65
- subject.complex_type_ancestors(soap_config, ProjectType, [] ).should eq(nil)
63
+ subject.complex_type_ancestors(soap_config, ProjectType, []).should eq(nil)
66
64
  end
67
-
68
- it "should remove inheritable elements" do
65
+
66
+ it 'should remove inheritable elements' do
69
67
  subject_dup = subject.dup
70
- subject_dup.remove_type_inheritable_elements(["name"])
71
- subject_dup.map.detect {|element| element.name == "name" }.should eq(nil)
68
+ subject_dup.remove_type_inheritable_elements(['name'])
69
+ subject_dup.map.find { |element| element.name == 'name' }.should eq(nil)
72
70
  end
73
-
74
-
75
- it "should return true if same structure" do
71
+
72
+ it 'should return true if same structure' do
76
73
  subject.same_structure_as_ancestor?(subject).should eq(true)
77
74
  end
78
-
79
-
80
-
81
- it "should return true if same structure" do
75
+
76
+ it 'should return true if same structure' do
82
77
  subject.same_structure_as_ancestor?(get_wash_out_param(Fluffy)).should eq(false)
83
78
  end
84
-
85
-
79
+
86
80
  describe '#complex_type_descendants' do
87
-
88
- it "returns empty array if not struct?" do
81
+ it 'returns empty array if not struct?' do
89
82
  defined = []
90
83
  subject.stubs(:struct?).returns(false)
91
84
  subject.complex_type_descendants(soap_config, defined).should eq(defined)
92
85
  end
93
-
94
- it "returns the descendants if struct?" do
86
+
87
+ it 'returns the descendants if struct?' do
95
88
  defined = []
96
- subject.map.each { |obj|
89
+ subject.map.each do |obj|
97
90
  obj.expects(:get_nested_complex_types).with(soap_config, defined).returns([obj.name])
98
- }
91
+ end
99
92
  subject.stubs(:struct?).returns(true)
100
- subject.complex_type_descendants(soap_config, defined).should eq(subject.map.collect{|x| x.name } )
93
+ subject.complex_type_descendants(soap_config, defined).should eq(subject.map.map(&:name))
101
94
  end
102
-
103
- end
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
95
+ end
96
+
97
+ describe '#get_nested_complex_types' do
98
+ let(:complex_class) { 'ProjectType' }
99
+ let(:ancestors) { ['something'] }
100
+ let(:complex_type_hash) { { class: complex_class, obj: subject, ancestors: ancestors } }
101
+ let(:expected) { [complex_type_hash] }
102
+
103
+ it 'returns the complex class ancestors' do
114
104
  defined = []
115
- subject.expects(:get_complex_class_name).with(defined).returns(complex_class)
105
+ subject.expects(:find_complex_class_name).with(defined).returns(complex_class)
116
106
  subject.expects(:fix_descendant_wash_out_type).with(soap_config, complex_class).returns(true)
117
107
  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)
108
+ subject.expects(:complex_type_hash).with(complex_class, subject, ancestors).returns(complex_type_hash)
119
109
  subject.expects(:complex_type_descendants).with(soap_config, [complex_type_hash]).returns(expected)
120
110
  subject.get_nested_complex_types(soap_config, defined).should eq(expected)
121
111
  end
122
-
123
- it "returns the the descendants" do
112
+
113
+ it 'returns the the descendants' do
124
114
  defined = nil
125
- subject.expects(:get_complex_class_name).with([]).returns(nil)
115
+ subject.expects(:find_complex_class_name).with([]).returns(nil)
126
116
  subject.expects(:fix_descendant_wash_out_type).with(soap_config, nil).returns(true)
127
117
  subject.expects(:complex_type_descendants).with(soap_config, []).returns(expected)
128
118
  subject.get_nested_complex_types(soap_config, defined).should eq(expected)
129
119
  end
130
-
131
120
  end
132
-
133
-
121
+
134
122
  describe '#ancestor_structure' do
135
- let(:ancestor_class) {ProjectType}
123
+ let(:ancestor_class) { ProjectType }
136
124
  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 })
125
+
126
+ it 'returns the ancestor structure' do
127
+ subject.ancestor_structure(ancestors).should eq(ancestors[0].to_s.downcase => ancestors[0].wash_out_param_map)
141
128
  end
142
-
143
129
  end
144
-
145
-
130
+
146
131
  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 })
132
+ let(:complex_class) { 'ProjectType' }
133
+ let(:ancestors) { ['something'] }
134
+
135
+ it 'returns the complex_type_hash' do
136
+ subject.complex_type_hash(complex_class, subject, ancestors).should eq('class' => complex_class, :obj => subject, :ancestors => ancestors)
153
137
  end
154
-
155
138
  end
156
-
157
-
139
+
158
140
  describe '#get_class_ancestors' do
159
- let(:class_name) {"ProjectType" }
141
+ let(:class_name) { 'ProjectType' }
160
142
  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
143
+ let(:ancestors) { ['SomeInexistentClass'] }
144
+ let(:ancestor_structure) { { ancestors[0].to_s.downcase => 'bla' } }
145
+ let(:top_ancestors) {}
146
+ let(:complex_type_hash) { { class: class_name, obj: subject, ancestors: ancestors } }
147
+
148
+ it 'returns nil if no ancestors' do
167
149
  subject.expects(:get_ancestors).with(class_name).returns(nil)
168
150
  subject.get_class_ancestors(soap_config, class_name, defined).should eq(nil)
169
151
  end
170
-
171
- it "returns the ancestors and the top ones" do
172
- skip "recursion problem"
152
+
153
+ it 'returns the ancestors and the top ones' do
154
+ skip 'recursion problem'
173
155
  subject.expects(:get_ancestors).with(class_name).returns(ancestors)
174
156
  subject.expects(:ancestor_structure).with(ancestors).returns(ancestor_structure)
175
157
  WashOut::Param.stubs(:parse_def).returns([namespaced_object])
@@ -177,15 +159,13 @@ describe WashoutBuilder::Document::ComplexType do
177
159
  subject.expects(:complex_type_hash).returns(complex_type_hash)
178
160
  subject.get_class_ancestors(soap_config, class_name, defined).should eq([complex_type_hash])
179
161
  end
180
-
181
- it "returns nil if same structure as ancestor" do
162
+
163
+ it 'returns nil if same structure as ancestor' do
182
164
  subject.expects(:get_ancestors).with(class_name).returns(ancestors)
183
165
  subject.expects(:ancestor_structure).with(ancestors).returns(ancestor_structure)
184
166
  WashOut::Param.stubs(:parse_def).returns([namespaced_object])
185
167
  subject.expects(:same_structure_as_ancestor?).with(namespaced_object).returns(true)
186
168
  subject.get_class_ancestors(soap_config, class_name, defined).should eq(nil)
187
169
  end
188
-
189
170
  end
190
-
191
- end
171
+ end