soaspec 0.2.23 → 0.2.24
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/.gitignore +15 -15
- data/.gitlab-ci.yml +33 -33
- data/.rspec +3 -3
- data/.rubocop.yml +2 -2
- data/CODE_OF_CONDUCT.md +74 -74
- data/ChangeLog +577 -573
- data/Gemfile +6 -6
- data/LICENSE.txt +21 -21
- data/README.md +230 -230
- data/Rakefile +42 -42
- data/Todo.md +15 -15
- data/exe/soaspec +123 -123
- data/exe/xml_to_yaml_file +42 -42
- data/lib/soaspec.rb +101 -101
- data/lib/soaspec/core_ext/hash.rb +35 -35
- data/lib/soaspec/cucumber/generic_steps.rb +85 -85
- data/lib/soaspec/demo.rb +4 -4
- data/lib/soaspec/exchange/exchange.rb +111 -111
- data/lib/soaspec/exchange/exchange_extractor.rb +83 -83
- data/lib/soaspec/exchange/exchange_properties.rb +26 -26
- data/lib/soaspec/exchange/exchange_repeater.rb +19 -19
- data/lib/soaspec/exchange/request_builder.rb +68 -68
- data/lib/soaspec/exchange/variable_storer.rb +22 -22
- data/lib/soaspec/exchange_handlers/exchange_handler.rb +126 -126
- data/lib/soaspec/exchange_handlers/handler_accessors.rb +130 -130
- data/lib/soaspec/exchange_handlers/response_extractor.rb +82 -82
- data/lib/soaspec/exchange_handlers/rest_exchanger_factory.rb +109 -109
- data/lib/soaspec/exchange_handlers/rest_handler.rb +259 -259
- data/lib/soaspec/exchange_handlers/rest_methods.rb +44 -44
- data/lib/soaspec/exchange_handlers/rest_parameters.rb +86 -86
- data/lib/soaspec/exchange_handlers/rest_parameters_defaults.rb +21 -21
- data/lib/soaspec/exchange_handlers/soap_handler.rb +235 -235
- data/lib/soaspec/exe_helpers.rb +92 -92
- data/lib/soaspec/generate_server.rb +37 -37
- data/lib/soaspec/generator/.rspec.erb +5 -5
- data/lib/soaspec/generator/.travis.yml.erb +5 -5
- data/lib/soaspec/generator/Gemfile.erb +8 -8
- data/lib/soaspec/generator/README.md.erb +29 -29
- data/lib/soaspec/generator/Rakefile.erb +19 -19
- data/lib/soaspec/generator/config/data/default.yml.erb +2 -2
- data/lib/soaspec/generator/css/bootstrap.css +6833 -6833
- data/lib/soaspec/generator/generate_exchange.html.erb +35 -35
- data/lib/soaspec/generator/lib/blz_service.rb.erb +26 -26
- data/lib/soaspec/generator/lib/dynamic_class_content.rb.erb +12 -12
- data/lib/soaspec/generator/lib/new_rest_service.rb.erb +51 -51
- data/lib/soaspec/generator/lib/new_soap_service.rb.erb +29 -29
- data/lib/soaspec/generator/lib/package_service.rb.erb +2 -2
- data/lib/soaspec/generator/lib/shared_example.rb.erb +8 -8
- data/lib/soaspec/generator/spec/dynamic_soap_spec.rb.erb +12 -12
- data/lib/soaspec/generator/spec/rest_spec.rb.erb +9 -9
- data/lib/soaspec/generator/spec/soap_spec.rb.erb +51 -51
- data/lib/soaspec/generator/spec/spec_helper.rb.erb +23 -23
- data/lib/soaspec/generator/template/soap_template.xml +6 -6
- data/lib/soaspec/indifferent_hash.rb +7 -7
- data/lib/soaspec/interpreter.rb +39 -39
- data/lib/soaspec/matchers.rb +114 -114
- data/lib/soaspec/not_found_errors.rb +13 -13
- data/lib/soaspec/o_auth2.rb +128 -128
- data/lib/soaspec/soaspec_shared_examples.rb +24 -24
- data/lib/soaspec/spec_logger.rb +121 -121
- data/lib/soaspec/template_reader.rb +28 -28
- data/lib/soaspec/test_server/bank.wsdl +90 -90
- data/lib/soaspec/test_server/get_bank.rb +164 -164
- data/lib/soaspec/test_server/id_manager.rb +39 -39
- data/lib/soaspec/test_server/invoices.rb +27 -27
- data/lib/soaspec/test_server/namespace.xml +14 -14
- data/lib/soaspec/test_server/note.xml +5 -5
- data/lib/soaspec/test_server/puppy_service.rb +19 -19
- data/lib/soaspec/test_server/test_attribute.rb +12 -12
- data/lib/soaspec/test_server/test_namespace.rb +12 -12
- data/lib/soaspec/version.rb +4 -3
- data/lib/soaspec/virtual_server.rb +174 -174
- data/lib/soaspec/wait.rb +41 -41
- data/lib/soaspec/wsdl_generator.rb +215 -215
- data/soaspec.gemspec +53 -53
- data/test.wsdl +116 -116
- data/test.xml +10 -10
- data/test_wsdl.rb +41 -41
- metadata +3 -4
@@ -1,36 +1,36 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<title>REST Exchange generator</title>
|
4
|
-
<link rel="stylesheet" href="css/bootstrap.css" type="text/css" charset="utf-8" />
|
5
|
-
</head>
|
6
|
-
<body>
|
7
|
-
<main class="container-fluid">
|
8
|
-
<h1>REST Exchange generator</h1>
|
9
|
-
<h2>Handler creator <small><%= GenerateServer.create_params['feedback'] %></small></h2>
|
10
|
-
<form class="form-horizontal" method="POST" action="/generate">
|
11
|
-
<div class="form-group">
|
12
|
-
<label class="col-sm-2 control-label" for="className">Class Name</label>
|
13
|
-
<div class="col-sm-10">
|
14
|
-
<input id="className" class="form-control" type="text" name="className"
|
15
|
-
placeholder="ApiUnderTest" value="<%= GenerateServer.create_params['className'] %>">
|
16
|
-
<p class="help-block">This is what you will refer to the API in your test code. Use Pascal Case</p>
|
17
|
-
</div>
|
18
|
-
</div>
|
19
|
-
<div class="form-group">
|
20
|
-
<label class="col-sm-2 control-label" for="baseUrl">Base URL</label>
|
21
|
-
<div class="col-sm-10">
|
22
|
-
<input id="baseUrl" class="form-control" type="text" name="baseUrl"
|
23
|
-
placeholder="https://url/which/api/starts_with" value="<%= GenerateServer.create_params['baseUrl'] %>">
|
24
|
-
<p class="help-block">Url with which all REST requests using this class will start with.
|
25
|
-
Exchanges creating using this class can append to this with the 'suburl' parameter.</p>
|
26
|
-
</div>
|
27
|
-
</div>
|
28
|
-
<div class="form-group">
|
29
|
-
<div class="col-sm-offset-2 col-sm-10">
|
30
|
-
<input type="submit" value="Generate handler" class="btn btn-primary">
|
31
|
-
</div>
|
32
|
-
</div>
|
33
|
-
</form>
|
34
|
-
</main>
|
35
|
-
</body>
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>REST Exchange generator</title>
|
4
|
+
<link rel="stylesheet" href="css/bootstrap.css" type="text/css" charset="utf-8" />
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<main class="container-fluid">
|
8
|
+
<h1>REST Exchange generator</h1>
|
9
|
+
<h2>Handler creator <small><%= GenerateServer.create_params['feedback'] %></small></h2>
|
10
|
+
<form class="form-horizontal" method="POST" action="/generate">
|
11
|
+
<div class="form-group">
|
12
|
+
<label class="col-sm-2 control-label" for="className">Class Name</label>
|
13
|
+
<div class="col-sm-10">
|
14
|
+
<input id="className" class="form-control" type="text" name="className"
|
15
|
+
placeholder="ApiUnderTest" value="<%= GenerateServer.create_params['className'] %>">
|
16
|
+
<p class="help-block">This is what you will refer to the API in your test code. Use Pascal Case</p>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<div class="form-group">
|
20
|
+
<label class="col-sm-2 control-label" for="baseUrl">Base URL</label>
|
21
|
+
<div class="col-sm-10">
|
22
|
+
<input id="baseUrl" class="form-control" type="text" name="baseUrl"
|
23
|
+
placeholder="https://url/which/api/starts_with" value="<%= GenerateServer.create_params['baseUrl'] %>">
|
24
|
+
<p class="help-block">Url with which all REST requests using this class will start with.
|
25
|
+
Exchanges creating using this class can append to this with the 'suburl' parameter.</p>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
<div class="form-group">
|
29
|
+
<div class="col-sm-offset-2 col-sm-10">
|
30
|
+
<input type="submit" value="Generate handler" class="btn btn-primary">
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</form>
|
34
|
+
</main>
|
35
|
+
</body>
|
36
36
|
</html>
|
@@ -1,26 +1,26 @@
|
|
1
|
-
|
2
|
-
require 'soaspec'
|
3
|
-
|
4
|
-
# This class is not part of the gem. It's an example of a class you can make
|
5
|
-
# to describe your APIs. Usually this would exist in the 'lib' directory
|
6
|
-
# Common configuration for the Savon client should go here
|
7
|
-
class BLZService < Soaspec::SoapHandler
|
8
|
-
# Add to or override default Savon client options
|
9
|
-
def savon_options
|
10
|
-
{
|
11
|
-
wsdl: 'http://localhost:4999/BLZService?wsdl'
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
strip_namespaces true # This allows namespace not to be used. Be careful with this
|
16
|
-
|
17
|
-
# # Specifying that get_weather_result must be present in the SOAP response
|
18
|
-
mandatory_elements [:plz]
|
19
|
-
|
20
|
-
# Example of xpath value that must be true for all success scenarios
|
21
|
-
mandatory_xpath_values 'ns1:bezeichnung' => 'Deutsche Bank'
|
22
|
-
|
23
|
-
# Example of setting an attribute on the root XML element
|
24
|
-
root_attributes 'Version' => '1'
|
25
|
-
|
26
|
-
end
|
1
|
+
|
2
|
+
require 'soaspec'
|
3
|
+
|
4
|
+
# This class is not part of the gem. It's an example of a class you can make
|
5
|
+
# to describe your APIs. Usually this would exist in the 'lib' directory
|
6
|
+
# Common configuration for the Savon client should go here
|
7
|
+
class BLZService < Soaspec::SoapHandler
|
8
|
+
# Add to or override default Savon client options
|
9
|
+
def savon_options
|
10
|
+
{
|
11
|
+
wsdl: 'http://localhost:4999/BLZService?wsdl'
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
strip_namespaces true # This allows namespace not to be used. Be careful with this
|
16
|
+
|
17
|
+
# # Specifying that get_weather_result must be present in the SOAP response
|
18
|
+
mandatory_elements [:plz]
|
19
|
+
|
20
|
+
# Example of xpath value that must be true for all success scenarios
|
21
|
+
mandatory_xpath_values 'ns1:bezeichnung' => 'Deutsche Bank'
|
22
|
+
|
23
|
+
# Example of setting an attribute on the root XML element
|
24
|
+
root_attributes 'Version' => '1'
|
25
|
+
|
26
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
|
2
|
-
require 'soaspec'
|
3
|
-
|
4
|
-
class <%= options[:name] %> < Soaspec::SoapHandler
|
5
|
-
# Add to or override default Savon client options
|
6
|
-
def savon_options
|
7
|
-
{
|
8
|
-
wsdl: '<%= options[:wsdl] %>'
|
9
|
-
}
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
1
|
+
|
2
|
+
require 'soaspec'
|
3
|
+
|
4
|
+
class <%= options[:name] %> < Soaspec::SoapHandler
|
5
|
+
# Add to or override default Savon client options
|
6
|
+
def savon_options
|
7
|
+
{
|
8
|
+
wsdl: '<%= options[:wsdl] %>'
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -1,52 +1,52 @@
|
|
1
|
-
# This class represent REST Api calls for the <%= @name %> API
|
2
|
-
class <%= @name %> < Soaspec::RestHandler
|
3
|
-
## Defining request
|
4
|
-
|
5
|
-
# All requests to <%= @name %> will start with this url <% if @base_url %>
|
6
|
-
base_url '<%= @base_url %>'
|
7
|
-
<% else %>
|
8
|
-
# TODO: Change this mandatory base_url to the url that all requests to this service start with
|
9
|
-
# base_url "https://my_host/api/<%= ENV['environment'] %>/api_name" # ERB can be used to make this dynamic based on environment
|
10
|
-
<% end %>
|
11
|
-
# Headers that will be sent by default using this Handler
|
12
|
-
# If symbol is used, they'll be converted to standard HTTP headers
|
13
|
-
# headers accept: 'application/json', content_type: 'application/json'
|
14
|
-
|
15
|
-
# Filename of oauth2 file to use for oauth2 parameters. 'Soaspec.credentials_folder' can be set to globally defined a folder with credentials
|
16
|
-
# This will add a default 'Authorization: Bearer access_token' header if 'Authorization' is not specified in headers
|
17
|
-
# The '.yml' extension will be added automatically if not present.
|
18
|
-
# oauth2_file 'filename.yml'
|
19
|
-
|
20
|
-
# Filename of YAML with basic auth parameters in it 'Soaspec.credentials_folder' can be set to globally defined a folder with credentials
|
21
|
-
# It is of the format
|
22
|
-
# user: 'username'
|
23
|
-
# password: 'password'
|
24
|
-
# basic_auth_file 'basic_auth.yml' # Load YAML file with basic auth credentials in it
|
25
|
-
|
26
|
-
### Request Body
|
27
|
-
|
28
|
-
# Filename of template to be used. This is within 'Soaspec.template_folder' folder
|
29
|
-
# template_name 'filename'
|
30
|
-
|
31
|
-
# Default hash to be used in request that will be converted to JSON. This can be overriden and added to by each Exchange using this class
|
32
|
-
# default_hash a: 1, b: 2
|
33
|
-
|
34
|
-
## Extracting response
|
35
|
-
|
36
|
-
# Use this to extract the value of either a JSON (JSONPath) or XML (Xpath) element. 'element_name' is the method that will be
|
37
|
-
# generated on an Exchange to obtain it
|
38
|
-
# element :element_name, 'element_path'
|
39
|
-
|
40
|
-
# Use this to extract an attribute from XML. If the name of the method and the attribute name are the same then only one parameter is
|
41
|
-
# needed
|
42
|
-
# attribute(:attribute_method_name, 'name_of_attribute')
|
43
|
-
|
44
|
-
## Creating verifications for success response
|
45
|
-
|
46
|
-
# Values that must have a certain value for 'success scenario' shared example
|
47
|
-
# mandatory_json_values '$..status' => 'available'
|
48
|
-
|
49
|
-
# Elements that must be in the response for 'success scenario' shared example
|
50
|
-
# Below will expect an element at the path 'tags' to be present
|
51
|
-
# mandatory_elements :tags
|
1
|
+
# This class represent REST Api calls for the <%= @name %> API
|
2
|
+
class <%= @name %> < Soaspec::RestHandler
|
3
|
+
## Defining request
|
4
|
+
|
5
|
+
# All requests to <%= @name %> will start with this url <% if @base_url %>
|
6
|
+
base_url '<%= @base_url %>'
|
7
|
+
<% else %>
|
8
|
+
# TODO: Change this mandatory base_url to the url that all requests to this service start with
|
9
|
+
# base_url "https://my_host/api/<%= ENV['environment'] %>/api_name" # ERB can be used to make this dynamic based on environment
|
10
|
+
<% end %>
|
11
|
+
# Headers that will be sent by default using this Handler
|
12
|
+
# If symbol is used, they'll be converted to standard HTTP headers
|
13
|
+
# headers accept: 'application/json', content_type: 'application/json'
|
14
|
+
|
15
|
+
# Filename of oauth2 file to use for oauth2 parameters. 'Soaspec.credentials_folder' can be set to globally defined a folder with credentials
|
16
|
+
# This will add a default 'Authorization: Bearer access_token' header if 'Authorization' is not specified in headers
|
17
|
+
# The '.yml' extension will be added automatically if not present.
|
18
|
+
# oauth2_file 'filename.yml'
|
19
|
+
|
20
|
+
# Filename of YAML with basic auth parameters in it 'Soaspec.credentials_folder' can be set to globally defined a folder with credentials
|
21
|
+
# It is of the format
|
22
|
+
# user: 'username'
|
23
|
+
# password: 'password'
|
24
|
+
# basic_auth_file 'basic_auth.yml' # Load YAML file with basic auth credentials in it
|
25
|
+
|
26
|
+
### Request Body
|
27
|
+
|
28
|
+
# Filename of template to be used. This is within 'Soaspec.template_folder' folder
|
29
|
+
# template_name 'filename'
|
30
|
+
|
31
|
+
# Default hash to be used in request that will be converted to JSON. This can be overriden and added to by each Exchange using this class
|
32
|
+
# default_hash a: 1, b: 2
|
33
|
+
|
34
|
+
## Extracting response
|
35
|
+
|
36
|
+
# Use this to extract the value of either a JSON (JSONPath) or XML (Xpath) element. 'element_name' is the method that will be
|
37
|
+
# generated on an Exchange to obtain it
|
38
|
+
# element :element_name, 'element_path'
|
39
|
+
|
40
|
+
# Use this to extract an attribute from XML. If the name of the method and the attribute name are the same then only one parameter is
|
41
|
+
# needed
|
42
|
+
# attribute(:attribute_method_name, 'name_of_attribute')
|
43
|
+
|
44
|
+
## Creating verifications for success response
|
45
|
+
|
46
|
+
# Values that must have a certain value for 'success scenario' shared example
|
47
|
+
# mandatory_json_values '$..status' => 'available'
|
48
|
+
|
49
|
+
# Elements that must be in the response for 'success scenario' shared example
|
50
|
+
# Below will expect an element at the path 'tags' to be present
|
51
|
+
# mandatory_elements :tags
|
52
52
|
end
|
@@ -1,30 +1,30 @@
|
|
1
|
-
# This class represent SOAP Api calls for the <%= @name %> API
|
2
|
-
class <%= @name %> < Soaspec::SoapHandler
|
3
|
-
# Wsdl for <%= @name %>
|
4
|
-
def savon_options
|
5
|
-
{
|
6
|
-
# wsdl 'https://my_host/api?wsdl' TODO: Change this to the wsdl that this SOAP service uses
|
7
|
-
}
|
8
|
-
end
|
9
|
-
|
10
|
-
## Verifying on response
|
11
|
-
|
12
|
-
# Values that must have a certain value for 'success scenario' shared example
|
13
|
-
# mandatory_json_values '$..status' => 'available'
|
14
|
-
|
15
|
-
# Elements that must be in the response for 'success scenario' shared example
|
16
|
-
# Below will expect an element at the path 'tags' to be present
|
17
|
-
# mandatory_elements :tags
|
18
|
-
|
19
|
-
# Use this to extract the value of either a JSON (JSONPath) or XML (Xpath) element. 'element_name' is the method that will be
|
20
|
-
# generated on an Exchange to obtain it
|
21
|
-
# element :element_name, 'element_path'
|
22
|
-
|
23
|
-
# Use this to extract an attribute from XML. If the name of the method and the attribute name are the same then only one parameter is
|
24
|
-
# needed
|
25
|
-
# attribute(:attribute_method_name, 'name_of_attribute')
|
26
|
-
|
27
|
-
# Set an attribute on the root XML element
|
28
|
-
# root_attributes 'Version' => '1'
|
29
|
-
|
1
|
+
# This class represent SOAP Api calls for the <%= @name %> API
|
2
|
+
class <%= @name %> < Soaspec::SoapHandler
|
3
|
+
# Wsdl for <%= @name %>
|
4
|
+
def savon_options
|
5
|
+
{
|
6
|
+
# wsdl 'https://my_host/api?wsdl' TODO: Change this to the wsdl that this SOAP service uses
|
7
|
+
}
|
8
|
+
end
|
9
|
+
|
10
|
+
## Verifying on response
|
11
|
+
|
12
|
+
# Values that must have a certain value for 'success scenario' shared example
|
13
|
+
# mandatory_json_values '$..status' => 'available'
|
14
|
+
|
15
|
+
# Elements that must be in the response for 'success scenario' shared example
|
16
|
+
# Below will expect an element at the path 'tags' to be present
|
17
|
+
# mandatory_elements :tags
|
18
|
+
|
19
|
+
# Use this to extract the value of either a JSON (JSONPath) or XML (Xpath) element. 'element_name' is the method that will be
|
20
|
+
# generated on an Exchange to obtain it
|
21
|
+
# element :element_name, 'element_path'
|
22
|
+
|
23
|
+
# Use this to extract an attribute from XML. If the name of the method and the attribute name are the same then only one parameter is
|
24
|
+
# needed
|
25
|
+
# attribute(:attribute_method_name, 'name_of_attribute')
|
26
|
+
|
27
|
+
# Set an attribute on the root XML element
|
28
|
+
# root_attributes 'Version' => '1'
|
29
|
+
|
30
30
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
class PackageService < Soaspec::RestHandler
|
2
|
-
base_url 'http://localhost:4999/packages'
|
1
|
+
class PackageService < Soaspec::RestHandler
|
2
|
+
base_url 'http://localhost:4999/packages'
|
3
3
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
|
2
|
-
require 'rspec'
|
3
|
-
|
4
|
-
shared_examples_for 'error scenario' do
|
5
|
-
it 'does not have status code of 200' do
|
6
|
-
expect(described_class.status_code).not_to eq 200
|
7
|
-
end
|
8
|
-
end
|
1
|
+
|
2
|
+
require 'rspec'
|
3
|
+
|
4
|
+
shared_examples_for 'error scenario' do
|
5
|
+
it 'does not have status code of 200' do
|
6
|
+
expect(described_class.status_code).not_to eq 200
|
7
|
+
end
|
8
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
<%= operation %> = <%= options[:name] %>.new(<%= @class_params %>)
|
5
|
-
<%= operation %>.operation = :<%= operation %>
|
6
|
-
<%= operation %>.default_hash = data_for '<%= operation %>/default'
|
7
|
-
|
8
|
-
context <%= operation %> do
|
9
|
-
describe Exchange.new(:default) do
|
10
|
-
it_behaves_like 'success scenario'
|
11
|
-
end
|
12
|
-
end
|
1
|
+
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
<%= operation %> = <%= options[:name] %>.new(<%= @class_params %>)
|
5
|
+
<%= operation %>.operation = :<%= operation %>
|
6
|
+
<%= operation %>.default_hash = data_for '<%= operation %>/default'
|
7
|
+
|
8
|
+
context <%= operation %> do
|
9
|
+
describe Exchange.new(:default) do
|
10
|
+
it_behaves_like 'success scenario'
|
11
|
+
end
|
12
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
context PackageService.new('Test extract id') do
|
2
|
-
describe get 'Negative', suburl: '4/40' do
|
3
|
-
its(['success']) { is_expected.to eq 'false' }
|
4
|
-
end
|
5
|
-
|
6
|
-
describe get 'Positive', suburl: '4/41' do
|
7
|
-
its(['success']) { is_expected.to eq 'true' }
|
8
|
-
end
|
9
|
-
end
|
1
|
+
context PackageService.new('Test extract id') do
|
2
|
+
describe get 'Negative', suburl: '4/40' do
|
3
|
+
its(['success']) { is_expected.to eq 'false' }
|
4
|
+
end
|
5
|
+
|
6
|
+
describe get 'Positive', suburl: '4/41' do
|
7
|
+
its(['success']) { is_expected.to eq 'true' }
|
8
|
+
end
|
9
|
+
end
|
@@ -1,51 +1,51 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
id = '70070010'
|
5
|
-
# BLZService.new(template_name: 'soap_template') Use this instead of default_hash to use template approach
|
6
|
-
|
7
|
-
context 'Test Examples' do
|
8
|
-
context BLZService.new('Get Bank', operation: :get_bank, default_hash: { blz: id }) do
|
9
|
-
|
10
|
-
describe Exchange.new(:default) do
|
11
|
-
it { is_expected.to contain_value id }
|
12
|
-
it { is_expected.to include_in_body id }
|
13
|
-
it_behaves_like 'success scenario'
|
14
|
-
after(:all) { described_class.store(:title, 'bezeichnung') }
|
15
|
-
end
|
16
|
-
|
17
|
-
describe Exchange.new(:xpath_eg, blz: 100000) do
|
18
|
-
its(['plz']) { is_expected.to eq '100000' }
|
19
|
-
it { is_expected.to have_xpath_value '//ns1:bezeichnung' => 'Deutsche Bank' }
|
20
|
-
context 'Handle retrieving stored value' do
|
21
|
-
it { is_expected.to have_xpath_value 'bezeichnung' => described_class.retrieve(:title) }
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe Exchange.new(:yaml_eg, data_for(:small_id)) do
|
26
|
-
it_behaves_like 'success scenario'
|
27
|
-
end
|
28
|
-
|
29
|
-
# Retry for success more for web services that intermittently fail
|
30
|
-
describe Exchange.new(:short_hand_xpath).retry_for_success do
|
31
|
-
# Be careful. If you call a method that does not use namespaces, calling one that does may not find the element
|
32
|
-
its(['ns1:bezeichnung']) { is_expected.to eq 'Deutsche Bank' } # '//' is not required at the beginning
|
33
|
-
end
|
34
|
-
describe Exchange.new('Check existence of elements') do
|
35
|
-
it { is_expected.to have_element_at_xpath '//ns1:bezeichnung' }
|
36
|
-
it { is_expected.not_to have_element_at_xpath '//ns1:bezeichnung_pretend' }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
error_example = BLZService.new('Error example')
|
42
|
-
error_example.operation = :get_bank
|
43
|
-
error_example.default_hash = {}
|
44
|
-
|
45
|
-
context 'Error Examples' do
|
46
|
-
context error_example do
|
47
|
-
describe Exchange.new(:no_blz_error) do
|
48
|
-
it_behaves_like 'error scenario'
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
1
|
+
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
id = '70070010'
|
5
|
+
# BLZService.new(template_name: 'soap_template') Use this instead of default_hash to use template approach
|
6
|
+
|
7
|
+
context 'Test Examples' do
|
8
|
+
context BLZService.new('Get Bank', operation: :get_bank, default_hash: { blz: id }) do
|
9
|
+
|
10
|
+
describe Exchange.new(:default) do
|
11
|
+
it { is_expected.to contain_value id }
|
12
|
+
it { is_expected.to include_in_body id }
|
13
|
+
it_behaves_like 'success scenario'
|
14
|
+
after(:all) { described_class.store(:title, 'bezeichnung') }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe Exchange.new(:xpath_eg, blz: 100000) do
|
18
|
+
its(['plz']) { is_expected.to eq '100000' }
|
19
|
+
it { is_expected.to have_xpath_value '//ns1:bezeichnung' => 'Deutsche Bank' }
|
20
|
+
context 'Handle retrieving stored value' do
|
21
|
+
it { is_expected.to have_xpath_value 'bezeichnung' => described_class.retrieve(:title) }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe Exchange.new(:yaml_eg, data_for(:small_id)) do
|
26
|
+
it_behaves_like 'success scenario'
|
27
|
+
end
|
28
|
+
|
29
|
+
# Retry for success more for web services that intermittently fail
|
30
|
+
describe Exchange.new(:short_hand_xpath).retry_for_success do
|
31
|
+
# Be careful. If you call a method that does not use namespaces, calling one that does may not find the element
|
32
|
+
its(['ns1:bezeichnung']) { is_expected.to eq 'Deutsche Bank' } # '//' is not required at the beginning
|
33
|
+
end
|
34
|
+
describe Exchange.new('Check existence of elements') do
|
35
|
+
it { is_expected.to have_element_at_xpath '//ns1:bezeichnung' }
|
36
|
+
it { is_expected.not_to have_element_at_xpath '//ns1:bezeichnung_pretend' }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
error_example = BLZService.new('Error example')
|
42
|
+
error_example.operation = :get_bank
|
43
|
+
error_example.default_hash = {}
|
44
|
+
|
45
|
+
context 'Error Examples' do
|
46
|
+
context error_example do
|
47
|
+
describe Exchange.new(:no_blz_error) do
|
48
|
+
it_behaves_like 'error scenario'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|