rspec_controller_helpers 0.0.4 → 0.0.5

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: bd32a83c2aef3899917f4cd11337cbc64f6e8b9a
4
- data.tar.gz: da04fb1ec5fd120de6fe43b3e788521e3ff61fd8
3
+ metadata.gz: c75eed773044ccd67ff45f52036e631c3f68111f
4
+ data.tar.gz: ade845f3b3f36b4576728fa7135ff3f2ea140a97
5
5
  SHA512:
6
- metadata.gz: a8464d1920a23fceb2429250f5b7cecfe48c8154107def64754596620bde9524f1a0dbc7432edd4d0e76405a7d02a4c54c33750d0628f377577fe89bd1041d25
7
- data.tar.gz: 2cdc8dd41c6eb863ed2c094f530bb8fbfe60d9f1e745a0f1c6879e91198ecdbe77f7dc676ee6ff95e14ab45210ba6f6d58149edc57dac84ea83691bc89856475
6
+ metadata.gz: 7e910b177a8519579bf97dc877933b5a45198299fa8a9a35d39c66ca788c76807b59e73a5f8d4dc037bf6282aaf3fdd4cba50e75ea5b592d24637e7c41013bfa
7
+ data.tar.gz: d14adbdbded188cfbb5fd1e99d5fd142c81c925fc19b96103318be7ef8de3775d07dad472aa51907e69c4cdc90609538f8a2b6328f546e745f682ff69c3238bb
@@ -10,6 +10,7 @@ RSpec.shared_examples_for 'a resourceful controller' do |model, raw_options|
10
10
  let(:model_name) { options[:model_name] || model.name.downcase.to_sym }
11
11
  let(:factory) { options[:factory] || model_name }
12
12
  let(:endpoints) { options[:only] - options[:except] }
13
+ let(:json_option) { options[:json_key] }
13
14
 
14
15
  let(:formats) do
15
16
  endpoints
@@ -18,7 +19,13 @@ RSpec.shared_examples_for 'a resourceful controller' do |model, raw_options|
18
19
  .merge(options[:formats])
19
20
  end
20
21
 
21
- let(:json_response) { JSON.parse(response.body) }
22
+ let(:json_response) do
23
+ if json_option.nil?
24
+ JSON.parse(response.body)
25
+ else
26
+ JSON.parse(response.body)[json_option.to_s].first
27
+ end
28
+ end
22
29
 
23
30
  describe "GET /<resource>" do
24
31
  let!(:objects) { create_list(factory, 3) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_controller_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Kniffin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-23 00:00:00.000000000 Z
11
+ date: 2016-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-rails