soaspec 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31e59104f7fe53eab3382cd0e569c6372ceac6f2
4
- data.tar.gz: bd767b72d3ec217ac2d57416660e5fd848cf7b91
3
+ metadata.gz: c6d36ecf75fe66a1bf4dcfc6a8e2dfdd7e9eb074
4
+ data.tar.gz: 6ebbdbc38a6c0465c08b47ef42d7627171eda5ce
5
5
  SHA512:
6
- metadata.gz: 77813ae5339c6ad088f89896d5b67fd63e94b4c5d1c4a979632011dcce5a71c3d87d642d1e560196f65da22279ceac443d9e59a7fac436fabb5720af14cdb1aa
7
- data.tar.gz: 1ecd9df640c74a646ed9248f24889c2ae41e681fbcb420e154c4aed6344276c2b1acc4778e280bf086e2858e1978b8a4193e495243e3856f9dea9ba325b9d557
6
+ metadata.gz: 72df691e2a4ca57bbef566e8c2fc9b794f5d7b60964858bcce5a1c537ae06ae754b8a9cec33b186eedf045eea9ac32bd2e49e5c296a42bf5149d2746047fc7a7
7
+ data.tar.gz: 5a9a30d7cfbbd6b6e430f24310521f89e8cec2eed8d821b0fa50a2f979a3ec1aad50e70ce600f4128a0c294760e7a335135595bab98fc270c5ca770e382d13fe
data/ChangeLog CHANGED
@@ -1,6 +1,12 @@
1
+ Version 0.0.18 / 2018-1-25
2
+ * Fixes
3
+ * Updated 'soaspec-init' so that it works again.
4
+ * Enhancements
5
+ * Added example showing representing data for request in YAML
6
+
1
7
  Version 0.0.17 / 2018-1-25
2
8
  * Fixes
3
- * Updated hash search so that it handles Array"
9
+ * Updated hash search so that it handles Array
4
10
 
5
11
  Version 0.0.16 / 2018-1-23
6
12
  * Fixes
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ git_source(:gitlab) { |repo_name| "https://gitlab.com/samuel-garratt/soaspec" }
4
4
 
5
5
  # Specify your gem's dependencies in soaspec.gemspec
6
6
  gemspec
7
+ gem 'data_magic'
7
8
  gem 'rest-client'
8
9
  gem 'savon'
9
10
  gem 'require_all'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- soaspec (0.0.16)
4
+ soaspec (0.0.17)
5
5
  rest-client (>= 2.0)
6
6
  rspec (~> 3.0)
7
7
  rspec-its (>= 1.2.0)
@@ -15,9 +15,15 @@ GEM
15
15
  gyoku (>= 0.4.0)
16
16
  nokogiri
17
17
  builder (3.2.3)
18
+ concurrent-ruby (1.0.5)
19
+ data_magic (1.2)
20
+ faker (>= 1.1.2)
21
+ yml_reader (>= 0.6)
18
22
  diff-lcs (1.3)
19
23
  domain_name (0.5.20170404)
20
24
  unf (>= 0.0.5, < 1.0.0)
25
+ faker (1.8.5)
26
+ i18n (~> 0.9.1)
21
27
  ffi (1.9.18-x64-mingw32)
22
28
  gyoku (1.3.1)
23
29
  builder (>= 2.1.2)
@@ -26,6 +32,8 @@ GEM
26
32
  httpi (2.4.2)
27
33
  rack
28
34
  socksify
35
+ i18n (0.9.1)
36
+ concurrent-ruby (~> 1.0)
29
37
  mime-types (3.1)
30
38
  mime-types-data (~> 3.2015)
31
39
  mime-types-data (3.2016.0521)
@@ -83,6 +91,7 @@ GEM
83
91
  httpi (~> 2.0)
84
92
  nokogiri (>= 1.4.2)
85
93
  xml-simple (1.1.5)
94
+ yml_reader (0.7)
86
95
 
87
96
  PLATFORMS
88
97
  ruby
@@ -90,6 +99,7 @@ PLATFORMS
90
99
 
91
100
  DEPENDENCIES
92
101
  bundler (~> 1.16)
102
+ data_magic
93
103
  nokogiri
94
104
  rake (= 12.2.1)
95
105
  require_all
@@ -0,0 +1,3 @@
1
+ japan:
2
+ city_name: 'Tokyo'
3
+ country_name: 'Japan'
@@ -38,6 +38,8 @@ gem_content = <<-EOF
38
38
 
39
39
  source 'https://rubygems.org'
40
40
 
41
+ gem 'data_magic'
42
+ gem 'require_all'
41
43
  gem 'soaspec'
42
44
 
43
45
  EOF
@@ -61,6 +63,11 @@ EOF
61
63
  spec_helper_content = <<-EOF
62
64
 
63
65
  require 'soaspec'
66
+ require 'require_all'
67
+ require_all 'lib'
68
+ require 'data_magic'
69
+
70
+ include DataMagic # Used as example of loading data smartly. Use 'data_for' method to load yml data
64
71
 
65
72
  RSpec.configure do |config|
66
73
  # This will make backtrace much shorter by removing many lines from rspec failure message
@@ -71,21 +78,77 @@ end
71
78
 
72
79
  EOF
73
80
 
