soaspec 0.0.64 → 0.0.65
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/ChangeLog +4 -0
- data/exe/soaspec-virtual-server +15 -18
- data/lib/soaspec/exchange.rb +15 -16
- data/lib/soaspec/test_server/puppy_service.rb +9 -0
- data/lib/soaspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b74599fe5d32dc78abe0ad63f1454c5173ac188
|
4
|
+
data.tar.gz: ab105cf905b37f63a6fc6a52c694e85d3577c621
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe214897a46aef14ffc950badadcd818927d5e6e38d427d29a7e3ce4d9ae0916d24f4262c3457d2d812ea3b198c7d2365ee174d498d31a457c485d0f54085bac
|
7
|
+
data.tar.gz: ec75d15728e9b97082d9039bf9ea14652671488652991b539c1d883f77061057acf9de25ef83b6cce0d8a7b944dd51c83937e7549bc73cb6c2b920e5ca4aa0be
|
data/ChangeLog
CHANGED
data/exe/soaspec-virtual-server
CHANGED
@@ -32,26 +32,23 @@ get '/as/token.oauth2' do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
# Used for testing storage of data
|
35
|
-
post '/test/
|
36
|
-
# puts request.body.string
|
35
|
+
post '/test/name' do
|
37
36
|
request_hash = JSON.parse(request.body.string)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
Soaspec::TestServer::PuppyService.data[uuid][:id] = request_hash['id']
|
43
|
-
# puts PuppyService.data
|
44
|
-
'Success'
|
37
|
+
id = Soaspec::TestServer::PuppyService.new_id
|
38
|
+
Soaspec::TestServer::PuppyService.data[id][:name] = request_hash['name']
|
39
|
+
response_hash = { result: { status: 'success', data: Soaspec::TestServer::PuppyService.data[id] } }
|
40
|
+
JSON.generate response_hash
|
45
41
|
end
|
46
42
|
|
47
43
|
# Used for testing retrieving storage of data
|
48
|
-
get '/test/
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
44
|
+
get '/test/name/:id' do |id|
|
45
|
+
result = Soaspec::TestServer::PuppyService.data[id.to_i]
|
46
|
+
JSON.generate result
|
47
|
+
end
|
48
|
+
|
49
|
+
patch '/test/name/:id' do |id|
|
50
|
+
request_hash = JSON.parse(request.body.string)
|
51
|
+
Soaspec::TestServer::PuppyService.data[id.to_i][:name] = request_hash['name']
|
52
|
+
response_hash = { result: { status: 'updated', with: request_hash['name'] } }
|
53
|
+
JSON.generate response_hash
|
57
54
|
end
|
data/lib/soaspec/exchange.rb
CHANGED
@@ -4,11 +4,9 @@ require_relative '../soaspec'
|
|
4
4
|
class Exchange
|
5
5
|
|
6
6
|
# Class of Api Handler for which this exchange is made
|
7
|
-
|
7
|
+
attr_accessor :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
|
12
10
|
# Name used for displaying class
|
13
11
|
attr_accessor :test_name
|
14
12
|
|
@@ -48,15 +46,16 @@ class Exchange
|
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
51
|
-
#
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
49
|
+
# Specify a url to add onto the base_url of the ExchangeHandler used
|
50
|
+
# @param [String] url Url to add onto the base_url of the ExchangeHandler used
|
51
|
+
def suburl=(url)
|
52
|
+
@override_parameters[:suburl] = url
|
53
|
+
end
|
54
|
+
|
55
|
+
# Specify HTTP method to use. Default is :post
|
56
|
+
# @param [Symbol] method HTTP method. E.g, :get, :patch
|
57
|
+
def method=(method)
|
58
|
+
@override_parameters[:method] = method
|
60
59
|
end
|
61
60
|
|
62
61
|
# Make request to handler with parameters defined
|
@@ -64,7 +63,7 @@ class Exchange
|
|
64
63
|
# @return [Response] Response from Api handler
|
65
64
|
def make_request
|
66
65
|
Soaspec::SpecLogger.add_to 'Example ' + test_name
|
67
|
-
request_params =
|
66
|
+
request_params = @override_parameters
|
68
67
|
retry_count.times do
|
69
68
|
response = @api_class.make_request(request_params)
|
70
69
|
return response unless retry_for_success?
|
@@ -142,8 +141,8 @@ class Exchange
|
|
142
141
|
# Can be used to build a request over several steps (e.g Cucumber)
|
143
142
|
# Will be used with FactoryBot
|
144
143
|
def []=(key, value)
|
145
|
-
|
146
|
-
|
144
|
+
@override_parameters[:body] ||= {}
|
145
|
+
@override_parameters[:body][key] = value
|
147
146
|
end
|
148
147
|
|
149
148
|
# Implement undefined setter with []= for FactoryBot to use without needing to define params to set
|
@@ -151,7 +150,7 @@ class Exchange
|
|
151
150
|
# @param [Object] args
|
152
151
|
# @param [Object] block
|
153
152
|
def method_missing(method_name, *args, &block)
|
154
|
-
if method_name[-1] == '='
|
153
|
+
if method_name[-1] == '=' # A setter method
|
155
154
|
if args.first.class < Exchange # This would be prerequisite exchange
|
156
155
|
define_singleton_method(method_name[0..-2]) do
|
157
156
|
args.first
|
@@ -2,8 +2,17 @@ module Soaspec
|
|
2
2
|
module TestServer
|
3
3
|
class PuppyService
|
4
4
|
@data = {}
|
5
|
+
@current_id = 1
|
5
6
|
class << self
|
6
7
|
attr_accessor :data
|
8
|
+
|
9
|
+
def new_id
|
10
|
+
@data[@current_id] = {}
|
11
|
+
@data[@current_id][:id] = @current_id
|
12
|
+
@current_id += 1
|
13
|
+
@current_id - 1
|
14
|
+
end
|
15
|
+
|
7
16
|
end
|
8
17
|
end
|
9
18
|
end
|
data/lib/soaspec/version.rb
CHANGED
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.65
|
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-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|