manacle_for 0.0.7 → 0.0.8
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/lib/manacle/matchers.rb +22 -7
- data/lib/manacle/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: 1fc8673f21ef3f1a5bb0dce95aa95f48985ade08
|
4
|
+
data.tar.gz: 391910d90479451526c7bb8ed1192525d03d5b93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d22f213146172e8c38176bde299a02aee4e650f1e04132e259f515962ad8220c489860ebab79a36ccd4bc2bcccc30b763fc6cd6c0e29e3c96bb44af5927b746a
|
7
|
+
data.tar.gz: 9f4602a8d96ea3eb1d740b54135df5eaaa417390d7ca9a4733f189413c9a3531a276e2ccda9cd7bbd0f816e8c9b2e62119d4e54fac7c30d20202dc35d8173577
|
data/lib/manacle/matchers.rb
CHANGED
@@ -1,17 +1,32 @@
|
|
1
1
|
require 'rspec/expectations'
|
2
2
|
|
3
3
|
module Manacle
|
4
|
-
RSpec::Matchers.define :fail_with do |fault_code|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
RSpec::Matchers.define :fail_with do |fault_code, fault_subCode|
|
5
|
+
define_method :is_fault? do |actual|
|
6
|
+
actual.instance_of?(ApiBanking::Fault)
|
7
|
+
return false unless actual.instance_of?(ApiBanking::Fault)
|
8
|
+
unless fault_code.nil?
|
9
|
+
return false if actual.code != fault_code
|
10
|
+
end
|
11
|
+
|
12
|
+
unless fault_subCode.nil?
|
13
|
+
return false if actual.subCode != fault_subCode
|
14
|
+
end
|
9
15
|
|
16
|
+
return true
|
17
|
+
end
|
18
|
+
|
19
|
+
match do |actual|
|
20
|
+
is_fault?(actual)
|
10
21
|
end
|
11
22
|
|
12
23
|
failure_message do |actual|
|
13
24
|
if actual.instance_of?(ApiBanking::Fault)
|
14
|
-
|
25
|
+
if actual[:code] != fault_code
|
26
|
+
"expected that result would be #{fault_code} instead of #{actual[:code]} "
|
27
|
+
else
|
28
|
+
"expected that result would be #{fault_subCode} instead of #{actual[:subCode]} "
|
29
|
+
end
|
15
30
|
else
|
16
31
|
"expected that result would be #{fault_code} instead of #{actual.class} with status code #{actual.transactionStatus.statusCode}"
|
17
32
|
end
|
@@ -20,5 +35,5 @@ module Manacle
|
|
20
35
|
failure_message_when_negated do |actual|
|
21
36
|
"expected that #{actual.transactionStatus.statusCode} would not be #{exp_status_code}"
|
22
37
|
end
|
23
|
-
end
|
38
|
+
end
|
24
39
|
end
|
data/lib/manacle/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manacle_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akil
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|