standardapi 5.0.0.10 → 5.0.0.12

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
  SHA1:
3
- metadata.gz: 11bb8361f273e8435fece56039550dd3b81e0354
4
- data.tar.gz: bc79398e3dff4a6bee4f06b2aa2a778c725e4eed
3
+ metadata.gz: 7e4bd9a29e2b2aca1714dacb7fb88b4a3b68aa0a
4
+ data.tar.gz: 696774eaffe23e7a31c2b05fe2c4b8d05aceacbe
5
5
  SHA512:
6
- metadata.gz: 10d26d53f1f7e04bd783b54c50e9479420bc91eefba5695418f085da96b10edc14396a11f9062f44eea56c6d284fee90d633e373d504683c399de1c479f753b5
7
- data.tar.gz: e3ef82a580eb62192b229e997ab0af4f35a133ec6f78e558c49658edc77f33f144cf0576479664885d7e083d9f4b8c6217fd2ebc0c09b875803d02a0798bf798
6
+ metadata.gz: b06a888614e9e71a8fe72f2f999da46c639e7f22f306285bdf8ef48ea3031bf6604de46e0a64ba3a6a912f5eaf223314cacf48317ce96415283bd2234a6aa3c9
7
+ data.tar.gz: 3b4922dbe3dfa8cc26ab3a2566f87a81e1291e9b49ef68b2040344cc2753047e768f70e2799f2ca4ba5b9f8bd216fa17facfb6d4ac569aedb093c3c541d554c7
@@ -164,11 +164,7 @@ module StandardAPI
164
164
  end
165
165
 
166
166
  def required_orders
167
- if model.column_names.include?('id')
168
- [:id]
169
- else
170
- []
171
- end
167
+ []
172
168
  end
173
169
 
174
170
  def orders
@@ -24,9 +24,9 @@ module StandardAPI
24
24
  view_attributes(m.reload).select { |x| attrs.keys.map(&:to_s).include?(x) }.each do |key, value|
25
25
  message = "Model / Attribute: #{m.class.name}##{key}"
26
26
  if value.is_a?(BigDecimal)
27
- assert_equal normalize_to_json(m, key, attrs[key.to_sym]).to_s.to_f, json[key.to_s].to_s.to_f, message
27
+ assert_equal_or_nil normalize_to_json(m, key, attrs[key.to_sym]).to_s.to_f, json[key.to_s].to_s.to_f, message
28
28
  else
29
- assert_equal normalize_to_json(m, key, attrs[key.to_sym]), json[key.to_s], message
29
+ assert_equal_or_nil normalize_to_json(m, key, attrs[key.to_sym]), json[key.to_s], message
30
30
  end
31
31
  end
32
32
  end
@@ -53,7 +53,7 @@ module StandardAPI
53
53
  m.reload
54
54
  view_attributes(m).select { |x| attrs.keys.map(&:to_s).include?(x) }.each do |key, value|
55
55
  message = "Model / Attribute: #{m.class.name}##{key}"
56
- assert_equal normalize_attribute(m, key, attrs[key.to_sym]), value, message
56
+ assert_equal_or_nil normalize_attribute(m, key, attrs[key.to_sym]), value, message
57
57
  end
58
58
  end
59
59
  end
@@ -19,9 +19,9 @@ module StandardAPI
19
19
  view_attributes(m.reload).select { |x| attrs.keys.map(&:to_s).include?(x) }.each do |key, value|
20
20
  message = "Model / Attribute: #{m.class.name}##{key}"
21
21
  if value.is_a?(BigDecimal)
22
- assert_equal normalize_attribute(m, key, attrs[key.to_sym]).to_s.to_f, value.to_s.to_f, message
22
+ assert_equal_or_nil normalize_attribute(m, key, attrs[key.to_sym]).to_s.to_f, value.to_s.to_f, message
23
23
  else
24
- assert_equal normalize_attribute(m, key, attrs[key.to_sym]), value, message
24
+ assert_equal_or_nil normalize_attribute(m, key, attrs[key.to_sym]), value, message
25
25
  end
26
26
  end
27
27
  assert JSON.parse(@response.body).is_a?(Hash)
@@ -58,7 +58,7 @@ module StandardAPI
58
58
  # (m.attribute_names & attrs.keys.map(&:to_s)).each do |test_key|
59
59
  view_attributes(m.reload).select { |x| attrs.keys.map(&:to_s).include?(x) }.each do |key, value|
60
60
  message = "Model / Attribute: #{m.class.name}##{key}"
61
- assert_equal normalize_attribute(m, key, attrs[key.to_sym]), value, message
61
+ assert_equal_or_nil normalize_attribute(m, key, attrs[key.to_sym]), value, message
62
62
  end
63
63
  assert JSON.parse(@response.body).is_a?(Hash)
64
64
  end
@@ -10,6 +10,14 @@ require File.expand_path(File.join(__FILE__, '../test_case/show_tests'))
10
10
  require File.expand_path(File.join(__FILE__, '../test_case/update_tests'))
11
11
 
12
12
  module StandardAPI::TestCase
13
+
14
+ def assert_equal_or_nil(expected, *args)
15
+ if expected.nil?
16
+ assert_nil(*args)
17
+ else
18
+ assert_equal(expected, *args)
19
+ end
20
+ end
13
21
 
14
22
  def self.included(klass)
15
23
  [:filters, :orders, :includes].each do |attribute|
@@ -1,3 +1,3 @@
1
1
  module StandardAPI
2
- VERSION = '5.0.0.10'
3
- end
2
+ VERSION = '5.0.0.12'
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standardapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.10
4
+ version: 5.0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Bracy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-08 00:00:00.000000000 Z
11
+ date: 2017-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails