salestation 5.0.1 → 5.0.2

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
  SHA256:
3
- metadata.gz: 9f13d59875d14de627bc0a9acb2f52ac9e09ac1fac38b8741199aa6342852ca8
4
- data.tar.gz: 505233565865a9f2e527deaed88e1b89788b1bfbfab873ec15b0a85dd5fe1503
3
+ metadata.gz: 45624d622f8661658f1549308516bf9600bad88764a1e6682ea9e585c95be059
4
+ data.tar.gz: b10067eda3d00fd6da5648f0a396f558e8c6122968b8393e6934fd7053a34e6a
5
5
  SHA512:
6
- metadata.gz: 3f26ae48f7f8169d0457938205dc3c08136bcb112a445e071beb2e6d2a792d4b47ebb1afe2497f7e18bcb08bf4daa70168ff85665f59ee07e8e37eafc4771990
7
- data.tar.gz: 0fde7366029cf2123d7a7b51c524e412f638eb6da3fc2285675bdd8ce89e6572b0c6d80d8d7244ed7c018dc9c2d292bea19301e3f446b827a5fe381b94c144cf
6
+ metadata.gz: 7eb34e5d245f616f9db8e8a64f3df426ea80982bd44a00933cb681b5c1fc5e818e4b8b6ff7dcdf177f841448fd50d8ccf1eeb62a65619fceb5cd25e893007966
7
+ data.tar.gz: a6c636b8b308f57a2c23c99d63a2099b05f6dc89e133caa29f98a35920d971cd9e3905176c1075fa891e4442d164be9050f8e57f3ef0c91f6bd7021d3170a423
@@ -12,6 +12,7 @@ module Salestation
12
12
  def initialize
13
13
  @fields = []
14
14
  @field_error_types = {}
15
+ @field_error_messages = {}
15
16
  end
16
17
 
17
18
  def on(field)
@@ -24,10 +25,16 @@ module Salestation
24
25
  self
25
26
  end
26
27
 
28
+ def with_message(*messages)
29
+ @field_error_messages[@fields.last] = messages
30
+ self
31
+ end
32
+
27
33
  def matches?(actual)
28
34
  @fields.all? do |field|
29
35
  check_field_exists(field, actual) &&
30
- check_field_error_types(field, actual)
36
+ check_field_error_types(field, actual) &&
37
+ check_field_error_messages(field, actual)
31
38
  end
32
39
  end
33
40
 
@@ -44,6 +51,14 @@ module Salestation
44
51
 
45
52
  (@field_error_types[field] - actual_error_types).empty?
46
53
  end
54
+
55
+ def check_field_error_messages(field, actual)
56
+ return true unless @field_error_messages[field]
57
+
58
+ actual_error_messages = actual[:error_details].fetch(field).map { |f| f.fetch(:message) }
59
+
60
+ (@field_error_messages[field] - actual_error_messages).empty?
61
+ end
47
62
  end
48
63
  end
49
64
  end
data/salestation.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "salestation"
7
- spec.version = "5.0.1"
7
+ spec.version = "5.0.2"
8
8
  spec.authors = ["Glia TechMovers"]
9
9
  spec.email = ["techmovers@glia.com"]
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salestation
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glia TechMovers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-10 00:00:00.000000000 Z
11
+ date: 2022-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler