washout_builder 0.14.1 → 0.15.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 +4 -4
- data/.gitignore +1 -2
- data/.rubocop.yml +68 -0
- data/.travis.yml +1 -1
- data/Appraisals +9 -1
- data/Gemfile +2 -3
- data/Rakefile +17 -20
- data/app/controllers/washout_builder/washout_builder_controller.rb +79 -79
- data/app/helpers/washout_builder_complex_type_helper.rb +16 -23
- data/app/helpers/washout_builder_fault_type_helper.rb +12 -13
- data/app/helpers/washout_builder_method_arguments_helper.rb +24 -26
- data/app/helpers/washout_builder_method_list_helper.rb +16 -11
- data/app/helpers/washout_builder_method_return_type_helper.rb +14 -12
- data/app/views/wash_with_html/doc.builder +2 -2
- data/bin/appraisal +16 -0
- data/bin/autospec +16 -0
- data/bin/bundler +16 -0
- data/bin/cdiff +16 -0
- data/bin/coderay +16 -0
- data/bin/colortab +16 -0
- data/bin/coveralls +16 -0
- data/bin/decolor +16 -0
- data/bin/erubis +16 -0
- data/bin/guard +16 -0
- data/bin/htmldiff +16 -0
- data/bin/ldiff +16 -0
- data/bin/listen +16 -0
- data/bin/nokogiri +16 -0
- data/bin/phare +16 -0
- data/bin/pry +16 -0
- data/bin/rackup +16 -0
- data/bin/rails +16 -0
- data/bin/rake +16 -0
- data/bin/restclient +16 -0
- data/bin/rspec +16 -0
- data/bin/rubocop +16 -0
- data/bin/ruby-parse +16 -0
- data/bin/ruby-rewrite +16 -0
- data/bin/sass +16 -0
- data/bin/sass-convert +16 -0
- data/bin/scss +16 -0
- data/bin/scss-lint +16 -0
- data/bin/term_display +16 -0
- data/bin/term_mandel +16 -0
- data/bin/thor +16 -0
- data/bin/uuid +16 -0
- data/config/routes.rb +3 -3
- data/init.rb +1 -1
- data/lib/washout_builder.rb +20 -29
- data/lib/washout_builder/document/complex_type.rb +70 -75
- data/lib/washout_builder/document/exception_model.rb +46 -51
- data/lib/washout_builder/document/generator.rb +56 -66
- data/lib/washout_builder/document/shared_complex_type.rb +2 -4
- data/lib/washout_builder/engine.rb +1 -2
- data/lib/washout_builder/soap.rb +6 -10
- data/lib/washout_builder/type.rb +9 -23
- data/lib/washout_builder/version.rb +5 -5
- data/spec/app/controllers/washout_builder_controller_spec.rb +26 -28
- data/spec/app/helpers/washout_builder_complex_type_helper_spec.rb +37 -45
- data/spec/app/helpers/washout_builder_fault_type_helper_spec.rb +65 -77
- data/spec/app/helpers/washout_builder_method_arguments_helper_spec.rb +65 -76
- data/spec/app/helpers/washout_builder_method_list_helper_spec.rb +30 -35
- data/spec/app/helpers/washout_builder_method_return_type_helper_spec.rb +25 -27
- data/spec/dummy/config/application.rb +4 -4
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/environments/development.rb +2 -3
- data/spec/dummy/config/environments/test.rb +3 -3
- data/spec/dummy/config/initializers/secret_token.rb +1 -1
- data/spec/dummy/config/initializers/session_store.rb +1 -1
- data/spec/dummy/config/routes.rb +0 -1
- data/spec/dummy/script/rails +2 -2
- data/spec/integration/washout_builder_all_services_spec.rb +2 -5
- data/spec/integration/washout_builder_service_spec.rb +2 -5
- data/spec/lib/washout_builder/document/complex_type_spec.rb +98 -118
- data/spec/lib/washout_builder/document/exception_model_spec.rb +49 -54
- data/spec/lib/washout_builder/document/generator_spec.rb +93 -118
- data/spec/lib/washout_builder/type_spec.rb +17 -29
- data/spec/lib/washout_builder_spec.rb +293 -308
- data/spec/spec_helper.rb +24 -30
- data/spec/support/complex_types/fluffy.rb +3 -3
- data/spec/support/complex_types/fluffy_container.rb +3 -3
- data/spec/support/complex_types/project_type.rb +4 -5
- data/spec/support/complex_types/test_type.rb +4 -4
- data/washout_builder.gemspec +5 -2
- metadata +78 -3
@@ -1,86 +1,81 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative './shared_complex_type'
|
2
2
|
module WashoutBuilder
|
3
3
|
module Document
|
4
4
|
module ExceptionModel
|
5
5
|
extend ActiveSupport::Concern
|
6
|
-
include WashoutBuilder::Document::SharedComplexType
|
7
|
-
|
6
|
+
include WashoutBuilder::Document::SharedComplexType
|
7
|
+
|
8
8
|
def self.included(base)
|
9
9
|
base.send :include, WashoutBuilder::Document::SharedComplexType
|
10
10
|
end
|
11
|
-
|
12
|
-
def get_fault_class_ancestors(
|
11
|
+
|
12
|
+
def get_fault_class_ancestors(defined, _debug = false)
|
13
13
|
bool_the_same = false
|
14
|
-
ancestors
|
15
|
-
if
|
16
|
-
defined << fault_ancestor_hash(
|
14
|
+
ancestors = fault_ancestors
|
15
|
+
if ancestors.blank?
|
16
|
+
defined << fault_ancestor_hash(find_fault_model_structure, [])
|
17
17
|
else
|
18
18
|
defined << fault_ancestor_hash(fault_without_inheritable_elements(ancestors), ancestors)
|
19
|
-
ancestors[0].get_fault_class_ancestors(
|
19
|
+
ancestors[0].get_fault_class_ancestors(defined)
|
20
20
|
end
|
21
|
-
ancestors unless
|
21
|
+
ancestors unless bool_the_same
|
22
22
|
end
|
23
|
-
|
24
|
-
|
23
|
+
|
25
24
|
def fault_without_inheritable_elements(ancestors)
|
26
|
-
remove_fault_type_inheritable_elements(
|
25
|
+
remove_fault_type_inheritable_elements(ancestors[0].find_fault_model_structure.keys)
|
27
26
|
end
|
28
|
-
|
27
|
+
|
29
28
|
def fault_ancestors
|
30
|
-
get_complex_type_ancestors(self, [
|
29
|
+
get_complex_type_ancestors(self, ['ActiveRecord::Base', 'Object', 'BasicObject', 'Exception'])
|
31
30
|
end
|
32
|
-
|
33
|
-
def fault_ancestor_hash(
|
34
|
-
{:
|
31
|
+
|
32
|
+
def fault_ancestor_hash(structure, ancestors)
|
33
|
+
{ fault: self, structure: structure, ancestors: ancestors }
|
35
34
|
end
|
36
|
-
|
37
|
-
def remove_fault_type_inheritable_elements(
|
38
|
-
|
35
|
+
|
36
|
+
def remove_fault_type_inheritable_elements(keys)
|
37
|
+
find_fault_model_structure.delete_if { |key, _value| keys.include?(key) }
|
39
38
|
end
|
40
|
-
|
39
|
+
|
41
40
|
def check_valid_fault_method?(method)
|
42
41
|
method != :== && method != :! &&
|
43
|
-
(
|
44
|
-
|
42
|
+
(instance_methods.include?(:"#{method}=") ||
|
43
|
+
instance_methods.include?(:"#{method}")
|
45
44
|
)
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
def get_fault_attributes
|
45
|
+
end
|
46
|
+
|
47
|
+
def find_fault_attributes
|
50
48
|
attrs = []
|
51
|
-
attrs =
|
52
|
-
|
49
|
+
attrs = instance_methods(nil).map do |method|
|
50
|
+
method.to_s if check_valid_fault_method?(method)
|
53
51
|
end
|
54
|
-
attrs = attrs.delete_if {|method|
|
55
|
-
attrs.concat(
|
52
|
+
attrs = attrs.delete_if { |method| method.end_with?('=') && attrs.include?(method.gsub('=', '')) }
|
53
|
+
attrs.concat(%w(message backtrace))
|
56
54
|
end
|
57
|
-
|
55
|
+
|
58
56
|
def get_fault_type_method(method_name)
|
59
57
|
case method_name.to_s.downcase
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
58
|
+
when 'code'
|
59
|
+
'integer'
|
60
|
+
when 'message', 'backtrace'
|
61
|
+
'string'
|
62
|
+
else
|
63
|
+
'string'
|
64
|
+
end
|
67
65
|
end
|
68
|
-
|
69
|
-
|
70
|
-
def get_fault_model_structure
|
66
|
+
|
67
|
+
def find_fault_model_structure
|
71
68
|
h = {}
|
72
|
-
|
73
|
-
method_name = method_name.to_s.end_with?(
|
69
|
+
find_fault_attributes.each do |method_name|
|
70
|
+
method_name = method_name.to_s.end_with?('=') ? method_name.to_s.gsub('=', '') : method_name
|
74
71
|
primitive_type = get_fault_type_method(method_name)
|
75
|
-
h["#{method_name}"]= {
|
76
|
-
:
|
77
|
-
:
|
72
|
+
h["#{method_name}"] = {
|
73
|
+
primitive: "#{primitive_type}",
|
74
|
+
member_type: nil
|
78
75
|
}
|
79
76
|
end
|
80
|
-
|
77
|
+
h
|
81
78
|
end
|
82
|
-
|
83
|
-
|
84
79
|
end
|
85
80
|
end
|
86
81
|
end
|
@@ -1,67 +1,61 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative './exception_model'
|
2
2
|
module WashoutBuilder
|
3
3
|
module Document
|
4
4
|
class Generator
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
attr_reader *@attrs
|
9
|
-
attr_accessor *@attrs
|
10
|
-
|
5
|
+
attr_accessor :soap_actions, :config, :controller_name
|
6
|
+
|
11
7
|
def initialize(controller)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
controller_class_name = controller_class(controller)
|
9
|
+
self.config = controller_class_name.soap_config
|
10
|
+
self.soap_actions = controller_class_name.soap_actions
|
11
|
+
self.controller_name = controller
|
16
12
|
end
|
17
|
-
|
13
|
+
|
18
14
|
def namespace
|
19
15
|
config.respond_to?(:namespace) ? config.namespace : nil
|
20
16
|
end
|
21
|
-
|
17
|
+
|
22
18
|
def controller_class(controller)
|
23
19
|
"#{controller}_controller".camelize.constantize
|
24
20
|
end
|
25
|
-
|
26
|
-
def endpoint
|
27
|
-
namespace.blank? ? nil : namespace.gsub(
|
21
|
+
|
22
|
+
def endpoint
|
23
|
+
namespace.blank? ? nil : namespace.gsub('/wsdl', '/action')
|
28
24
|
end
|
29
|
-
|
30
|
-
def service
|
25
|
+
|
26
|
+
def service
|
31
27
|
controller_name.blank? ? nil : controller_name.camelize
|
32
28
|
end
|
33
|
-
|
29
|
+
|
34
30
|
def service_description
|
35
31
|
config.respond_to?(:description) ? config.description : nil
|
36
32
|
end
|
37
|
-
|
33
|
+
|
38
34
|
def operations
|
39
|
-
soap_actions.map { |operation,
|
35
|
+
soap_actions.map { |operation, _formats| operation }
|
40
36
|
end
|
41
|
-
|
37
|
+
|
42
38
|
def sorted_operations
|
43
|
-
|
39
|
+
soap_actions.sort_by { |operation, _formats| operation.downcase }.uniq unless soap_actions.blank?
|
44
40
|
end
|
45
|
-
|
41
|
+
|
46
42
|
def operation_exceptions(operation_name)
|
47
|
-
hash_object = soap_actions.
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
43
|
+
hash_object = soap_actions.find { |operation, _formats| operation.to_s.downcase == operation_name.to_s.downcase }
|
44
|
+
return if hash_object.blank?
|
45
|
+
faults = hash_object[1][:raises]
|
46
|
+
faults = faults.is_a?(Array) ? faults : [faults]
|
47
|
+
faults.select { |x| WashoutBuilder::Type.valid_fault_class?(x) }
|
53
48
|
end
|
54
|
-
|
49
|
+
|
55
50
|
def sort_complex_types(types, type)
|
56
|
-
types.sort_by { |hash| hash[type.to_sym].to_s.downcase }.uniq {|hash| hash[type.to_sym] } unless types.blank?
|
51
|
+
types.sort_by { |hash| hash[type.to_sym].to_s.downcase }.uniq { |hash| hash[type.to_sym] } unless types.blank?
|
57
52
|
end
|
58
|
-
|
59
|
-
|
53
|
+
|
60
54
|
def argument_types(type)
|
61
|
-
format_type = (type ==
|
55
|
+
format_type = (type == 'input') ? 'builder_in' : 'builder_out'
|
62
56
|
types = []
|
63
57
|
unless soap_actions.blank?
|
64
|
-
soap_actions.each do |
|
58
|
+
soap_actions.each do |_operation, formats|
|
65
59
|
(formats[format_type.to_sym]).each do |p|
|
66
60
|
types << p
|
67
61
|
end
|
@@ -69,56 +63,52 @@ module WashoutBuilder
|
|
69
63
|
end
|
70
64
|
types
|
71
65
|
end
|
72
|
-
|
66
|
+
|
73
67
|
def input_types
|
74
|
-
argument_types(
|
68
|
+
argument_types('input')
|
75
69
|
end
|
76
|
-
|
70
|
+
|
77
71
|
def output_types
|
78
|
-
argument_types(
|
72
|
+
argument_types('output')
|
79
73
|
end
|
80
|
-
|
81
|
-
def
|
82
|
-
operations.map(&:to_s).sort_by
|
74
|
+
|
75
|
+
def all_soap_action_names
|
76
|
+
operations.map(&:to_s).sort_by(&:downcase).uniq unless soap_actions.blank?
|
83
77
|
end
|
84
|
-
|
85
|
-
|
78
|
+
|
86
79
|
def complex_types
|
87
80
|
defined = []
|
88
81
|
(input_types + output_types).each do |p|
|
89
|
-
defined.concat(p.get_nested_complex_types(config,
|
82
|
+
defined.concat(p.get_nested_complex_types(config, defined))
|
90
83
|
end
|
91
|
-
defined =
|
84
|
+
defined = sort_complex_types(defined, 'class')
|
92
85
|
end
|
93
|
-
|
94
|
-
|
86
|
+
|
95
87
|
def actions_with_exceptions
|
96
|
-
soap_actions.select{|
|
88
|
+
soap_actions.select { |_operation, formats| !formats[:raises].blank? }
|
97
89
|
end
|
98
|
-
|
90
|
+
|
99
91
|
def exceptions_raised
|
100
|
-
actions_with_exceptions.
|
92
|
+
actions_with_exceptions.map { |_operation, formats| formats[:raises].is_a?(Array) ? formats[:raises] : [formats[:raises]] }.flatten
|
101
93
|
end
|
102
|
-
|
103
|
-
|
94
|
+
|
104
95
|
def filter_exceptions_raised
|
105
|
-
exceptions_raised.select { |x|
|
96
|
+
exceptions_raised.select { |x| WashoutBuilder::Type.valid_fault_class?(x) } unless actions_with_exceptions.blank?
|
106
97
|
end
|
107
|
-
|
98
|
+
|
108
99
|
def get_complex_fault_types(base_fault_array)
|
109
|
-
fault_types =[]
|
110
|
-
defined
|
111
|
-
defined = defined.blank? ?
|
112
|
-
defined.each{ |exception_class|
|
113
|
-
fault_types
|
100
|
+
fault_types = []
|
101
|
+
defined = filter_exceptions_raised
|
102
|
+
defined = defined.blank? ? base_fault_array : defined.concat(base_fault_array)
|
103
|
+
defined.each { |exception_class| exception_class.get_fault_class_ancestors(fault_types, true) } unless defined.blank?
|
104
|
+
fault_types
|
114
105
|
end
|
115
|
-
|
106
|
+
|
116
107
|
def fault_types
|
117
|
-
|
108
|
+
base_fault = [WashoutBuilder::Type.all_fault_classes.first]
|
118
109
|
fault_types = get_complex_fault_types(base_fault)
|
119
|
-
sort_complex_types(fault_types,
|
110
|
+
sort_complex_types(fault_types, 'fault')
|
120
111
|
end
|
121
|
-
|
122
112
|
end
|
123
113
|
end
|
124
|
-
end
|
114
|
+
end
|
@@ -1,11 +1,9 @@
|
|
1
1
|
module WashoutBuilder
|
2
2
|
module Document
|
3
3
|
module SharedComplexType
|
4
|
-
|
5
4
|
def get_complex_type_ancestors(class_name, array)
|
6
|
-
(class_name.ancestors - class_name.included_modules).delete_if{ |x| x.to_s.downcase == class_name.to_s.downcase
|
5
|
+
(class_name.ancestors - class_name.included_modules).delete_if { |x| x.to_s.downcase == class_name.to_s.downcase || array.include?(x.to_s) }
|
7
6
|
end
|
8
|
-
|
9
7
|
end
|
10
8
|
end
|
11
|
-
end
|
9
|
+
end
|
data/lib/washout_builder/soap.rb
CHANGED
@@ -5,8 +5,7 @@ module WashoutBuilder
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
include WashOut::SOAP if defined?(WashOut::SOAP)
|
7
7
|
include WashOut::Rails::Controller if defined?(WashOut::Rails::Controller)
|
8
|
-
|
9
|
-
|
8
|
+
|
10
9
|
module ClassMethods
|
11
10
|
attr_accessor :soap_actions
|
12
11
|
# Define a SOAP action +action+. The function has two required +options+:
|
@@ -15,9 +14,9 @@ module WashoutBuilder
|
|
15
14
|
#
|
16
15
|
# An optional option :to can be passed to allow for names of SOAP actions
|
17
16
|
# which are not valid Ruby function names.
|
18
|
-
def soap_action(action, options={})
|
17
|
+
def soap_action(action, options = {})
|
19
18
|
original_soap_action(action, options)
|
20
|
-
|
19
|
+
|
21
20
|
if action.is_a?(Symbol)
|
22
21
|
if soap_config.camelize_wsdl.to_s == 'lower'
|
23
22
|
action = action.to_s.camelize(:lower)
|
@@ -25,19 +24,16 @@ module WashoutBuilder
|
|
25
24
|
action = action.to_s.camelize
|
26
25
|
end
|
27
26
|
end
|
28
|
-
|
29
|
-
|
30
|
-
current_action = self.soap_actions[action]
|
27
|
+
|
28
|
+
current_action = soap_actions[action]
|
31
29
|
current_action[:builder_in] = WashOut::Param.parse_builder_def(soap_config, options[:args])
|
32
30
|
current_action[:builder_out] = WashOut::Param.parse_builder_def(soap_config, options[:return])
|
33
|
-
|
34
31
|
end
|
35
32
|
end
|
36
|
-
|
37
33
|
|
38
34
|
included do
|
39
35
|
include WashOut::Configurable if defined?(WashOut::Configurable)
|
40
|
-
include
|
36
|
+
include WashOut::Dispatcher if defined?(WashOut::Dispatcher)
|
41
37
|
self.soap_actions = {}
|
42
38
|
end
|
43
39
|
end
|
data/lib/washout_builder/type.rb
CHANGED
@@ -1,35 +1,21 @@
|
|
1
1
|
module WashoutBuilder
|
2
|
-
class Type
|
2
|
+
class Type
|
3
|
+
BASIC_TYPES = %w(string integer double boolean date datetime float time int)
|
3
4
|
|
4
|
-
|
5
|
-
"string",
|
6
|
-
"integer",
|
7
|
-
"double",
|
8
|
-
"boolean",
|
9
|
-
"date",
|
10
|
-
"datetime",
|
11
|
-
"float",
|
12
|
-
"time",
|
13
|
-
"int"
|
14
|
-
]
|
15
|
-
|
16
|
-
def self.get_fault_classes
|
5
|
+
def self.all_fault_classes
|
17
6
|
faults = []
|
18
7
|
faults << WashOut::SOAPError if defined?(WashOut::SOAPError)
|
19
8
|
faults << WashOut::Dispatcher::SOAPError if defined?(WashOut::Dispatcher::SOAPError)
|
20
9
|
faults << SOAPError if defined?(SOAPError)
|
21
|
-
|
10
|
+
faults
|
22
11
|
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
fault_class.ancestors.detect{ |fault| get_fault_classes.include?(fault) }.present?
|
12
|
+
|
13
|
+
def self.ancestor_fault?(fault_class)
|
14
|
+
fault_class.ancestors.find { |fault| all_fault_classes.include?(fault) }.present?
|
27
15
|
end
|
28
|
-
|
16
|
+
|
29
17
|
def self.valid_fault_class?(fault)
|
30
|
-
fault.is_a?(Class) &&
|
18
|
+
fault.is_a?(Class) && (ancestor_fault?(fault) || all_fault_classes.include?(fault))
|
31
19
|
end
|
32
|
-
|
33
|
-
|
34
20
|
end
|
35
21
|
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
module WashoutBuilder
|
1
|
+
module WashoutBuilder # Returns the version of the currently loaded Rails as a <tt>Gem::Version</tt>
|
2
2
|
def self.gem_version
|
3
3
|
Gem::Version.new VERSION::STRING
|
4
4
|
end
|
5
5
|
|
6
6
|
module VERSION
|
7
7
|
MAJOR = 0
|
8
|
-
MINOR =
|
9
|
-
TINY
|
10
|
-
PRE
|
8
|
+
MINOR = 15
|
9
|
+
TINY = 0
|
10
|
+
PRE = nil
|
11
11
|
|
12
|
-
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(
|
12
|
+
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
|
13
13
|
end
|
14
14
|
end
|
@@ -1,50 +1,48 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
mock_controller do
|
3
|
-
soap_action 'dispatcher_method', :
|
4
|
-
|
3
|
+
soap_action 'dispatcher_method', args: nil, return: nil
|
4
|
+
|
5
5
|
def dispatcher_method
|
6
|
-
#nothing
|
6
|
+
# nothing
|
7
7
|
end
|
8
8
|
end
|
9
|
-
describe WashoutBuilder::WashoutBuilderController, :
|
9
|
+
describe WashoutBuilder::WashoutBuilderController, type: :controller do
|
10
10
|
routes { WashoutBuilder::Engine.routes }
|
11
|
-
|
12
|
-
let(:soap_config)
|
11
|
+
|
12
|
+
let(:soap_config) do
|
13
|
+
OpenStruct.new(
|
13
14
|
camelize_wsdl: false,
|
14
|
-
namespace:
|
15
|
-
)
|
16
|
-
|
17
|
-
|
18
|
-
let(:
|
19
|
-
|
20
|
-
|
15
|
+
namespace: '/api/wsdl'
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:washout_builder) { stub(root_url: "#{request.protocol}#{request.host_with_port}/") }
|
20
|
+
let(:route) { stub(defaults: { controller: 'api' }) }
|
21
|
+
let(:params) { { name: 'some_name' } }
|
22
|
+
|
21
23
|
before(:each) do
|
22
24
|
ApiController.stubs(:soap_config).returns(soap_config)
|
23
25
|
controller.stubs(:washout_builder).returns(washout_builder)
|
24
26
|
end
|
25
27
|
|
26
|
-
it
|
28
|
+
it 'gets the services' do
|
27
29
|
get :all
|
28
|
-
assigns(:services).should eq([{'service_name'=>
|
30
|
+
assigns(:services).should eq([{ 'service_name' => 'Api', 'namespace' => '/api/wsdl', 'endpoint' => '/api/action', 'documentation_url' => 'http://test.host/Api' }])
|
29
31
|
end
|
30
|
-
|
31
|
-
it
|
32
|
+
|
33
|
+
it 'renders the template' do
|
32
34
|
get :all
|
33
|
-
response.should render_template(
|
35
|
+
response.should render_template('wash_with_html/all_services')
|
34
36
|
end
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
controller.send(:controller_is_a_service?,"api").should_not eq nil
|
37
|
+
|
38
|
+
it 'checks it controller is a service' do
|
39
|
+
controller.send(:controller_is_a_service?, 'api').should_not eq nil
|
39
40
|
end
|
40
|
-
|
41
|
-
it
|
41
|
+
|
42
|
+
it 'render a service documentation' do
|
42
43
|
controller.expects(:controller_is_a_service?).with(params[:name]).returns(route)
|
43
44
|
WashoutBuilder::Document::Generator.expects(:new).with(route.defaults[:controller])
|
44
45
|
get :all, params
|
45
|
-
response.should render_template
|
46
|
+
response.should render_template 'wash_with_html/doc'
|
46
47
|
end
|
47
|
-
|
48
|
-
|
49
|
-
|
50
48
|
end
|