collection_json_rails 0.4.0 → 0.4.1

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: eb31df11f32736f6cce5ce2c68ee088019c46874
4
- data.tar.gz: 64cf9c3799b87bea2b839557828d9d7d6cc85959
3
+ metadata.gz: 288b63d473c62125ccf2e7c6a4e80484c7d74398
4
+ data.tar.gz: 775ecb12f1a7b150ec590108922ffacc031592cf
5
5
  SHA512:
6
- metadata.gz: 287d083888414a8d1266cba5296179133d92de928c4819c0239efa9c4084c2c35427bdfbd18d60f93f4610ffafbe9704f63136875a324bcb31c2d909426f178d
7
- data.tar.gz: 2b91d9015f5b61ad63ce93f4780ab911989efad09e5739d2fb6ffe9a8083eb5523bd3ea7ca03a9f53897f36e37f72c2f953e4ba15feaaba9e752c3e28e6e3b9f
6
+ metadata.gz: 193a143cd2b270066c5598bb8a2c0b6bdb47b4e469a470a3a13b91ba9b1a1353d4a17e5b48633fe2b3a5f2dcd643279a76301befc24bc5d1e6a9577902c13b70
7
+ data.tar.gz: 0e2eac5476864c51c6119da0d06d02559012ee18ecb0037be4399c38d42b52016602153257461cd5e5ea95f8ce20b0a46acb81facce04c0362e7524af4a9fdc8
@@ -47,7 +47,7 @@ module CollectionJson::Rails
47
47
  end
48
48
 
49
49
  def is_collection_json?(hash)
50
- hash.key?(:collection)
50
+ hash.key?(:collection) if hash.respond_to? :key
51
51
  end
52
52
  end
53
53
  end
@@ -1,5 +1,5 @@
1
1
  module CollectionJson
2
2
  module Rails
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
@@ -5,6 +5,10 @@ class PostsController < ActionController::Base
5
5
  render json: { my_hash: "should be jsonified too" }
6
6
  end
7
7
 
8
+ def empty_array
9
+ render json: []
10
+ end
11
+
8
12
  def without_json
9
13
  render nothing: true
10
14
  end
@@ -19,6 +23,13 @@ class TestRender < ActionController::TestCase
19
23
  assert_equal "application/vnd.collection+json", response.content_type
20
24
  end
21
25
 
26
+ def test_that_an_empty_array_responds_with_success
27
+ get :empty_array
28
+
29
+ assert_response :ok
30
+ assert_equal Mime::JSON, response.content_type
31
+ end
32
+
22
33
  def test_that_objects_without_serializer_are_rendered_as_plain_json
23
34
  get :without_serializer
24
35
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collection_json_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carles Jove i Buxeda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-17 00:00:00.000000000 Z
11
+ date: 2015-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: collection_json_serializer