client-api 0.2.4 → 0.2.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c02b29aa08f24e7cab407632413b695ff29296ff02280ed37bcfb7582f7c4c42
4
- data.tar.gz: 275becbf9891f8958efa1a9aa4a33d86e7308094a3b4370a7d60c3c9fb0acd27
3
+ metadata.gz: 6dbc0b53689ca77ae651de925fe7c51c36e26a92295e6a71803b9a32627dfaca
4
+ data.tar.gz: 19f258c46f7587bc2b1b23429e0f0ca47e0660ddbcbc4b9c53eb33d559ccf87e
5
5
  SHA512:
6
- metadata.gz: 8724c2f11d6635b770c893a7db95da760d8920516c67613449c4af44dcc7146135bd8e50c0d8199ee99b2c1a7b9b1b3dc7c493d06c9dbee57fed85d2d8d0470a
7
- data.tar.gz: c945105f129f17a51084b2b648116e5fd134df7842bc0ad8d3a43e038a976ddf425005bf27dfea12cd0a38dc2e0249902cfc6bd2b407a33f8900f20354990865
6
+ metadata.gz: 4e359917c7003610f039b651eda0a5345e1c8bdd7fadb08ea504d84b7daad7d945da32efee9fa280eeeb5523e8bb79dda0f3c1887fdee2edd55c1a488f7c38e3
7
+ data.tar.gz: f837b44b36edba5990a7e72b37f193612de313bff0107963384f49d5fbaf90c71e8443435cd7c504b4f2354c67c741bda9a14ed1d4d70eee3358f08d1407f8f8
@@ -18,7 +18,7 @@ module ClientApi
18
18
 
19
19
  value ||= data[:value]
20
20
  operator = data[:operator]
21
- type = data[:type] if data[:type] || data[:type] != {} || !data[:type].empty?
21
+ type ||= data[:type]
22
22
 
23
23
  case operator
24
24
  when '=', '==', 'eql?', 'equal', 'equal?'
@@ -26,9 +26,9 @@ module ClientApi
26
26
  expect(value).to eq(@resp), lambda {"[key]: \"#{data[:key]}\"".blue + "\n didn't match \n[value]: \"#{data[:value]}\"\n"} if value != nil
27
27
 
28
28
  # datatype validation
29
- if (type == 'boolean') || (type == 'bool') && value.nil?
29
+ if (type == 'boolean') || (type == 'bool')
30
30
  expect(%w[TrueClass, FalseClass].any? {|bool| bool.include? @resp.class.to_s}).to eq(true), lambda {"[key]: \"#{data[:key]}\"".blue + "\n datatype shouldn't be \n[type]: \"#{data[:type]}\"\n"}
31
- elsif (type != nil) && (value != nil)
31
+ elsif ((type != 'boolean') || (type != 'bool')) && (type != nil)
32
32
  expect(datatype(type, value)).to eq(@resp.class), lambda {"[key]: \"#{data[:key]}\"".blue + "\n datatype shouldn't be \n[type]: \"#{data[:type]}\"\n"}
33
33
  end
34
34
 
@@ -37,9 +37,9 @@ module ClientApi
37
37
  expect(value).not_to eq(@resp), lambda {"[key]: \"#{data[:key]}\"".blue + "\n didn't match \n[value]: \"#{data[:value]}\"\n"} if value != nil
38
38
 
39
39
  # datatype validation
40
- if (type == 'boolean') || (type == 'bool') && value.nil?
40
+ if (type == 'boolean') || (type == 'bool')
41
41
  expect(%w[TrueClass, FalseClass].any? {|bool| bool.include? @resp.class.to_s}).not_to eq(true), lambda {"[key]: \"#{data[:key]}\"".blue + "\n datatype shouldn't be \n[type]: \"#{data[:type]}\"\n"}
42
- elsif (type != nil) && (value != nil)
42
+ elsif ((type != 'boolean') || (type != 'bool')) && (type != nil)
43
43
  expect(datatype(type, value)).not_to eq(@resp.class), lambda {"[key]: \"#{data[:key]}\"".blue + "\n datatype shouldn't be \n[type]: \"#{data[:type]}\"\n"}
44
44
  end
45
45
 
@@ -53,7 +53,29 @@ module ClientApi
53
53
  expect(@resp.to_i.public_send(operator, value)).to eq(true), "[key]: \"#{data[:key]}\"".blue + "\n #{message} \n[value]: \"#{data[:value]}\"\n" if value != nil
54
54
 
55
55
  # datatype validation
56
- expect(datatype(type, value)).to eq(@resp.class), lambda {"[key]: \"#{data[:key]}\"".blue + "\n datatype shouldn't be \n[type]: \"#{data[:type]}\"\n"} if type != nil
56
+ expect(datatype(type, value)).to eq(@resp.class), lambda {"[key]: \"#{data[:key]}\"".blue + "\n datatype shouldn't be \n[type]: \"#{data[:type]}\"\n"} if type != nil
57
+
58
+ when 'contains', 'has', 'contains?', 'has?', 'include', 'include?'
59
+ # value validation
60
+ expect(@resp.to_s).to include(value.to_s), lambda {"[key]: \"#{data[:key]} => #{@resp}\"".blue + "\n not contains \n[value]: \"#{data[:value]}\"\n"} if value != nil
61
+
62
+ # datatype validation
63
+ if (type == 'boolean') || (type == 'bool')
64
+ expect(%w[TrueClass, FalseClass].any? {|bool| bool.include? @resp.class.to_s}).to eq(true), lambda {"[key]: \"#{data[:key]}\"".blue + "\n datatype shouldn't be \n[type]: \"#{data[:type]}\"\n"}
65
+ elsif ((type != 'boolean') || (type != 'bool')) && (type != nil)
66
+ expect(datatype(type, value)).to eq(@resp.class), lambda {"[key]: \"#{data[:key]}\"".blue + "\n datatype shouldn't be \n[type]: \"#{data[:type]}\"\n"}
67
+ end
68
+
69
+ when 'not contains', '!contains', 'not include', '!include'
70
+ # value validation
71
+ expect(@resp.to_s).not_to include(value.to_s), lambda {"[key]: \"#{data[:key]} => #{@resp}\"".blue + "\n should not contain \n[value]: \"#{data[:value]}\"\n"} if value != nil
72
+
73
+ # datatype validation
74
+ if (type == 'boolean') || (type == 'bool')
75
+ expect(%w[TrueClass, FalseClass].any? {|bool| bool.include? @resp.class.to_s}).not_to eq(true), lambda {"[key]: \"#{data[:key]}\"".blue + "\n datatype shouldn't be \n[type]: \"#{data[:type]}\"\n"}
76
+ elsif ((type != 'boolean') || (type != 'bool')) && (type != nil)
77
+ expect(datatype(type, value)).not_to eq(@resp.class), lambda {"[key]: \"#{data[:key]}\"".blue + "\n datatype shouldn't be \n[type]: \"#{data[:type]}\"\n"}
78
+ end
57
79
 
58
80
  else
59
81
  raise('operator not matching')
@@ -1,3 +1,3 @@
1
1
  module ClientApi
2
- VERSION = "0.2.4".freeze
2
+ VERSION = "0.2.5".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: client-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prashanth Sams
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-16 00:00:00.000000000 Z
11
+ date: 2019-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler