standardapi 5.0.0.6 → 5.0.0.7

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: 77989eca000ed99df1008559e61b8f65b6f60760
4
- data.tar.gz: e074a398c3c73ebb8d49a7c1df6cbd41f5adb877
3
+ metadata.gz: 063b813ac24cddfe25d10fc3a0feae1275f4a33c
4
+ data.tar.gz: 1508403c873b4155d310a90899aaa24ee8b53adb
5
5
  SHA512:
6
- metadata.gz: 47564cab964d0ec6673092a9d32374cc872c38aa65b9d284c781eeefe0c0357ebe5754a5285af24d9f6a0b7236c0d2425339d27e8c4290bfbed2b98e3bdbb395
7
- data.tar.gz: 701d8b5ee38f2bbbfe9a3713e8fec6ec351ab4860fbd7431aa31c047c9e990c8a9cd2e35fc5654856019c4ff079b26e7197f4cc0e6479576d75f6a0a0bc247f4
6
+ metadata.gz: d957f41104edfbb811c394a0c2412b5733ea30ad17aff358180d205d1555b5c55723dabdc3785b47a13120f9fd942c9ec6026ffc064a6adfb696f3ceea4cf230
7
+ data.tar.gz: ce04e41c9d05bfd6d481cd65a12a279c337d60f376d6b9d9757eef7f03571bdda5bd7a9168670bf0e7f61787ffb4ee8cf758df0c3ba6042a2be0f4434f11f862
@@ -112,19 +112,19 @@ module StandardAPI
112
112
  assert_equal json[included.to_s][key.to_s], normalize_to_json(m, key, value)
113
113
  end
114
114
  else
115
- m = m.send(included).first.try(:reload)
115
+ m2 = m.send(included).first.try(:reload)
116
116
 
117
- m_json = if m && m.has_attribute?(:id)
118
- json[included.to_s].find { |x| x['id'] == normalize_to_json(m, :id, m.id) }
119
- elsif m
120
- json[included.to_s].find { |x| x.keys.all? { |key| x[key] == normalize_to_json(m, key, m[key]) } }
117
+ m_json = if m2 && m2.has_attribute?(:id)
118
+ json[included.to_s].find { |x| x['id'] == normalize_to_json(m2, :id, m2.id) }
119
+ elsif m2
120
+ json[included.to_s].find { |x| x.keys.all? { |key| x[key] == normalize_to_json(m2, key, m2[key]) } }
121
121
  else
122
122
  nil
123
123
  end
124
124
 
125
- view_attributes(m).each do |key, value|
126
- message = "Model / Attribute: #{m.class.name}##{key}"
127
- assert_equal m_json[key.to_s], normalize_to_json(m, key, value), message
125
+ view_attributes(m2).each do |key, value|
126
+ message = "Model / Attribute: #{m2.class.name}##{key}"
127
+ assert_equal m_json[key.to_s], normalize_to_json(m2, key, value), message
128
128
  end
129
129
 
130
130
  end
@@ -12,9 +12,26 @@ module StandardAPI
12
12
  end
13
13
 
14
14
  test '#index.json requires limit' do
15
- assert_raises ActionController::ParameterMissing do
15
+ limit = controller_class.new.send(:resource_limit)
16
+
17
+ return if !limit || limit == Float::INFINITY
18
+
19
+ begin
16
20
  get resource_path(:index, format: :json)
21
+ assert_response :bad_request
22
+ rescue ActionController::ParameterMissing
17
23
  end
24
+
25
+ # return if !controller_class.new.send(:resource_limit)
26
+ # if app.config.action_dispatch.show_exceptions
27
+ # assert_raises ActionController::ParameterMissing do
28
+ # get resource_path(:index, format: 'json')
29
+ # assert_response :bad_request
30
+ # end
31
+ # else
32
+ # get resource_path(:index, format: :json)
33
+ # assert_response :bad_request
34
+ # end
18
35
  end
19
36
 
20
37
  test '#index.json params[:limit]' do
@@ -1,3 +1,3 @@
1
1
  module StandardAPI
2
- VERSION = '5.0.0.6'
2
+ VERSION = '5.0.0.7'
3
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.6
4
+ version: 5.0.0.7
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-11-29 00:00:00.000000000 Z
11
+ date: 2016-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails