rocket_pants 1.10.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,7 @@ module RocketPants
26
26
  end
27
27
 
28
28
  def self.invalid?(object)
29
- object.respond_to?(:invalid?) && object.invalid?
29
+ object.respond_to?(:errors) && object.errors.present?
30
30
  end
31
31
 
32
32
  def self.paginated?(object)
@@ -165,6 +165,13 @@ module RocketPants
165
165
  end
166
166
  alias expose exposes
167
167
 
168
+ # Fixes head to return the correct content type for you api.
169
+ #
170
+ # See the ActionController build in version for definitions.
171
+ def head(status, options = {})
172
+ super status, options.merge(content_type: 'application/json')
173
+ end
174
+
168
175
  # Hooks in to allow you to perform pre-processing of objects
169
176
  # when they are exposed. Used for plugins to the controller.
170
177
  #
@@ -40,7 +40,14 @@ module RocketPants
40
40
  end
41
41
 
42
42
  def self.differ
43
- @_differ ||= RSpec::Expectations::Differ.new
43
+ return @_differ if instance_variable_defined?(:@_differ)
44
+ if defined?(RSpec::Support::Differ)
45
+ @_differ = RSpec::Expectations::Differ
46
+ elsif defined?(RSpec::Expectations::Differ)
47
+ @_differ = RSpec::Expectations::Differ.new
48
+ else
49
+ @_differ = nil
50
+ end
44
51
  end
45
52
 
46
53
  matcher :_be_api_error do |error_type|
@@ -96,13 +103,18 @@ module RocketPants
96
103
  normalised_response == @decoded
97
104
  end
98
105
 
99
- failure_message_for_should do |response|
106
+ should_failure_method = respond_to?(:failure_message) ? :failure_message : :failure_message_for_should
107
+ should_not_failure_method = respond_to?(:failure_message_when_negated) ? :failure_message_when_negated : :failure_message_for_should_not
108
+
109
+ send(should_failure_method) do |response|
100
110
  message = "expected api to have exposed #{normalised_response.inspect}, got #{@decoded.inspect} instead."
101
- message << "\n\nDiff: #{RSpecMatchers.differ.diff_as_object(@decoded, normalised_response)}"
111
+ if differ = RSpecMatchers.differ
112
+ message << "\n\nDiff: #{differ.diff_as_object(@decoded, normalised_response)}"
113
+ end
102
114
  message
103
115
  end
104
116
 
105
- failure_message_for_should_not do |response|
117
+ send(should_not_failure_method) do |response|
106
118
  "expected api to not have exposed #{normalised_response.inspect}"
107
119
  end
108
120
 
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocket_pants
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Darcy Laycock
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-07-14 00:00:00.000000000 Z
12
+ date: 2015-04-30 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: actionpack
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
@@ -23,6 +25,7 @@ dependencies:
23
25
  type: :runtime
24
26
  prerelease: false
25
27
  version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
26
29
  requirements:
27
30
  - - ! '>='
28
31
  - !ruby/object:Gem::Version
@@ -33,6 +36,7 @@ dependencies:
33
36
  - !ruby/object:Gem::Dependency
34
37
  name: railties
35
38
  requirement: !ruby/object:Gem::Requirement
39
+ none: false
36
40
  requirements:
37
41
  - - ! '>='
38
42
  - !ruby/object:Gem::Version
@@ -43,6 +47,7 @@ dependencies:
43
47
  type: :runtime
44
48
  prerelease: false
45
49
  version_requirements: !ruby/object:Gem::Requirement
50
+ none: false
46
51
  requirements:
47
52
  - - ! '>='
48
53
  - !ruby/object:Gem::Version
@@ -53,6 +58,7 @@ dependencies:
53
58
  - !ruby/object:Gem::Dependency
54
59
  name: will_paginate
55
60
  requirement: !ruby/object:Gem::Requirement
61
+ none: false
56
62
  requirements:
57
63
  - - ~>
58
64
  - !ruby/object:Gem::Version
@@ -60,6 +66,7 @@ dependencies:
60
66
  type: :runtime
61
67
  prerelease: false
62
68
  version_requirements: !ruby/object:Gem::Requirement
69
+ none: false
63
70
  requirements:
64
71
  - - ~>
65
72
  - !ruby/object:Gem::Version
@@ -67,6 +74,7 @@ dependencies:
67
74
  - !ruby/object:Gem::Dependency
68
75
  name: hashie
69
76
  requirement: !ruby/object:Gem::Requirement
77
+ none: false
70
78
  requirements:
71
79
  - - ! '>='
72
80
  - !ruby/object:Gem::Version
@@ -77,6 +85,7 @@ dependencies:
77
85
  type: :runtime
78
86
  prerelease: false
79
87
  version_requirements: !ruby/object:Gem::Requirement
88
+ none: false
80
89
  requirements:
81
90
  - - ! '>='
