rspec_controller_helpers 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rspec_controller_helpers/resourceful.rb +8 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: c75eed773044ccd67ff45f52036e631c3f68111f
         | 
| 4 | 
            +
              data.tar.gz: ade845f3b3f36b4576728fa7135ff3f2ea140a97
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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)  | 
| 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 | 
            +
              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- | 
| 11 | 
            +
            date: 2016-03-14 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rspec-rails
         |