soaspec 0.0.57 → 0.0.58
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +5 -0
- data/ChangeLog +5 -0
- data/Rakefile +1 -0
- data/lib/soaspec/exchange.rb +24 -1
- data/lib/soaspec/exchange_handlers/soap_handler.rb +9 -3
- data/lib/soaspec/version.rb +1 -1
- data/soaspec.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83ae8790fbb996c10af64623bea6e7be9e6372b1
|
4
|
+
data.tar.gz: ff46acc85fb7aceae9079a033d659f93b3dd3798
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1e699420cd01b427c8259c8404ac3d53385d304e32767b4b20385fdde13d72ccad836055f0073712745e6a99aeb323faf5700118f0bd106fe23fdf904f4c7d7
|
7
|
+
data.tar.gz: d1eadfde7e77d7dc43dd3819fb73cfed1e2eced1d4ded41bcd16813115769fc82beebe2716901413896d416e8a2253d80b0b3e09e7240c0ce95ecaf824a02164
|
data/.gitlab-ci.yml
CHANGED
data/ChangeLog
CHANGED
data/Rakefile
CHANGED
@@ -27,6 +27,7 @@ CLOBBER.include 'logs/*'
|
|
27
27
|
|
28
28
|
desc 'Start virtual web service'
|
29
29
|
task :start_test_server do
|
30
|
+
mkdir_p 'logs'
|
30
31
|
ENV['test_server_pid'] = Process.spawn('ruby', 'exe/soaspec-virtual-server', err: %w[logs/test_server.log w]).to_s
|
31
32
|
sleep 1 # Wait a little for virtual server to start up
|
32
33
|
puts 'Running test server at pid ' + ENV['test_server_pid']
|
data/lib/soaspec/exchange.rb
CHANGED
@@ -7,6 +7,8 @@ class Exchange
|
|
7
7
|
attr_reader :api_class
|
8
8
|
# How many times to retry for a success
|
9
9
|
attr_accessor :retry_count
|
10
|
+
# Params used when making a request
|
11
|
+
attr_accessor :default_params
|
10
12
|
|
11
13
|
# Set retry for success variable to true so that request will be retried
|
12
14
|
# for retry_count until it's true
|
@@ -35,13 +37,24 @@ class Exchange
|
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
40
|
+
# Merge exchange initialized request params with ones set later on
|
41
|
+
def merge_request_body
|
42
|
+
if @override_parameters[:body]
|
43
|
+
@override_parameters[:body].merge!(default_params[:body])
|
44
|
+
@override_parameters
|
45
|
+
else
|
46
|
+
@override_parameters.merge(default_params[:body])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
38
50
|
# Make request to handler with parameters defined
|
39
51
|
# Will retry until success code reached if retry_for_success? is set
|
40
52
|
# @return [Response] Response from Api handler
|
41
53
|
def make_request
|
42
54
|
Soaspec::SpecLogger.add_to 'Example ' + @test_name
|
55
|
+
request_params = default_params ? merge_request_body : @override_parameters
|
43
56
|
retry_count.times do
|
44
|
-
response = @api_class.make_request(
|
57
|
+
response = @api_class.make_request(request_params)
|
45
58
|
return response unless retry_for_success?
|
46
59
|
return response if (200..299).cover? @api_class.status_code_for(response)
|
47
60
|
response
|
@@ -79,6 +92,8 @@ class Exchange
|
|
79
92
|
@response ||= make_request
|
80
93
|
end
|
81
94
|
|
95
|
+
alias call response
|
96
|
+
|
82
97
|
# Get status code from api class. This is http response for Web Api
|
83
98
|
# @return [Integer] Status code from api class
|
84
99
|
def status_code
|
@@ -103,4 +118,12 @@ class Exchange
|
|
103
118
|
@api_class.value_from_path(response, path.to_s)
|
104
119
|
end
|
105
120
|
|
121
|
+
# Set a parameter request in the request body.
|
122
|
+
# Can be used to build a request over several steps (e.g Cucumber)
|
123
|
+
# Will be used with FactoryBot
|
124
|
+
def []=(key, value)
|
125
|
+
self.default_params = { body: {} } unless default_params # Initialize as Hash if not set
|
126
|
+
default_params[:body][key] = value
|
127
|
+
end
|
128
|
+
|
106
129
|
end
|
@@ -86,10 +86,16 @@ module Soaspec
|
|
86
86
|
@client = Savon.client(merged_options)
|
87
87
|
end
|
88
88
|
|
89
|
+
# Used in making request via hash or in template via Erb
|
90
|
+
def request_body_params(request_parameters)
|
91
|
+
test_values = request_parameters[:body] ? request_parameters[:body] : request_parameters
|
92
|
+
test_values.transform_keys_to_symbols if Soaspec.always_use_keys?
|
93
|
+
end
|
94
|
+
|
89
95
|
# Used in together with Exchange request that passes such override parameters
|
90
|
-
|
91
|
-
|
92
|
-
test_values =
|
96
|
+
# @param [Hash] request_parameters Parameters used to overwrite defaults in request
|
97
|
+
def make_request(request_parameters)
|
98
|
+
test_values = request_body_params request_parameters
|
93
99
|
begin
|
94
100
|
if @request_option == :template
|
95
101
|
request_body = File.read('template/' + template_name + '.xml')
|
data/lib/soaspec/version.rb
CHANGED
data/soaspec.gemspec
CHANGED
@@ -23,6 +23,7 @@ the same configuration "
|
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
26
|
+
spec.add_development_dependency 'cucumber'
|
26
27
|
spec.add_development_dependency 'data_magic'
|
27
28
|
spec.add_development_dependency 'rake', '~> 12.0'
|
28
29
|
spec.add_development_dependency 'require_all'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soaspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.58
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamuelGarrattIQA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: cucumber
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: data_magic
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|