soaspec 0.1.4 → 0.1.5

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: 33b4fef9deff557c6531eb1d12aac9071bbcc95e
4
- data.tar.gz: c317a3e008dd94f7094eae9be7d6e133a1376c0b
3
+ metadata.gz: 4a5dcd5cdd343b6810ee2db2355f21e54f656d0c
4
+ data.tar.gz: 34e57ec477e54a15732b2c2b790450f2c27fc758
5
5
  SHA512:
6
- metadata.gz: 12f211b2ff81229e85b6bb6d4b70899067cf59c8f8d37a74d3d24feeaf4a9285b368af4e909bc3d250a5206de4a056d9872844357f97a7fc5470c9bcb3dd1457
7
- data.tar.gz: aa6269a25076f3f0132b879c88136e7d6becadf4871e3c66bbea9a5a5083f263b1d5e89e5f11bfcbba5cda0434e69465c8a5f907193090b90ad870b278bb2bb0
6
+ metadata.gz: a42cbc94cebdb981b04414e77ea422860776fbe78c85068e2168500164a2bb64609bec8a88e070e41a049148cad0faa78d94a323a892cc15e989617112441196
7
+ data.tar.gz: 6e90d5d6d7ef41900b2c1a1361ae6790a253521a0f3b298f8b4c35109a745410de4ac8fef3c48d25e6ec81b0325d543cd85ab1544bc07bb82600d5c1d9b2a6d8
data/ChangeLog CHANGED
@@ -1,7 +1,12 @@
1
+ Version 0.1.5
2
+ * Enhancements
3
+ * Package spec changes status after a post is made. Help to illustrate scenario where status changes
4
+ * Record last exchange made for debugging purposes in 'last_exchange'
5
+
1
6
  Version 0.1.4
2
7
  * Enhancements
3
8
  * create_file method create folders automatically if necessary
4
- * Package spec to help one learn testing for items in a list
9
+ * Package spec to help learn testing for items in a list
5
10
  * Added docs for soaspec-virtual-server
6
11
 
7
12
  Version 0.1.3
@@ -54,16 +54,12 @@ class SoaspecVirtualServer < Sinatra::Application
54
54
  '
55
55
  end
56
56
  get '/packages/:num/:id' do |num, id|
57
- result = case num
58
- when '1', '4', '10' then 'false' if id == '40'
59
- when '3', '11', '9' then 'false' if id == '74'
60
- when '8', '6', '8' then 'false' if id == '80'
61
- when '7', '5', '12' then 'false' if id == '64'
62
- else
63
- true
64
- end
65
- result ||= true
66
- JSON.generate(success: result, id: id)
57
+ JSON.generate(success: Soaspec::TestServer::IdManager.result_for(num, id), id: id)
58
+ end
59
+
60
+ post '/packages/developed' do
61
+ Soaspec::TestServer::IdManager.developed = request.body.include?('true')
62
+ Soaspec::TestServer::IdManager.developed.to_s
67
63
  end
68
64
 
69
65
  # Used for simple testing of posing
@@ -27,6 +27,7 @@ require 'soaspec/test_server/test_attribute'
27
27
  require 'soaspec/test_server/puppy_service'
28
28
  require 'soaspec/test_server/invoices'
29
29
  require 'soaspec/test_server/test_namespace'
30
+ require 'soaspec/test_server/id_manager'
30
31
  require 'soaspec/wsdl_generator'
31
32
 
32
33
  # Gem for handling SOAP and REST api tests
@@ -39,6 +40,8 @@ module Soaspec
39
40
  attr_writer :debug_oauth
40
41
  # Folder used to store templates for API calls
41
42
  attr_accessor :template_folder
43
+ # Stores last exchange
44
+ attr_accessor :last_exchange
42
45
 
43
46
  # Folder used to store credentials
44
47
  # Used in auth2_file command
@@ -148,6 +148,7 @@ class Exchange
148
148
  # response.body (body of response as Hash)
149
149
  # response.header (head of response as Hash)
150
150
  def response
151
+ Soaspec.last_exchange = self
151
152
  @response ||= make_request
152
153
  end
153
154
 
@@ -0,0 +1,32 @@
1
+ module Soaspec
2
+ module TestServer
3
+ # Handles returning ids dependent on a number of factors
4
+ # Made to demonstrate creating testing a list of ids
5
+ class IdManager
6
+ @developed = false
7
+ class << self
8
+
9
+ attr_accessor :developed
10
+
11
+ # @return Result depending on num, id and whether '@developed' is set
12
+ def result_for(num, id)
13
+ result = undeveloped_id(num, id) unless @developed
14
+ result || 'true'
15
+ end
16
+
17
+ # @return [String] true of false depending on num and id
18
+ def undeveloped_id(num, id)
19
+ case num
20
+ when '1', '4', '10' then 'false' if id == '40'
21
+ when '3', '11', '9' then 'false' if id == '74'
22
+ when '8', '6', '8' then 'false' if id == '80'
23
+ when '7', '5', '12' then 'false' if id == '64'
24
+ else
25
+ 'true'
26
+ end
27
+ end
28
+
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,3 +1,3 @@
1
1
  module Soaspec
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
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.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamuelGarrattIQA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-28 00:00:00.000000000 Z
11
+ date: 2018-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -359,6 +359,7 @@ files:
359
359
  - lib/soaspec/spec_logger.rb
360
360
  - lib/soaspec/test_server/bank.wsdl
361
361
  - lib/soaspec/test_server/get_bank.rb
362
+ - lib/soaspec/test_server/id_manager.rb
362
363
  - lib/soaspec/test_server/invoices.rb
363
364
  - lib/soaspec/test_server/namespace.xml
364
365
  - lib/soaspec/test_server/note.xml