82
91
  - !ruby/object:Gem::Version
@@ -87,6 +96,7 @@ dependencies:
87
96
  - !ruby/object:Gem::Dependency
88
97
  name: api_smith
89
98
  requirement: !ruby/object:Gem::Requirement
99
+ none: false
90
100
  requirements:
91
101
  - - ! '>='
92
102
  - !ruby/object:Gem::Version
@@ -94,6 +104,7 @@ dependencies:
94
104
  type: :runtime
95
105
  prerelease: false
96
106
  version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
97
108
  requirements:
98
109
  - - ! '>='
99
110
  - !ruby/object:Gem::Version
@@ -101,6 +112,7 @@ dependencies:
101
112
  - !ruby/object:Gem::Dependency
102
113
  name: moneta
103
114
  requirement: !ruby/object:Gem::Requirement
115
+ none: false
104
116
  requirements:
105
117
  - - ! '>='
106
118
  - !ruby/object:Gem::Version
@@ -108,6 +120,7 @@ dependencies:
108
120
  type: :runtime
109
121
  prerelease: false
110
122
  version_requirements: !ruby/object:Gem::Requirement
123
+ none: false
111
124
  requirements:
112
125
  - - ! '>='
113
126
  - !ruby/object:Gem::Version
@@ -115,34 +128,51 @@ dependencies:
115
128
  - !ruby/object:Gem::Dependency
116
129
  name: rspec
117
130
  requirement: !ruby/object:Gem::Requirement
131
+ none: false
118
132
  requirements:
119
- - - ~>
133
+ - - ! '>='
120
134
  - !ruby/object:Gem::Version
121
135
  version: '2.4'
136
+ - - <
137
+ - !ruby/object:Gem::Version
138
+ version: '4.0'
122
139
  type: :development
123
140
  prerelease: false
124
141
  version_requirements: !ruby/object:Gem::Requirement
142
+ none: false
125
143
  requirements:
126
- - - ~>
144
+ - - ! '>='
127
145
  - !ruby/object:Gem::Version
128
146
  version: '2.4'
147
+ - - <
148
+ - !ruby/object:Gem::Version
149
+ version: '4.0'
129
150
  - !ruby/object:Gem::Dependency
130
151
  name: rspec-rails
131
152
  requirement: !ruby/object:Gem::Requirement
153
+ none: false
132
154
  requirements:
133
- - - ~>
155
+ - - ! '>='
134
156
  - !ruby/object:Gem::Version
135
157
  version: '2.4'
158
+ - - <
159
+ - !ruby/object:Gem::Version
160
+ version: '4.0'
136
161
  type: :development
137
162
  prerelease: false
138
163
  version_requirements: !ruby/object:Gem::Requirement
164
+ none: false
139
165
  requirements:
140
- - - ~>
166
+ - - ! '>='
141
167
  - !ruby/object:Gem::Version
142
168
  version: '2.4'
169
+ - - <
170
+ - !ruby/object:Gem::Version
171
+ version: '4.0'
143
172
  - !ruby/object:Gem::Dependency
144
173
  name: rr
145
174
  requirement: !ruby/object:Gem::Requirement
175
+ none: false
146
176
  requirements:
147
177
  - - ~>
148
178
  - !ruby/object:Gem::Version
@@ -150,6 +180,7 @@ dependencies:
150
180
  type: :development
151
181
  prerelease: false
152
182
  version_requirements: !ruby/object:Gem::Requirement
183
+ none: false
153
184
  requirements:
154
185
  - - ~>
155
186
  - !ruby/object:Gem::Version
@@ -157,6 +188,7 @@ dependencies:
157
188
  - !ruby/object:Gem::Dependency
158
189
  name: webmock
159
190
  requirement: !ruby/object:Gem::Requirement
191
+ none: false
160
192
  requirements:
161
193
  - - ! '>='
162
194
  - !ruby/object:Gem::Version
@@ -164,6 +196,7 @@ dependencies:
164
196
  type: :development
165
197
  prerelease: false
166
198
  version_requirements: !ruby/object:Gem::Requirement
199
+ none: false
167
200
  requirements:
168
201
  - - ! '>='
169
202
  - !ruby/object:Gem::Version
@@ -171,6 +204,7 @@ dependencies:
171
204
  - !ruby/object:Gem::Dependency
172
205
  name: activerecord
173
206
  requirement: !ruby/object:Gem::Requirement
207
+ none: false
174
208
  requirements:
175
209
  - - ! '>='
176
210
  - !ruby/object:Gem::Version
@@ -181,6 +215,7 @@ dependencies:
181
215
  type: :development
182
216
  prerelease: false
183
217
  version_requirements: !ruby/object:Gem::Requirement
218
+ none: false
184
219
  requirements:
185
220
  - - ! '>='
186
221
  - !ruby/object:Gem::Version
