soaspec 0.0.43 → 0.0.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +6 -0
- data/Gemfile.lock +1 -1
- data/Rakefile +1 -1
- data/Todo.md +4 -3
- data/exe/soaspec-init +6 -10
- data/lib/soaspec/exchange.rb +16 -0
- data/lib/soaspec/exchange_handlers/exchange_handler.rb +9 -2
- data/lib/soaspec/exchange_handlers/soap_handler.rb +5 -2
- data/lib/soaspec/exe_helpers.rb +2 -2
- 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: f697fff509cf16e29c1e5aebb5a22aa76fa54a21
|
4
|
+
data.tar.gz: c625f8572cb5f6bda2dd71f241a9422a43407aba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a82d977adcc9b8b903ed5180d7de79f021562110fde80f8d2a729b6b423299788f4e4ae22e857237f39832fdce563a59a4772587dc28064fde4f9c2627ea0f6b
|
7
|
+
data.tar.gz: 73daca5174aec68f34f64b4101289d9ebb68a5fb753ce148ebfd56b527ae4860641525525d51b1d7e0c775cf7e9802ebcc4b4f121558de76f303b580366ba84f
|
data/ChangeLog
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
Version 0.0.44
|
2
|
+
* Enhancements
|
3
|
+
* Test Server log to logs/test_server.log
|
4
|
+
* Simplify ExchangeHandler storing and retrieving values (see soap/hash_spec.rb)
|
5
|
+
* Make setting SoapHandler operation and other params possible through object instantiation. Less code needed
|
6
|
+
|
1
7
|
Version 0.0.43
|
2
8
|
* Bug fix
|
3
9
|
* Remove Environment namespace from 'soaspec-generate'
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -33,6 +33,6 @@ CLOBBER.include 'logs/*'
|
|
33
33
|
|
34
34
|
desc 'Start virtual web service'
|
35
35
|
task :start_test_server do
|
36
|
-
ENV['test_server_pid'] = Process.spawn('ruby', 'spec/test_server.rb', err:
|
36
|
+
ENV['test_server_pid'] = Process.spawn('ruby', 'spec/test_server.rb', err: %w[logs/test_server.log w]).to_s
|
37
37
|
puts 'Running test server at pid ' + ENV['test_server_pid']
|
38
38
|
end
|
data/Todo.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
* SoapHandler - define
|
2
|
-
* exchange add fields to overide parameters to support cucumber steps. exchange[from_temp]
|
1
|
+
* SoapHandler - define exhange method for each SOAP operation
|
2
|
+
* exchange add fields to overide parameters to support cucumber steps. exchange[from_temp] =
|
3
|
+
* Demonstrate using Cucumber
|
3
4
|
* Give examples and convenience methods for building classes for each SOAP or REST operation
|
4
|
-
* Handle REST template (similar way to
|
5
|
+
* Handle REST template (similar way to SOAP)
|
5
6
|
* Potentially have in built use of 'vcr' and 'http_stub' gems
|
6
7
|
* Handle proxies to record traffic for MiddleWare testing
|
7
8
|
* Much more
|
data/exe/soaspec-init
CHANGED
@@ -44,29 +44,24 @@ require 'spec_helper'
|
|
44
44
|
|
45
45
|
Soaspec.strip_namespaces = true # This allows namespace not to be used. Be careful with this
|
46
46
|
|
47
|
-
hash_example = BLZService.new('Get Bank')
|
48
|
-
hash_example.operation = :get_bank
|
49
|
-
|
50
47
|
id = '70070010'
|
51
|
-
#
|
52
|
-
hash_example.default_hash = { blz: id }
|
53
|
-
|
48
|
+
# BLZService.new(template_name: 'soap_template') Use this instead of default_hash to use template approach
|
54
49
|
|
55
50
|
context 'Test Examples' do
|
56
|
-
context
|
51
|
+
context BLZService.new('Get Bank', operation: :get_bank, default_hash: { blz: id }) do
|
57
52
|
|
58
53
|
describe Exchange.new(:default) do
|
59
54
|
it { is_expected.to contain_value id }
|
60
55
|
it { is_expected.to include_in_body id }
|
61
56
|
it_behaves_like 'success scenario'
|
62
|
-
after(:all) {
|
57
|
+
after(:all) { described_class.store(:title, 'bezeichnung') }
|
63
58
|
end
|
64
59
|
|
65
60
|
describe Exchange.new(:xpath_eg, blz: 100000) do
|
66
61
|
its(['plz']) { is_expected.to eq '100000' }
|
67
62
|
it { is_expected.to have_xpath_value '//ns1:bezeichnung' => 'Deutsche Bank' }
|
68
63
|
context 'Handle retrieving stored value' do
|
69
|
-
it { is_expected.to have_xpath_value 'bezeichnung' =>
|
64
|
+
it { is_expected.to have_xpath_value 'bezeichnung' => described_class.retrieve(:title) }
|
70
65
|
end
|
71
66
|
end
|
72
67
|
|
@@ -224,7 +219,7 @@ test_wsdl_content = <<EOF
|
|
224
219
|
EOF
|
225
220
|
|
226
221
|
create_file(filename: 'Gemfile', content: gem_content)
|
227
|
-
create_file(filename: 'Rakefile', content:
|
222
|
+
create_file(filename: 'Rakefile', content: rake_virtual_content)
|
228
223
|
create_file(filename: 'README.md', content: readme_content)
|
229
224
|
create_folder 'lib'
|
230
225
|
create_file(filename: 'lib/blz_service.rb', content: weather_web_service)
|
@@ -244,3 +239,4 @@ create_folder 'logs'
|
|
244
239
|
|
245
240
|
puts "Run 'bundle install' to install necessary gems"
|
246
241
|
puts "Run 'rake spec' to run the tests"
|
242
|
+
puts "Note: Setup runs Sinatra for Test Service on port 4567 by default. Change Rakefile 'start_test_server' task to update this"
|
data/lib/soaspec/exchange.rb
CHANGED
@@ -42,6 +42,22 @@ class Exchange
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
# Stores a value in the api handler that can be accessed by the provided name
|
46
|
+
# @param [Symbol] name Name of method to use to access this value within handler
|
47
|
+
# @param [String] value Path to value to store
|
48
|
+
def store(name, value)
|
49
|
+
@api_class.store(name, self[value])
|
50
|
+
end
|
51
|
+
|
52
|
+
# Retrieve the stored value from the Api Handler
|
53
|
+
# @param [String, Symbol] name Name of value to retrieve
|
54
|
+
# @return [Object] value from the Api Handler stored previously
|
55
|
+
def retrieve(name)
|
56
|
+
method = '__stored_val__' + name.to_s
|
57
|
+
raise ArgumentError('Value not stored at ') unless api_class.respond_to? method
|
58
|
+
@api_class.send(method)
|
59
|
+
end
|
60
|
+
|
45
61
|
# Name describing this class when used with `RSpec.describe`
|
46
62
|
# This will make the request and store the response
|
47
63
|
# @return [String] Name given when initializing
|
@@ -10,7 +10,7 @@ module Soaspec
|
|
10
10
|
# Set instance variable name
|
11
11
|
# @param [String, Symbol] name Name used when describing API test
|
12
12
|
# @param [Hash] options Parameters defining handler. Used in descendants
|
13
|
-
def initialize(name, options)
|
13
|
+
def initialize(name, options = {})
|
14
14
|
use
|
15
15
|
@name = name
|
16
16
|
end
|
@@ -61,10 +61,17 @@ module Soaspec
|
|
61
61
|
# @param [Symbol] name Name of method to use to access this value within handler
|
62
62
|
# @param [String] value Value to store
|
63
63
|
def store(name, value)
|
64
|
-
define_singleton_method(name.to_s) do
|
64
|
+
define_singleton_method('__stored_val__' + name.to_s) do
|
65
65
|
value
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
# Set instance variable and remove it from Hash
|
70
|
+
def set_remove_key(hash, key)
|
71
|
+
return unless hash.key? key
|
72
|
+
__send__("#{key}=", hash[key])
|
73
|
+
hash.delete key
|
74
|
+
end
|
75
|
+
|
69
76
|
end
|
70
77
|
end
|
@@ -71,12 +71,15 @@ module Soaspec
|
|
71
71
|
# Setup object to handle communicating with a particular SOAP WSDL
|
72
72
|
# @param [Hash] specific_options Options defining SOAP request. WSDL, authentication, see http://savonrb.com/version2/globals.html for list of options
|
73
73
|
def initialize(name, specific_options = {})
|
74
|
+
@default_hash = {}
|
75
|
+
@request_option = :hash
|
76
|
+
set_remove_key(specific_options, :operation)
|
77
|
+
set_remove_key(specific_options, :default_hash)
|
78
|
+
set_remove_key(specific_options, :template_name)
|
74
79
|
options = default_options.merge logging_options
|
75
80
|
options.merge! savon_options
|
76
81
|
options.merge!(specific_options)
|
77
82
|
@client = Savon.client(options)
|
78
|
-
@default_hash = {}
|
79
|
-
@request_option = :hash
|
80
83
|
super
|
81
84
|
end
|
82
85
|
|
data/lib/soaspec/exe_helpers.rb
CHANGED
@@ -51,7 +51,7 @@ task :default => :spec # This runs the 'spec' task by default when no task is me
|
|
51
51
|
RAKE
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
54
|
+
def rake_virtual_content
|
55
55
|
<<-EOF
|
56
56
|
# The list of task for a Rake file can be seen with `rake -T`
|
57
57
|
require 'rspec/core/rake_task' # See See https://relishapp.com/rspec/rspec-core/docs/command-line/rake-task for details
|
@@ -70,7 +70,7 @@ task :default => :spec # This runs the 'spec' task by default when no task is me
|
|
70
70
|
|
71
71
|
desc 'Start virtual web service'
|
72
72
|
task :start_test_server do
|
73
|
-
ENV['test_server_pid'] = Process.spawn('ruby', 'spec/test_server.rb'
|
73
|
+
ENV['test_server_pid'] = Process.spawn('ruby', 'spec/test_server.rb', err: %w[logs/test_server.log w]).to_s
|
74
74
|
puts 'Running test server at pid ' + ENV['test_server_pid']
|
75
75
|
end
|
76
76
|
|
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.44
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamuelGarrattIQA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|