soaspec 0.2.26 → 0.2.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ChangeLog +5 -0
- data/Dockerfile +4 -1
- data/lib/soaspec.rb +1 -1
- data/lib/soaspec/{not_found_errors.rb → errors.rb} +10 -2
- data/lib/soaspec/exchange_handlers/rest_handler.rb +7 -1
- data/lib/soaspec/exchange_handlers/rest_parameters.rb +9 -0
- data/lib/soaspec/exchange_handlers/soap_handler.rb +1 -1
- data/lib/soaspec/matchers.rb +1 -1
- data/lib/soaspec/version.rb +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9cb0e0c631018645fad2ce7443c3749db7b54a139de4d8e2c681db5fd5ec1222
|
4
|
+
data.tar.gz: 0ec3d5d13bfe57e25d731f90484c32fba31dcaf1f939d306edafdce30d38bda9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c56d1eca2314f67639f83e6448a0b959c5407db48dc340e1fcc7a85bcfcb134d962cea3eb53c4f1be404db66da4ed6f90d9db8b7d1641d8acee498a0a8d81556
|
7
|
+
data.tar.gz: b6535e8af22f4558800cfda7ede70b6fb72f6414eaf716c4d7f6eb62ee2d4e879b41ee472fd51ca62276413fec17a4944096bb73c8dd842f681acbefeaca23ca
|
data/ChangeLog
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
Version 0.2.27
|
2
|
+
* Enhancement
|
3
|
+
* Enable ability to perform action right after response is retrieved. This could be used to
|
4
|
+
specify condition to fail straight away for a particular response
|
5
|
+
|
1
6
|
Version 0.2.26
|
2
7
|
* Enhancement
|
3
8
|
* Method `successful_status_code?` to return whether status code is 200..299
|
data/Dockerfile
CHANGED
@@ -2,4 +2,7 @@ FROM ruby:2.6
|
|
2
2
|
MAINTAINER Samuel Garratt
|
3
3
|
LABEL url="https://gitlab.com/samuel-garratt/soaspec/blob/master/Dockerfile"
|
4
4
|
# Simple Dockerfile with gems preinstalled
|
5
|
-
RUN gem install bundler rake soaspec
|
5
|
+
RUN gem install bundler rake soaspec
|
6
|
+
ENV LANG=en_US.UTF-8
|
7
|
+
ENV LANGUAGE=en_US.UTF-8
|
8
|
+
ENV LC_ALL=en_US.UTF-8
|
data/lib/soaspec.rb
CHANGED
@@ -24,7 +24,7 @@ require 'soaspec/exe_helpers'
|
|
24
24
|
require 'soaspec/exchange_handlers/rest_handler'
|
25
25
|
require 'soaspec/exchange_handlers/handler_accessors'
|
26
26
|
require 'soaspec/interpreter'
|
27
|
-
require 'soaspec/
|
27
|
+
require 'soaspec/errors'
|
28
28
|
require 'soaspec/wait'
|
29
29
|
|
30
30
|
# Gem for handling SOAP and REST api tests
|
@@ -1,12 +1,20 @@
|
|
1
|
+
|
2
|
+
module Soaspec
|
3
|
+
# Standard Error related to Soaspec
|
4
|
+
class Error < StandardError ; end
|
5
|
+
# Error related to a response
|
6
|
+
class ResponseError < StandardError ; end
|
7
|
+
end
|
8
|
+
|
1
9
|
# Raised to represent when there's no element at an Xpath
|
2
|
-
class NoElementAtPath <
|
10
|
+
class NoElementAtPath < Soaspec::Error
|
3
11
|
def initialize(msg = 'No element at path found')
|
4
12
|
super
|
5
13
|
end
|
6
14
|
end
|
7
15
|
|
8
16
|
# Did not find any element by provided key in the Hash
|
9
|
-
class NoElementInHash <
|
17
|
+
class NoElementInHash < Soaspec::Error
|
10
18
|
def initialize(msg = 'No element in Hash found')
|
11
19
|
super
|
12
20
|
end
|
@@ -3,7 +3,7 @@ require_relative 'rest_parameters'
|
|
3
3
|
require_relative 'rest_parameters_defaults'
|
4
4
|
require_relative 'rest_exchanger_factory'
|
5
5
|
require_relative '../core_ext/hash'
|
6
|
-
require_relative '../
|
6
|
+
require_relative '../errors'
|
7
7
|
require_relative 'handler_accessors'
|
8
8
|
require_relative '../interpreter'
|
9
9
|
require_relative 'response_extractor'
|
@@ -72,6 +72,11 @@ module Soaspec
|
|
72
72
|
request_parameters
|
73
73
|
end
|
74
74
|
|
75
|
+
# Override this with 'after_response' within class definition to perform an action
|
76
|
+
# after response is retrieved
|
77
|
+
# @param [RestClient::Response] _response Response to interpret to perform after block
|
78
|
+
def after_response(_response, _self) ; end
|
79
|
+
|
75
80
|
# Used in together with Exchange request that passes such override parameters
|
76
81
|
# @param [Hash] override_parameters Params to characterize REST request
|
77
82
|
# @option override_parameters [Hash] :params Extra parameters (E.g. headers)
|
@@ -103,6 +108,7 @@ module Soaspec
|
|
103
108
|
response = e.response
|
104
109
|
end
|
105
110
|
Soaspec::SpecLogger.info(["response_headers: #{response.headers}", "response_body: #{response}"])
|
111
|
+
after_response(response, self)
|
106
112
|
response
|
107
113
|
end
|
108
114
|
|
@@ -70,6 +70,15 @@ module Soaspec
|
|
70
70
|
define_method('pascal_keys?') { set }
|
71
71
|
end
|
72
72
|
|
73
|
+
# Pass block to perform after every response is retrieved
|
74
|
+
# @example Throw exception if response body has an 'error' element equal to true
|
75
|
+
# after_response do |response, handler|
|
76
|
+
# raise Soaspec::ResponseError if handler.value_from_path(response, 'error')
|
77
|
+
# end
|
78
|
+
def after_response
|
79
|
+
define_method('after_response') { |response, _self| yield response, self }
|
80
|
+
end
|
81
|
+
|
73
82
|
private
|
74
83
|
|
75
84
|
# Load credentials hash from a YAML using Soaspec.credentials_folder if set, adding '.yml' if not set
|
data/lib/soaspec/matchers.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamuelGarrattIQA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -473,6 +473,7 @@ files:
|
|
473
473
|
- lib/soaspec/core_ext/hash.rb
|
474
474
|
- lib/soaspec/cucumber/generic_steps.rb
|
475
475
|
- lib/soaspec/demo.rb
|
476
|
+
- lib/soaspec/errors.rb
|
476
477
|
- lib/soaspec/exchange/exchange.rb
|
477
478
|
- lib/soaspec/exchange/exchange_extractor.rb
|
478
479
|
- lib/soaspec/exchange/exchange_properties.rb
|
@@ -515,7 +516,6 @@ files:
|
|
515
516
|
- lib/soaspec/indifferent_hash.rb
|
516
517
|
- lib/soaspec/interpreter.rb
|
517
518
|
- lib/soaspec/matchers.rb
|
518
|
-
- lib/soaspec/not_found_errors.rb
|
519
519
|
- lib/soaspec/o_auth2.rb
|
520
520
|
- lib/soaspec/soaspec_shared_examples.rb
|
521
521
|
- lib/soaspec/spec_logger.rb
|
@@ -556,8 +556,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
556
556
|
- !ruby/object:Gem::Version
|
557
557
|
version: '0'
|
558
558
|
requirements: []
|
559
|
-
|
560
|
-
rubygems_version: 2.6.14
|
559
|
+
rubygems_version: 3.0.4
|
561
560
|
signing_key:
|
562
561
|
specification_version: 4
|
563
562
|
summary: Helps to create tests for 'SOAP' or 'REST' apis
|