acfs 1.6.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +144 -115
- data/README.md +33 -41
- data/acfs.gemspec +9 -10
- data/lib/acfs/adapter/typhoeus.rb +6 -4
- data/lib/acfs/collections/paginatable.rb +11 -11
- data/lib/acfs/configuration.rb +13 -3
- data/lib/acfs/errors.rb +7 -7
- data/lib/acfs/global.rb +4 -4
- data/lib/acfs/location.rb +2 -2
- data/lib/acfs/operation.rb +1 -1
- data/lib/acfs/request/callbacks.rb +1 -1
- data/lib/acfs/request.rb +1 -1
- data/lib/acfs/resource/attributes/uuid.rb +2 -2
- data/lib/acfs/resource/attributes.rb +1 -1
- data/lib/acfs/resource/dirty.rb +1 -1
- data/lib/acfs/resource/locatable.rb +2 -2
- data/lib/acfs/resource/operational.rb +4 -4
- data/lib/acfs/resource/query_methods.rb +5 -5
- data/lib/acfs/response/status.rb +1 -1
- data/lib/acfs/runner.rb +15 -15
- data/lib/acfs/service/middleware.rb +2 -2
- data/lib/acfs/singleton_resource.rb +2 -2
- data/lib/acfs/stub.rb +35 -30
- data/lib/acfs/version.rb +3 -3
- data/lib/acfs/yard.rb +1 -0
- data/spec/acfs/adapter/typhoeus_spec.rb +4 -4
- data/spec/acfs/collection_spec.rb +66 -41
- data/spec/acfs/configuration_spec.rb +22 -12
- data/spec/acfs/global_spec.rb +14 -12
- data/spec/acfs/location_spec.rb +1 -1
- data/spec/acfs/middleware/json_spec.rb +9 -9
- data/spec/acfs/middleware/{msgpack_spec.rb → message_pack_spec.rb} +7 -7
- data/spec/acfs/operation_spec.rb +4 -3
- data/spec/acfs/request/callbacks_spec.rb +19 -10
- data/spec/acfs/request_spec.rb +15 -19
- data/spec/acfs/resource/attributes/boolean_spec.rb +32 -32
- data/spec/acfs/resource/attributes/date_time_spec.rb +17 -9
- data/spec/acfs/resource/attributes/dict_spec.rb +16 -10
- data/spec/acfs/resource/attributes/float_spec.rb +21 -11
- data/spec/acfs/resource/attributes/integer_spec.rb +11 -6
- data/spec/acfs/resource/attributes/list_spec.rb +13 -8
- data/spec/acfs/resource/attributes/uuid_spec.rb +14 -8
- data/spec/acfs/resource/attributes_spec.rb +33 -32
- data/spec/acfs/resource/dirty_spec.rb +7 -4
- data/spec/acfs/resource/initialization_spec.rb +4 -5
- data/spec/acfs/resource/loadable_spec.rb +3 -1
- data/spec/acfs/resource/locatable_spec.rb +24 -18
- data/spec/acfs/resource/{persistance_spec.rb → persistence_spec.rb} +119 -87
- data/spec/acfs/resource/query_methods_spec.rb +144 -111
- data/spec/acfs/resource/validation_spec.rb +34 -27
- data/spec/acfs/response/formats_spec.rb +8 -8
- data/spec/acfs/response/status_spec.rb +16 -9
- data/spec/acfs/runner_spec.rb +22 -20
- data/spec/acfs/service/middleware_spec.rb +3 -3
- data/spec/acfs/service_spec.rb +5 -4
- data/spec/acfs/singleton_resource_spec.rb +2 -1
- data/spec/acfs/stub_spec.rb +64 -65
- data/spec/acfs_spec.rb +112 -94
- data/spec/spec_helper.rb +10 -6
- data/spec/support/hash.rb +1 -1
- data/spec/support/response.rb +2 -2
- data/spec/support/service.rb +1 -1
- data/spec/support/shared/find_callbacks.rb +14 -10
- data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-67802c9d1826/LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-67802c9d1826/README.md +23 -0
- data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-67802c9d1826/rubocop-config.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.1/CHANGELOG.md +205 -0
- data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.1/README.rdoc +57 -0
- data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.1/CHANGELOG.md +67 -0
- data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.1/README.rdoc +40 -0
- data/vendor/bundle/ruby/3.4.0/gems/activemodel-8.0.1/CHANGELOG.md +110 -0
- data/vendor/bundle/ruby/3.4.0/gems/activemodel-8.0.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/activemodel-8.0.1/README.rdoc +266 -0
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.1/CHANGELOG.md +157 -0
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.1/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.1/README.rdoc +40 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/CHANGELOG.md +301 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/LICENSE.txt +202 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/README.md +121 -0
- data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/addressable.gemspec +28 -0
- data/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/README.md +243 -0
- data/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/appraisal.gemspec +29 -0
- data/vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/README.md +48 -0
- data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.0/README.md +138 -0
- data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.0/benchmark.gemspec +32 -0
- data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.1.9/LICENSE +56 -0
- data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.1.9/bigdecimal.gemspec +57 -0
- data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/README.md +258 -0
- data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/builder.gemspec +49 -0
- data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/CHANGELOG.md +603 -0
- data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/LICENSE.txt +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/README.md +407 -0
- data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.0/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.0/README.md +167 -0
- data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.0/connection_pool.gemspec +24 -0
- data/vendor/bundle/ruby/3.4.0/gems/crack-1.0.0/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/crack-1.0.0/README.md +43 -0
- data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/LICENSE +18 -0
- data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/README.md +192 -0
- data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/crass.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/gems/diff-lcs-1.5.1/License.md +41 -0
- data/vendor/bundle/ruby/3.4.0/gems/diff-lcs-1.5.1/README.rdoc +84 -0
- data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.1/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.1/drb.gemspec +41 -0
- data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/CHANGELOG +111 -0
- data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/README.rdoc +151 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/CHANGELOG.md +375 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/README.md +118 -0
- data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/ethon.gemspec +26 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/CHANGELOG.md +465 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/LICENSE +24 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/LICENSE.SPECS +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/README.md +137 -0
- data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/ffi.gemspec +42 -0
- data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/LICENSE +19 -0
- data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/README.md +298 -0
- data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/changelog.md +119 -0
- data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/hashdiff.gemspec +39 -0
- data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.6/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.6/README.md +127 -0
- data/vendor/bundle/ruby/3.4.0/gems/json-2.9.1/README.md +195 -0
- data/vendor/bundle/ruby/3.4.0/gems/json-2.9.1/json.gemspec +64 -0
- data/vendor/bundle/ruby/3.4.0/gems/logger-1.6.5/README.md +104 -0
- data/vendor/bundle/ruby/3.4.0/gems/logger-1.6.5/logger.gemspec +28 -0
- data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.0/CHANGELOG.md +591 -0
- data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.0/MIT-LICENSE.txt +23 -0
- data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.0/README.md +410 -0
- data/vendor/bundle/ruby/3.4.0/gems/minitest-5.25.4/README.rdoc +835 -0
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/CHANGELOG.md +275 -0
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/LICENSE.md +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/README.md +121 -0
- data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.1-x86_64-linux-gnu/LICENSE-DEPENDENCIES.md +2224 -0
- data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.1-x86_64-linux-gnu/LICENSE.md +9 -0
- data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.1-x86_64-linux-gnu/README.md +293 -0
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.1/CHANGELOG.md +491 -0
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.1/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.1/README.md +222 -0
- data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/ChangeLog +846 -0
- data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
- data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/README.rdoc +60 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.8/CHANGELOG.md +998 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.8/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.8/README.md +328 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-session-2.1.0/license.md +72 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-session-2.1.0/readme.md +47 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-test-2.2.0/MIT-LICENSE.txt +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/rack-test-2.2.0/README.md +139 -0
- data/vendor/bundle/ruby/3.4.0/gems/rails-dom-testing-2.2.0/MIT-LICENSE +23 -0
- data/vendor/bundle/ruby/3.4.0/gems/rails-dom-testing-2.2.0/README.md +91 -0
- data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/CHANGELOG.md +255 -0
- data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/MIT-LICENSE +23 -0
- data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/README.md +267 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/README.rdoc +155 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/rake.gemspec +101 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/LICENSE +21 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/README.md +107 -0
- data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/rake-release.gemspec +23 -0
- data/vendor/bundle/ruby/3.4.0/gems/rexml-3.4.0/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/rexml-3.4.0/README.md +57 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-3.13.0/LICENSE.md +27 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-3.13.0/README.md +47 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/Changelog.md +68 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/LICENSE.txt +27 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/README.md +76 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/rspec-collection_matchers.gemspec +33 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.2/Changelog.md +2415 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.2/LICENSE.md +26 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.2/README.md +389 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.3/Changelog.md +1352 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.3/LICENSE.md +25 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.3/README.md +326 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/Changelog.md +73 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/LICENSE.txt +27 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/README.md +104 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/rspec-its.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.2/Changelog.md +1299 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.2/LICENSE.md +25 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.2/README.md +465 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/Changelog.md +408 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/LICENSE.md +23 -0
- data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/README.md +40 -0
- data/vendor/bundle/ruby/3.4.0/gems/securerandom-0.4.1/README.md +72 -0
- data/vendor/bundle/ruby/3.4.0/gems/thor-1.3.2/LICENSE.md +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/thor-1.3.2/README.md +45 -0
- data/vendor/bundle/ruby/3.4.0/gems/thor-1.3.2/thor.gemspec +33 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/CHANGELOG.md +410 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/LICENSE +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/README.md +588 -0
- data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/typhoeus.gemspec +25 -0
- data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/LICENSE +19 -0
- data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/README.md +406 -0
- data/vendor/bundle/ruby/3.4.0/gems/uri-1.0.2/README.md +55 -0
- data/vendor/bundle/ruby/3.4.0/gems/useragent-0.16.11/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/useragent-0.16.11/README.md +42 -0
- data/vendor/bundle/ruby/3.4.0/gems/webmock-3.24.0/CHANGELOG.md +2104 -0
- data/vendor/bundle/ruby/3.4.0/gems/webmock-3.24.0/LICENSE +20 -0
- data/vendor/bundle/ruby/3.4.0/gems/webmock-3.24.0/README.md +1222 -0
- data/vendor/bundle/ruby/3.4.0/specifications/actionpack-8.0.1.gemspec +36 -0
- data/vendor/bundle/ruby/3.4.0/specifications/actionview-8.0.1.gemspec +33 -0
- data/vendor/bundle/ruby/3.4.0/specifications/activemodel-8.0.1.gemspec +26 -0
- data/vendor/bundle/ruby/3.4.0/specifications/activesupport-8.0.1.gemspec +38 -0
- data/vendor/bundle/ruby/3.4.0/specifications/addressable-2.8.7.gemspec +30 -0
- data/vendor/bundle/ruby/3.4.0/specifications/appraisal-2.5.0.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/specifications/base64-0.2.0.gemspec +23 -0
- data/vendor/bundle/ruby/3.4.0/specifications/benchmark-0.4.0.gemspec +23 -0
- data/vendor/bundle/ruby/3.4.0/specifications/bigdecimal-3.1.9.gemspec +25 -0
- data/vendor/bundle/ruby/3.4.0/specifications/builder-3.3.0.gemspec +22 -0
- data/vendor/bundle/ruby/3.4.0/specifications/concurrent-ruby-1.3.5.gemspec +24 -0
- data/vendor/bundle/ruby/3.4.0/specifications/connection_pool-2.5.0.gemspec +28 -0
- data/vendor/bundle/ruby/3.4.0/specifications/crack-1.0.0.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/crass-1.0.6.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/diff-lcs-1.5.1.gemspec +37 -0
- data/vendor/bundle/ruby/3.4.0/specifications/drb-2.2.1.gemspec +22 -0
- data/vendor/bundle/ruby/3.4.0/specifications/erubi-1.13.1.gemspec +29 -0
- data/vendor/bundle/ruby/3.4.0/specifications/ethon-0.16.0.gemspec +24 -0
- data/vendor/bundle/ruby/3.4.0/specifications/ffi-1.17.1-x86_64-linux-gnu.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/specifications/hashdiff-1.1.2.gemspec +30 -0
- data/vendor/bundle/ruby/3.4.0/specifications/i18n-1.14.6.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/json-2.9.1.gemspec +0 -0
- data/vendor/bundle/ruby/3.4.0/specifications/logger-1.6.5.gemspec +22 -0
- data/vendor/bundle/ruby/3.4.0/specifications/loofah-2.24.0.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/minitest-5.25.4.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/specifications/multi_json-1.15.0.gemspec +26 -0
- data/vendor/bundle/ruby/3.4.0/specifications/nokogiri-1.18.1-x86_64-linux-gnu.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/specifications/public_suffix-6.0.1.gemspec +24 -0
- data/vendor/bundle/ruby/3.4.0/specifications/racc-1.8.1.gemspec +28 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rack-3.1.8.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rack-session-2.1.0.gemspec +30 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rack-test-2.2.0.gemspec +29 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rails-dom-testing-2.2.0.gemspec +28 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rails-html-sanitizer-1.6.2.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rake-13.2.1.gemspec +26 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rake-release-1.3.0.gemspec +26 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rexml-3.4.0.gemspec +25 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-3.13.0.gemspec +31 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-collection_matchers-1.2.1.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-core-3.13.2.gemspec +39 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-expectations-3.13.3.gemspec +33 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-its-2.0.0.gemspec +27 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-mocks-3.13.2.gemspec +33 -0
- data/vendor/bundle/ruby/3.4.0/specifications/rspec-support-3.13.2.gemspec +29 -0
- data/vendor/bundle/ruby/3.4.0/specifications/securerandom-0.4.1.gemspec +23 -0
- data/vendor/bundle/ruby/3.4.0/specifications/thor-1.3.2.gemspec +28 -0
- data/vendor/bundle/ruby/3.4.0/specifications/typhoeus-1.4.1.gemspec +24 -0
- data/vendor/bundle/ruby/3.4.0/specifications/tzinfo-2.0.6.gemspec +30 -0
- data/vendor/bundle/ruby/3.4.0/specifications/uri-1.0.2.gemspec +23 -0
- data/vendor/bundle/ruby/3.4.0/specifications/useragent-0.16.11.gemspec +25 -0
- data/vendor/bundle/ruby/3.4.0/specifications/webmock-3.24.0.gemspec +45 -0
- metadata +208 -70
data/lib/acfs/stub.rb
CHANGED
@@ -21,11 +21,11 @@ module Acfs
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def accept?(
|
25
|
-
return opts[:with].call(
|
24
|
+
def accept?(operation)
|
25
|
+
return opts[:with].call(operation) if opts[:with].respond_to?(:call)
|
26
26
|
|
27
|
-
params =
|
28
|
-
data =
|
27
|
+
params = operation.full_params.stringify_keys
|
28
|
+
data = operation.data.stringify_keys
|
29
29
|
with = opts[:with]
|
30
30
|
|
31
31
|
return true if with.nil?
|
@@ -33,10 +33,10 @@ module Acfs
|
|
33
33
|
case opts.fetch(:match, :inclusion)
|
34
34
|
when :legacy
|
35
35
|
return true if with.empty? && params.empty? && data.empty?
|
36
|
-
if with.
|
36
|
+
if with.compact == params.compact
|
37
37
|
return true
|
38
38
|
end
|
39
|
-
if with.
|
39
|
+
if with.compact == data.compact
|
40
40
|
return true
|
41
41
|
end
|
42
42
|
|
@@ -58,22 +58,25 @@ module Acfs
|
|
58
58
|
count.nil? ? calls.any? : calls.size == count
|
59
59
|
end
|
60
60
|
|
61
|
-
def call(
|
62
|
-
calls <<
|
61
|
+
def call(operation)
|
62
|
+
calls << operation
|
63
63
|
|
64
64
|
err = opts[:raise]
|
65
65
|
data = opts[:return]
|
66
66
|
|
67
67
|
if err
|
68
|
-
raise_error
|
68
|
+
raise_error(operation, err, opts[:return])
|
69
69
|
elsif data
|
70
|
-
data = data.call(
|
70
|
+
data = data.call(operation) if data.respond_to?(:call)
|
71
71
|
|
72
|
-
response = Acfs::Response.new
|
72
|
+
response = Acfs::Response.new(
|
73
|
+
operation.request,
|
73
74
|
headers: opts[:headers] || {},
|
74
75
|
status: opts[:status] || 200,
|
75
|
-
data: data || {}
|
76
|
-
|
76
|
+
data: data || {},
|
77
|
+
)
|
78
|
+
|
79
|
+
operation.call(data, response)
|
77
80
|
else
|
78
81
|
raise ArgumentError.new 'Unsupported stub.'
|
79
82
|
end
|
@@ -81,15 +84,17 @@ module Acfs
|
|
81
84
|
|
82
85
|
private
|
83
86
|
|
84
|
-
def raise_error(
|
87
|
+
def raise_error(operation, name, data)
|
85
88
|
raise name if name.is_a? Class
|
86
89
|
|
87
90
|
data.stringify_keys! if data.respond_to?(:stringify_keys!)
|
88
91
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
92
|
+
operation.handle_failure(
|
93
|
+
::Acfs::Response.new(
|
94
|
+
operation.request,
|
95
|
+
status: Rack::Utils.status_code(name),
|
96
|
+
data: data,
|
97
|
+
),
|
93
98
|
)
|
94
99
|
end
|
95
100
|
|
@@ -97,7 +102,7 @@ module Acfs
|
|
97
102
|
# Stub a resource with given handler block. An already created handler
|
98
103
|
# for same resource class will be overridden.
|
99
104
|
#
|
100
|
-
def resource(klass, action, opts = {}, &
|
105
|
+
def resource(klass, action, opts = {}, &)
|
101
106
|
action = action.to_sym
|
102
107
|
unless ACTIONS.include? action
|
103
108
|
raise ArgumentError.new "Unknown action `#{action}`."
|
@@ -140,35 +145,35 @@ module Acfs
|
|
140
145
|
@stubs ||= {}
|
141
146
|
end
|
142
147
|
|
143
|
-
def stub_for(
|
144
|
-
return false unless (classes = stubs[
|
145
|
-
return false unless (stubs = classes[
|
148
|
+
def stub_for(operation)
|
149
|
+
return false unless (classes = stubs[operation.resource])
|
150
|
+
return false unless (stubs = classes[operation.action])
|
146
151
|
|
147
|
-
accepted_stubs = stubs.select {|stub| stub.accept?
|
152
|
+
accepted_stubs = stubs.select {|stub| stub.accept?(operation) }
|
148
153
|
|
149
154
|
if accepted_stubs.size > 1
|
150
|
-
raise AmbiguousStubError.new
|
155
|
+
raise AmbiguousStubError.new(stubs: accepted_stubs, operation: operation)
|
151
156
|
end
|
152
157
|
|
153
158
|
accepted_stubs.first
|
154
159
|
end
|
155
160
|
|
156
|
-
def stubbed(
|
157
|
-
stub = stub_for
|
161
|
+
def stubbed(operation)
|
162
|
+
stub = stub_for(operation)
|
158
163
|
unless stub
|
159
164
|
return false if allow_requests?
|
160
165
|
|
161
166
|
raise RealRequestsNotAllowedError.new <<~ERROR
|
162
|
-
No stub found for `#{
|
163
|
-
with params `#{
|
164
|
-
and id `#{
|
167
|
+
No stub found for `#{operation.action}' on `#{operation.resource.name}' \
|
168
|
+
with params `#{operation.full_params.inspect}', data `#{operation.data.inspect}' \
|
169
|
+
and id `#{operation.id}'.
|
165
170
|
|
166
171
|
Available stubs:
|
167
172
|
#{pretty_print}
|
168
173
|
ERROR
|
169
174
|
end
|
170
175
|
|
171
|
-
stub.call
|
176
|
+
stub.call(operation)
|
172
177
|
true
|
173
178
|
end
|
174
179
|
|
data/lib/acfs/version.rb
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
module Acfs
|
4
4
|
module VERSION
|
5
|
-
MAJOR =
|
6
|
-
MINOR =
|
5
|
+
MAJOR = 2
|
6
|
+
MINOR = 0
|
7
7
|
PATCH = 0
|
8
8
|
STAGE = nil
|
9
9
|
|
10
|
-
STRING = [MAJOR, MINOR, PATCH, STAGE].
|
10
|
+
STRING = [MAJOR, MINOR, PATCH, STAGE].compact.join('.')
|
11
11
|
|
12
12
|
def self.to_s
|
13
13
|
STRING
|
data/lib/acfs/yard.rb
CHANGED
@@ -20,7 +20,7 @@ describe Acfs::Adapter::Typhoeus do
|
|
20
20
|
adapter.queue request2
|
21
21
|
|
22
22
|
expect { adapter.start }.to raise_error(/404-[12]/)
|
23
|
-
expect { adapter.start }.
|
23
|
+
expect { adapter.start }.not_to raise_error
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'raises timeout' do
|
@@ -29,7 +29,7 @@ describe Acfs::Adapter::Typhoeus do
|
|
29
29
|
request = Acfs::Request.new 'http://example.org'
|
30
30
|
adapter.queue request
|
31
31
|
|
32
|
-
expect { adapter.run(request) }.to raise_error(
|
32
|
+
expect { adapter.run(request) }.to raise_error(Acfs::TimeoutError) do |err|
|
33
33
|
expect(err.message).to eq 'Timeout reached: GET http://example.org'
|
34
34
|
end
|
35
35
|
end
|
@@ -40,7 +40,7 @@ describe Acfs::Adapter::Typhoeus do
|
|
40
40
|
request = Acfs::Request.new 'http://should-never-exists.example.org'
|
41
41
|
adapter.queue request
|
42
42
|
|
43
|
-
expect { adapter.run(request) }.to raise_error(
|
43
|
+
expect { adapter.run(request) }.to raise_error(Acfs::RequestError) do |err|
|
44
44
|
expect(err.message).to eq 'Couldn\'t resolve host name: GET http://should-never-exists.example.org'
|
45
45
|
end
|
46
46
|
end
|
@@ -48,7 +48,7 @@ describe Acfs::Adapter::Typhoeus do
|
|
48
48
|
it 'passes arguments to typhoeus hydra' do
|
49
49
|
value = {key: 1, key2: 2}
|
50
50
|
|
51
|
-
expect(
|
51
|
+
expect(Typhoeus::Hydra).to receive(:new).with(value)
|
52
52
|
|
53
53
|
described_class.new(**value).send :hydra
|
54
54
|
end
|
@@ -6,149 +6,174 @@ describe Acfs::Collection do
|
|
6
6
|
let(:model) { MyUser }
|
7
7
|
|
8
8
|
describe 'Pagination' do
|
9
|
+
subject do
|
10
|
+
Acfs.run
|
11
|
+
collection
|
12
|
+
end
|
13
|
+
|
9
14
|
let(:params) { {} }
|
10
15
|
let!(:collection) { model.all params }
|
11
16
|
|
12
|
-
subject { Acfs.run; collection }
|
13
|
-
|
14
17
|
context 'without explicit page parameter' do
|
15
18
|
before do
|
16
19
|
stub_request(:get, 'http://users.example.org/users')
|
17
20
|
.to_return response([{id: 1, name: 'Anon', age: 12, born_at: 'Berlin'}],
|
18
21
|
headers: {
|
19
22
|
'X-Total-Pages' => '2',
|
20
|
-
'X-Total-Count' => '10'
|
21
|
-
})
|
23
|
+
'X-Total-Count' => '10',
|
24
|
+
},)
|
22
25
|
end
|
23
26
|
|
24
|
-
its(:total_pages) {
|
25
|
-
its(:current_page) {
|
26
|
-
its(:total_count) {
|
27
|
+
its(:total_pages) { is_expected.to eq 2 }
|
28
|
+
its(:current_page) { is_expected.to eq 1 }
|
29
|
+
its(:total_count) { is_expected.to eq 10 }
|
27
30
|
end
|
28
31
|
|
29
32
|
context 'with page parameter' do
|
30
33
|
let(:params) { {page: 2} }
|
34
|
+
|
31
35
|
before do
|
32
36
|
stub_request(:get, 'http://users.example.org/users?page=2')
|
33
37
|
.to_return response([{id: 1, name: 'Anon', age: 12, born_at: 'Berlin'}],
|
34
38
|
headers: {
|
35
39
|
'X-Total-Pages' => '2',
|
36
|
-
'X-Total-Count' => '10'
|
37
|
-
})
|
40
|
+
'X-Total-Count' => '10',
|
41
|
+
},)
|
38
42
|
end
|
39
43
|
|
40
|
-
its(:total_pages) {
|
41
|
-
its(:current_page) {
|
42
|
-
its(:total_count) {
|
44
|
+
its(:total_pages) { is_expected.to eq 2 }
|
45
|
+
its(:current_page) { is_expected.to eq 2 }
|
46
|
+
its(:total_count) { is_expected.to eq 10 }
|
43
47
|
end
|
44
48
|
|
45
49
|
context 'with non-numerical page parameter' do
|
46
50
|
let(:params) { {page: 'e546f5'} }
|
51
|
+
|
47
52
|
before do
|
48
53
|
stub_request(:get, 'http://users.example.org/users?page=e546f5')
|
49
54
|
.to_return response([{id: 1, name: 'Anon', age: 12, born_at: 'Berlin'}],
|
50
55
|
headers: {
|
51
56
|
'X-Total-Pages' => '2',
|
52
|
-
'X-Total-Count' => '10'
|
53
|
-
})
|
57
|
+
'X-Total-Count' => '10',
|
58
|
+
},)
|
54
59
|
end
|
55
60
|
|
56
|
-
its(:total_pages) {
|
57
|
-
its(:current_page) {
|
58
|
-
its(:total_count) {
|
61
|
+
its(:total_pages) { is_expected.to eq 2 }
|
62
|
+
its(:current_page) { is_expected.to eq 'e546f5' }
|
63
|
+
its(:total_count) { is_expected.to eq 10 }
|
59
64
|
end
|
60
65
|
|
61
66
|
describe '#next_page' do
|
67
|
+
subject(:request_page) do
|
68
|
+
Acfs.run
|
69
|
+
collection.next_page
|
70
|
+
end
|
71
|
+
|
62
72
|
before do
|
63
73
|
stub_request(:get, 'http://users.example.org/users')
|
64
74
|
.to_return response([{id: 1, name: 'Anon', age: 12, born_at: 'Berlin'}],
|
65
75
|
headers: {
|
66
76
|
'X-Total-Pages' => '2',
|
67
|
-
'Link' => '<http://users.example.org/users?page=2>; rel="next"'
|
68
|
-
})
|
77
|
+
'Link' => '<http://users.example.org/users?page=2>; rel="next"',
|
78
|
+
},)
|
69
79
|
end
|
80
|
+
|
70
81
|
let!(:req) do
|
71
82
|
stub_request(:get, 'http://users.example.org/users?page=2').to_return response([])
|
72
83
|
end
|
73
84
|
let!(:collection) { model.all }
|
74
|
-
subject { Acfs.run; collection.next_page }
|
75
85
|
|
76
|
-
it {
|
86
|
+
it { is_expected.to be_a Acfs::Collection }
|
77
87
|
|
78
|
-
it '
|
79
|
-
|
88
|
+
it 'has fetched page 2' do
|
89
|
+
request_page
|
80
90
|
Acfs.run
|
81
91
|
expect(req).to have_been_requested
|
82
92
|
end
|
83
93
|
end
|
84
94
|
|
85
95
|
describe '#prev_page' do
|
96
|
+
subject(:request_page) do
|
97
|
+
Acfs.run
|
98
|
+
collection.prev_page
|
99
|
+
end
|
100
|
+
|
86
101
|
before do
|
87
102
|
stub_request(:get, 'http://users.example.org/users?page=2')
|
88
103
|
.to_return response([{id: 2, name: 'Anno', age: 1604, born_at: 'Santa Maria'}],
|
89
104
|
headers: {
|
90
105
|
'X-Total-Pages' => '2',
|
91
|
-
'Link' => '<http://users.example.org/users>; rel="prev"'
|
92
|
-
})
|
106
|
+
'Link' => '<http://users.example.org/users>; rel="prev"',
|
107
|
+
},)
|
93
108
|
end
|
109
|
+
|
94
110
|
let!(:req) do
|
95
111
|
stub_request(:get, 'http://users.example.org/users').to_return response([])
|
96
112
|
end
|
97
113
|
let!(:collection) { model.all page: 2 }
|
98
|
-
subject { Acfs.run; collection.prev_page }
|
99
114
|
|
100
|
-
it {
|
115
|
+
it { is_expected.to be_a Acfs::Collection }
|
101
116
|
|
102
|
-
it '
|
103
|
-
|
117
|
+
it 'has fetched page 1' do
|
118
|
+
request_page
|
104
119
|
Acfs.run
|
105
120
|
expect(req).to have_been_requested
|
106
121
|
end
|
107
122
|
end
|
108
123
|
|
109
124
|
describe '#first_page' do
|
125
|
+
subject(:request_page) do
|
126
|
+
Acfs.run
|
127
|
+
collection.first_page
|
128
|
+
end
|
129
|
+
|
110
130
|
before do
|
111
131
|
stub_request(:get, 'http://users.example.org/users?page=2')
|
112
132
|
.to_return response([{id: 2, name: 'Anno', age: 1604, born_at: 'Santa Maria'}],
|
113
133
|
headers: {
|
114
134
|
'X-Total-Pages' => '2',
|
115
|
-
'Link' => '<http://users.example.org/users>; rel="first"'
|
116
|
-
})
|
135
|
+
'Link' => '<http://users.example.org/users>; rel="first"',
|
136
|
+
},)
|
117
137
|
end
|
138
|
+
|
118
139
|
let!(:req) do
|
119
140
|
stub_request(:get, 'http://users.example.org/users').to_return response([])
|
120
141
|
end
|
121
142
|
let!(:collection) { model.all page: 2 }
|
122
|
-
subject { Acfs.run; collection.first_page }
|
123
143
|
|
124
|
-
it {
|
144
|
+
it { is_expected.to be_a Acfs::Collection }
|
125
145
|
|
126
|
-
it '
|
127
|
-
|
146
|
+
it 'has fetched page 1' do
|
147
|
+
request_page
|
128
148
|
Acfs.run
|
129
149
|
expect(req).to have_been_requested
|
130
150
|
end
|
131
151
|
end
|
132
152
|
|
133
153
|
describe '#last_page' do
|
154
|
+
subject(:request_page) do
|
155
|
+
Acfs.run
|
156
|
+
collection.last_page
|
157
|
+
end
|
158
|
+
|
134
159
|
before do
|
135
160
|
stub_request(:get, 'http://users.example.org/users?page=2')
|
136
161
|
.to_return response([{id: 2, name: 'Anno', age: 1604, born_at: 'Santa Maria'}],
|
137
162
|
headers: {
|
138
163
|
'X-Total-Pages' => '2',
|
139
|
-
'Link' => '<http://users.example.org/users?page=12>; rel="last"'
|
140
|
-
})
|
164
|
+
'Link' => '<http://users.example.org/users?page=12>; rel="last"',
|
165
|
+
},)
|
141
166
|
end
|
167
|
+
|
142
168
|
let!(:req) do
|
143
169
|
stub_request(:get, 'http://users.example.org/users?page=12').to_return response([])
|
144
170
|
end
|
145
171
|
let!(:collection) { model.all page: 2 }
|
146
|
-
subject { Acfs.run; collection.last_page }
|
147
172
|
|
148
|
-
it {
|
173
|
+
it { is_expected.to be_a Acfs::Collection }
|
149
174
|
|
150
|
-
it '
|
151
|
-
|
175
|
+
it 'has fetched page 1' do
|
176
|
+
request_page
|
152
177
|
Acfs.run
|
153
178
|
expect(req).to have_been_requested
|
154
179
|
end
|
@@ -4,11 +4,16 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe Acfs::Configuration do
|
6
6
|
let(:cfg) { Acfs::Configuration.new }
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
around do |example|
|
9
|
+
configuration = Acfs::Configuration.current.dup
|
10
|
+
example.run
|
11
|
+
ensure
|
12
|
+
Acfs::Configuration.set(configuration)
|
13
|
+
end
|
9
14
|
|
10
15
|
describe 'Acfs.configure' do
|
11
|
-
it '
|
16
|
+
it 'invokes configure on current configuration' do
|
12
17
|
expect(Acfs::Configuration.current).to receive(:configure).once.and_call_original
|
13
18
|
|
14
19
|
Acfs.configure do |c|
|
@@ -18,26 +23,31 @@ describe Acfs::Configuration do
|
|
18
23
|
end
|
19
24
|
|
20
25
|
describe '.load' do
|
21
|
-
it '
|
26
|
+
it 'is able to load YAML' do
|
22
27
|
cfg.configure do
|
23
28
|
load 'spec/fixtures/config.yml'
|
24
29
|
end
|
25
30
|
|
26
|
-
expect(cfg.locate(UserService).to_s).to
|
27
|
-
expect(cfg.locate(CommentService).to_s).to
|
31
|
+
expect(cfg.locate(UserService).to_s).to eq 'http://localhost:3001/'
|
32
|
+
expect(cfg.locate(CommentService).to_s).to eq 'http://localhost:3002/'
|
28
33
|
end
|
29
34
|
|
30
35
|
context 'with RACK_ENV' do
|
31
|
-
|
32
|
-
|
36
|
+
around do |example|
|
37
|
+
env = ENV.fetch('RACK_ENV', nil)
|
38
|
+
ENV['RACK_ENV'] = 'production'
|
39
|
+
example.run
|
40
|
+
ensure
|
41
|
+
ENV['RACK_ENV'] = env
|
42
|
+
end
|
33
43
|
|
34
|
-
it '
|
44
|
+
it 'loads ENV block' do
|
35
45
|
cfg.configure do
|
36
46
|
load 'spec/fixtures/config.yml'
|
37
47
|
end
|
38
48
|
|
39
|
-
expect(cfg.locate(UserService).to_s).to
|
40
|
-
expect(cfg.locate(CommentService).to_s).to
|
49
|
+
expect(cfg.locate(UserService).to_s).to eq 'http://user.example.org/'
|
50
|
+
expect(cfg.locate(CommentService).to_s).to eq 'http://comment.example.org/'
|
41
51
|
end
|
42
52
|
end
|
43
53
|
end
|
@@ -45,7 +55,7 @@ describe Acfs::Configuration do
|
|
45
55
|
describe '#adapter' do
|
46
56
|
let(:object) { Object.new }
|
47
57
|
|
48
|
-
it '
|
58
|
+
it 'is a accessor' do
|
49
59
|
cfg.adapter = object
|
50
60
|
expect(cfg.adapter).to eq object
|
51
61
|
end
|
data/spec/acfs/global_spec.rb
CHANGED
@@ -12,11 +12,11 @@ class NotificationCollector
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
describe
|
16
|
-
let(:adapter) {
|
15
|
+
describe Acfs::Global do
|
16
|
+
let(:adapter) { NullAdapter.new }
|
17
17
|
let(:runner) { double 'runner' }
|
18
18
|
let(:collector) { NotificationCollector.new }
|
19
|
-
let(:acfs) { Object.new.tap {|o| o.extend
|
19
|
+
let(:acfs) { Object.new.tap {|o| o.extend Acfs::Global } }
|
20
20
|
|
21
21
|
describe 'instrumentation' do
|
22
22
|
before do
|
@@ -26,9 +26,10 @@ describe ::Acfs::Global do
|
|
26
26
|
|
27
27
|
describe '#run' do
|
28
28
|
before do
|
29
|
-
|
29
|
+
ActiveSupport::Notifications.subscribe 'acfs.run', collector
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
|
+
it 'triggers event' do
|
32
33
|
Acfs.run
|
33
34
|
expect(collector.events).to have(1).items
|
34
35
|
end
|
@@ -36,9 +37,10 @@ describe ::Acfs::Global do
|
|
36
37
|
|
37
38
|
describe '#reset' do
|
38
39
|
before do
|
39
|
-
|
40
|
+
ActiveSupport::Notifications.subscribe 'acfs.reset', collector
|
40
41
|
end
|
41
|
-
|
42
|
+
|
43
|
+
it 'triggers event' do
|
42
44
|
Acfs.reset
|
43
45
|
expect(collector.events).to have(1).items
|
44
46
|
end
|
@@ -50,11 +52,11 @@ describe ::Acfs::Global do
|
|
50
52
|
stub_request(:get, %r{http://users.example.org/users/\d+}).to_return(
|
51
53
|
status: 200,
|
52
54
|
body: '{}',
|
53
|
-
headers: {'Content-Type' => 'application/json'}
|
55
|
+
headers: {'Content-Type' => 'application/json'},
|
54
56
|
)
|
55
57
|
end
|
56
58
|
|
57
|
-
it '
|
59
|
+
it 'invokes when both resources' do
|
58
60
|
user1 = MyUser.find 1
|
59
61
|
user2 = MyUser.find 2
|
60
62
|
|
@@ -64,7 +66,7 @@ describe ::Acfs::Global do
|
|
64
66
|
end.to yield_with_args(user1, user2)
|
65
67
|
end
|
66
68
|
|
67
|
-
it '
|
69
|
+
it 'invokes when both resources when loaded' do
|
68
70
|
user1 = MyUser.find 1
|
69
71
|
user2 = MyUser.find 2
|
70
72
|
|
@@ -82,7 +84,7 @@ describe ::Acfs::Global do
|
|
82
84
|
.to_return(
|
83
85
|
status: 200,
|
84
86
|
body: '{}',
|
85
|
-
headers: {'Content-Type' => 'application/json'}
|
87
|
+
headers: {'Content-Type' => 'application/json'},
|
86
88
|
)
|
87
89
|
end
|
88
90
|
|
@@ -125,7 +127,7 @@ describe ::Acfs::Global do
|
|
125
127
|
runner1 = Thread.new { acfs.runner }.value
|
126
128
|
runner2 = Thread.new { acfs.runner }.value
|
127
129
|
|
128
|
-
expect(runner1).
|
130
|
+
expect(runner1).not_to equal runner2
|
129
131
|
end
|
130
132
|
|
131
133
|
it 'uses configurated adapter' do
|
data/spec/acfs/location_spec.rb
CHANGED
@@ -16,15 +16,15 @@ describe Acfs::Middleware::JSON do
|
|
16
16
|
|
17
17
|
describe 'encode' do
|
18
18
|
context 'with not serialized request' do
|
19
|
-
it '
|
19
|
+
it 'sets Content-Type' do
|
20
20
|
expect(request.headers['Content-Type']).to eq 'application/json'
|
21
21
|
end
|
22
22
|
|
23
|
-
it '
|
23
|
+
it 'appends Accept header' do
|
24
24
|
expect(request.headers['Accept']).to eq 'application/json;q=1'
|
25
25
|
end
|
26
26
|
|
27
|
-
it '
|
27
|
+
it 'serializes data to JSON' do
|
28
28
|
expect(JSON.parse(request.body)).to eq data.map(&:stringify_keys)
|
29
29
|
end
|
30
30
|
end
|
@@ -38,7 +38,7 @@ describe Acfs::Middleware::JSON do
|
|
38
38
|
end.new
|
39
39
|
end
|
40
40
|
|
41
|
-
it '
|
41
|
+
it 'serializes data with #to_json' do
|
42
42
|
expect(JSON.parse(request.body)).to eq 'a' => 1, 'b' => 2
|
43
43
|
end
|
44
44
|
end
|
@@ -49,10 +49,10 @@ describe Acfs::Middleware::JSON do
|
|
49
49
|
let(:headers) { {'Content-Type' => 'application/json; charset=utf-8'} }
|
50
50
|
let(:body) { data.to_json }
|
51
51
|
|
52
|
-
it '
|
52
|
+
it 'decodes body data' do
|
53
53
|
request.complete! response
|
54
54
|
|
55
|
-
expect(response.data).to
|
55
|
+
expect(response.data).to eq data.map(&:stringify_keys)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -60,8 +60,8 @@ describe Acfs::Middleware::JSON do
|
|
60
60
|
let(:headers) { {'Content-Type' => 'application/json'} }
|
61
61
|
let(:body) { data.to_json[4..-4] }
|
62
62
|
|
63
|
-
it '
|
64
|
-
expect { request.complete! response }.to raise_error(
|
63
|
+
it 'raises an error' do
|
64
|
+
expect { request.complete! response }.to raise_error(JSON::ParserError)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -69,7 +69,7 @@ describe Acfs::Middleware::JSON do
|
|
69
69
|
let(:headers) { {'Content-Type' => 'application/text'} }
|
70
70
|
let(:body) { data.to_json }
|
71
71
|
|
72
|
-
it '
|
72
|
+
it 'does not decode non-JSON encoded responses' do
|
73
73
|
request.complete! response
|
74
74
|
|
75
75
|
expect(response.data).to be_nil
|