@@ -191,6 +226,7 @@ dependencies:
191
226
  - !ruby/object:Gem::Dependency
192
227
  name: sqlite3
193
228
  requirement: !ruby/object:Gem::Requirement
229
+ none: false
194
230
  requirements:
195
231
  - - ! '>='
196
232
  - !ruby/object:Gem::Version
@@ -198,6 +234,7 @@ dependencies:
198
234
  type: :development
199
235
  prerelease: false
200
236
  version_requirements: !ruby/object:Gem::Requirement
237
+ none: false
201
238
  requirements:
202
239
  - - ! '>='
203
240
  - !ruby/object:Gem::Version
@@ -205,6 +242,7 @@ dependencies:
205
242
  - !ruby/object:Gem::Dependency
206
243
  name: reversible_data
207
244
  requirement: !ruby/object:Gem::Requirement
245
+ none: false
208
246
  requirements:
209
247
  - - ~>
210
248
  - !ruby/object:Gem::Version
@@ -212,6 +250,7 @@ dependencies:
212
250
  type: :development
213
251
  prerelease: false
214
252
  version_requirements: !ruby/object:Gem::Requirement
253
+ none: false
215
254
  requirements:
216
255
  - - ~>
217
256
  - !ruby/object:Gem::Version
@@ -219,6 +258,7 @@ dependencies:
219
258
  - !ruby/object:Gem::Dependency
220
259
  name: kaminari
221
260
  requirement: !ruby/object:Gem::Requirement
261
+ none: false
222
262
  requirements:
223
263
  - - ! '>='
224
264
  - !ruby/object:Gem::Version
@@ -226,6 +266,7 @@ dependencies:
226
266
  type: :development
227
267
  prerelease: false
228
268
  version_requirements: !ruby/object:Gem::Requirement
269
+ none: false
229
270
  requirements:
230
271
  - - ! '>='
231
272
  - !ruby/object:Gem::Version
@@ -238,7 +279,6 @@ executables: []
238
279
  extensions: []
239
280
  extra_rdoc_files: []
240
281
  files:
241
- - lib/rocket_pants.rb
242
282
  - lib/rocket_pants/active_record.rb
243
283
  - lib/rocket_pants/base.rb
244
284
  - lib/rocket_pants/cache_middleware.rb
@@ -264,27 +304,29 @@ files:
264
304
  - lib/rocket_pants/rspec_matchers.rb
265
305
  - lib/rocket_pants/tasks/rocket_pants.rake
266
306
  - lib/rocket_pants/test_helper.rb
307
+ - lib/rocket_pants.rb
267
308
  homepage: http://github.com/Sutto/rocket_pants
268
309
  licenses: []
269
- metadata: {}
270
310
  post_install_message:
271
311
  rdoc_options: []
272
312
  require_paths:
273
313
  - lib
274
314
  required_ruby_version: !ruby/object:Gem::Requirement
315
+ none: false
275
316
  requirements:
276
317
  - - ! '>='
277
318
  - !ruby/object:Gem::Version
278
319
  version: '0'
279
320
  required_rubygems_version: !ruby/object:Gem::Requirement
321
+ none: false
280
322
  requirements:
281
323
  - - ! '>='
282
324
  - !ruby/object:Gem::Version
283
325
  version: 1.3.6
284
326
  requirements: []
285
327
  rubyforge_project:
286
- rubygems_version: 2.3.0
328
+ rubygems_version: 1.8.23.2
287
329
  signing_key:
288
- specification_version: 4
330
+ specification_version: 3
289
331
  summary: JSON API love for Rails and ActionController
290
332
  test_files: []
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MDhmNzVjODAxNTU5ZjA2ZmFkMTRjOGViNTRhOWZjMmE0ZDJhMWI4Nw==
5
- data.tar.gz: !binary |-
6
- OTQxYTc0YmQyZDlmZmY5MDBjYzBiN2JmMTI3YzA3MWUwMjlhY2FhZg==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- NDUxN2RkODUyMTNkYjlkNzViMGU5Y2RjZmFhYzU2MzQ0ZWViMmVmMWZjOThk
10
- MTZmNzhkN2FmZmJmNDJkNDFlNTY2MTdiNTUwZTU2M2UyMzhjNmU2NzkwOTVl
11
- NTI0NTYyNjZkNjg5M2NhYTRiZmRjYjljOGI0OTI5NmI4NzE4YTc=
12
- data.tar.gz: !binary |-
13
- YWFlZWRkZTJhM2Q1ZmEwNDZhYzUwMTgwNDI1ODBjZmMyNTRkYzk2NDE3ZjJm
14
- MmUzOTcyZmNmNTIyM2E4MzAwYjFlM2I0Y2Q0ZWZjMjZkNGFmYzM1YjRlYWUx
15
- MzRmMTAwMDkxZDQyMTcwZDU2Yzc3ZTVlNDAxZDMxNzExNGQxYTE=