81
+ weather_web_service = <<-EOF
82
+
83
+ require 'soaspec'
84
+
85
+ # This class is not part of the gem. It's an example of a class you can make
86
+ # to describe your APIs. Usually this would exist in the 'lib' directory
87
+ # Common configuration for the Savon client should go here
88
+ class WeatherWebService < Soaspec::BasicSoapHandler
89
+ # Add to or override default Savon client options
90
+ def savon_options
91
+ {
92
+ wsdl: 'http://www.webservicex.com/globalweather.asmx?wsdl',
93
+ convert_request_keys_to: :camelcase
94
+ }
95
+ end
96
+
97
+ # Specifying that get_weather_result must be present in the SOAP response
98
+ def mandatory_elements
99
+ [:get_weather_result]
100
+ end
101
+
102
+ # Example of xpath value that must be true for all success scenarios
103
+ def mandatory_xpath_values
104
+ {
105
+ '//xmlns:GetWeatherResult' => 'Data Not Found'
106
+ }
107
+ end
108
+
109
+ # Example of setting an attribute on the root XML element
110
+ def root_attributes
111
+ {
112
+ 'Version' => '1'
113
+ }
114
+ end
115
+
116
+ end
117
+
118
+ EOF
119
+
74
120
  soap_spec_content = <<-EOF
121
+
75
122
  require 'spec_helper'
76
123
 
77
- soap_example = Soaspec::BasicSoapHandler.new('Courier post',
78
- wsdl: 'http://www.webservicex.com/globalweather.asmx?wsdl')
79
- soap_example.namespaces = { 'ns1' => 'http://www.webserviceX.NET' }
80
- soap_example.default_operation = :get_weather
81
- soap_example.template_name = 'soap_template'
124
+ soap_example = WeatherWebService.new('Get Weather')
125
+ soap_example.operation = :get_weather
126
+ soap_example.default_hash = { city_name: 'Sydney', country_name: 'Australia' }
127
+ # soap_example.template_name = 'soap_template' # Use this if you'd rather use template file and comment out previous line
128
+
129
+
130
+ context soap_example do
131
+ describe Exchange.new(:default) do
132
+ it { is_expected.to contain_value 'Data Not Found' }
133
+ it_behaves_like 'success scenario'
134
+ end
135
+
136
+ describe Exchange.new(:china, city_name: 'Shanghai', country_name: 'China') do
137
+ it_behaves_like 'success scenario'
138
+ context 'handle xpath' do
139
+ its(['//xmlns:GetWeatherResult']) { is_expected.to eq 'Data Not Found' }
140
+ its(['xmlns:GetWeatherResult']) { is_expected.to eq 'Data Not Found' }
141
+ it { is_expected.to have_element_at_xpath '//xmlns:GetWeatherResult' }
142
+ it { is_expected.to have_xpath_value '//xmlns:GetWeatherResult' => 'Data Not Found' }
143
+ end
144
+ end
145
+
146
+ describe Exchange.new(:japan, data_for(:japan)) do
147
+ it_behaves_like 'success scenario'
148
+ end
82
149
 
83
- RSpec.context soap_example do
84
- describe Exchange.new(:default) do
85
- it { is_expected.to contain 'Data Not Found' }
86
- it_behaves_like 'success scenario'
87
150
  end
88
- end
151
+
89
152
  EOF
90
153
 
91
154
  soap_template_content = <<-EOF
@@ -101,6 +164,13 @@ soap_template_content = <<-EOF
101
164
  </s12:Envelope>
102
165
  EOF
103
166
 
167
+ default_yaml_content = <<-EOF
168
+ japan:
169
+ city_name: 'Tokyo'
170
+ country_name: 'Japan'
171
+
172
+ EOF
173
+
104
174
  readme_content = <<-EOF
105
175
 
106
176
  # Prerequisites
@@ -141,9 +211,14 @@ EOF
141
211
  create_file(filename: 'Gemfile', content: gem_content)
142
212
  create_file(filename: 'Rakefile', content: rake_content)
143
213
  create_file(filename: 'README.md', content: readme_content)
214
+ create_folder 'lib'
215
+ create_file(filename: 'lib/weather_web_service.rb', content: weather_web_service)
216
+ create_folder 'config'
217
+ create_folder 'config/data'
218
+ create_file(filename: 'config/data/default.yml', content: default_yaml_content)
144
219
  create_folder 'spec'
145
- create_folder 'template'
146
- create_folder 'logs'
147
220
  create_file(filename: 'spec/spec_helper.rb', content: spec_helper_content)
148
221
  create_file(filename: 'spec/soap_spec.rb', content: soap_spec_content)
222
+ create_folder 'template'
149
223
  create_file(filename: 'template/soap_template.xml', content: soap_template_content)
224
+ create_folder 'logs'
@@ -1,3 +1,3 @@
1
1
  module Soaspec
2
- VERSION = '0.0.17'
2
+ VERSION = '0.0.18'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soaspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamuelGarrattIQA
@@ -144,6 +144,7 @@ files:
144
144
  - Rakefile
145
145
  - bin/console
146
146
  - bin/setup
147
+ - config/data/default.yml
147
148
  - exe/soaspec-init
148
149
  - exe/xml_to_yaml_file
149
150
  - lib/soaspec.rb