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/spec/acfs/stub_spec.rb
CHANGED
@@ -7,8 +7,9 @@ class SpecialCustomError < StandardError; end
|
|
7
7
|
describe Acfs::Stub do
|
8
8
|
let(:stub) { Class.new(Acfs::Stub) }
|
9
9
|
|
10
|
-
before(:all) { Acfs::Stub.enable }
|
11
|
-
|
10
|
+
before(:all) { Acfs::Stub.enable } # rubocop:disable RSpec/BeforeAfterAll
|
11
|
+
|
12
|
+
after(:all) { Acfs::Stub.disable } # rubocop:disable RSpec/BeforeAfterAll
|
12
13
|
|
13
14
|
before do
|
14
15
|
Acfs::Stub.allow_requests = false
|
@@ -16,16 +17,18 @@ describe Acfs::Stub do
|
|
16
17
|
|
17
18
|
describe '#called?' do
|
18
19
|
context 'without specified number' do
|
19
|
-
let!(:operation)
|
20
|
+
let!(:operation) do
|
21
|
+
Acfs::Stub.resource MyUser, :read, with: {id: 1}, return: {id: 1, name: 'John Smith', age: 32}
|
22
|
+
end
|
20
23
|
|
21
|
-
it '
|
24
|
+
it 'allows to test if stub was called' do
|
22
25
|
MyUser.find 1
|
23
26
|
Acfs.run
|
24
27
|
|
25
28
|
expect(operation).to be_called
|
26
29
|
end
|
27
30
|
|
28
|
-
it '
|
31
|
+
it 'allows to test if stub was called a specific number of times' do
|
29
32
|
MyUser.find 1
|
30
33
|
Acfs.run
|
31
34
|
|
@@ -44,7 +47,7 @@ describe Acfs::Stub do
|
|
44
47
|
Acfs::Stub.resource MyUser, :read, with: {id: 1}, raise: :not_found
|
45
48
|
end
|
46
49
|
|
47
|
-
it '
|
50
|
+
it 'raises error' do
|
48
51
|
MyUser.find 1
|
49
52
|
|
50
53
|
expect { Acfs.run }.to raise_error(Acfs::AmbiguousStubError)
|
@@ -58,23 +61,23 @@ describe Acfs::Stub do
|
|
58
61
|
Acfs::Stub.resource MyUser, :read, with: {id: 3}, raise: :not_found
|
59
62
|
end
|
60
63
|
|
61
|
-
it '
|
64
|
+
it 'allows to stub resource reads' do
|
62
65
|
user = MyUser.find 1
|
63
66
|
Acfs.run
|
64
67
|
|
65
|
-
expect(user.id).to
|
66
|
-
expect(user.name).to
|
67
|
-
expect(user.age).to
|
68
|
+
expect(user.id).to eq 1
|
69
|
+
expect(user.name).to eq 'John Smith'
|
70
|
+
expect(user.age).to eq 32
|
68
71
|
end
|
69
72
|
|
70
73
|
context 'with error' do
|
71
|
-
it '
|
74
|
+
it 'allows to raise errors' do
|
72
75
|
MyUser.find 2
|
73
76
|
|
74
77
|
expect { Acfs.run }.to raise_error(SpecialCustomError)
|
75
78
|
end
|
76
79
|
|
77
|
-
it '
|
80
|
+
it 'allows to raise symbolic errors' do
|
78
81
|
MyUser.find 3
|
79
82
|
|
80
83
|
expect { Acfs.run }.to raise_error(Acfs::ResourceNotFound)
|
@@ -87,7 +90,7 @@ describe Acfs::Stub do
|
|
87
90
|
Acfs::Stub.resource Computer, :read, with: {id: 2}, return: {id: 2, type: 'Mac'}
|
88
91
|
end
|
89
92
|
|
90
|
-
it '
|
93
|
+
it 'creates inherited type' do
|
91
94
|
pc = Computer.find 1
|
92
95
|
mac = Computer.find 2
|
93
96
|
|
@@ -101,21 +104,29 @@ describe Acfs::Stub do
|
|
101
104
|
|
102
105
|
context 'with create action' do
|
103
106
|
before do
|
104
|
-
|
105
|
-
|
107
|
+
lmbd = lambda {|op|
|
108
|
+
op.data[:ident] == 'john@exmaple.org' && op.data[:password] == 'wrong'
|
109
|
+
}
|
110
|
+
|
111
|
+
Acfs::Stub.resource Session, :create,
|
112
|
+
with: {ident: 'john@exmaple.org', password: 's3cr3t'},
|
113
|
+
return: {id: 'longhash', user: 1}
|
114
|
+
Acfs::Stub.resource Session, :create,
|
115
|
+
with: lmbd,
|
116
|
+
raise: 422
|
106
117
|
end
|
107
118
|
|
108
|
-
it '
|
119
|
+
it 'allows stub resource creation' do
|
109
120
|
session = Session.create! ident: 'john@exmaple.org', password: 's3cr3t'
|
110
121
|
|
111
|
-
expect(session.id).to
|
112
|
-
expect(session.user).to
|
122
|
+
expect(session.id).to eq 'longhash'
|
123
|
+
expect(session.user).to eq 1
|
113
124
|
end
|
114
125
|
|
115
|
-
it '
|
126
|
+
it 'allows to raise error' do
|
116
127
|
expect do
|
117
128
|
Session.create! ident: 'john@exmaple.org', password: 'wrong'
|
118
|
-
end.to raise_error(
|
129
|
+
end.to raise_error(Acfs::InvalidResource)
|
119
130
|
end
|
120
131
|
end
|
121
132
|
|
@@ -125,14 +136,14 @@ describe Acfs::Stub do
|
|
125
136
|
return: [{id: 1, name: 'John Smith', age: 32}, {id: 2, name: 'Anon', age: 12}]
|
126
137
|
end
|
127
138
|
|
128
|
-
it '
|
139
|
+
it 'returns collection' do
|
129
140
|
users = MyUser.all
|
130
141
|
Acfs.run
|
131
142
|
|
132
143
|
expect(users).to have(2).items
|
133
144
|
end
|
134
145
|
|
135
|
-
it '
|
146
|
+
it 'returns defined resources' do
|
136
147
|
users = MyUser.all
|
137
148
|
Acfs.run
|
138
149
|
|
@@ -148,7 +159,7 @@ describe Acfs::Stub do
|
|
148
159
|
return: [{id: 1, type: 'PC'}, {id: 2, type: 'Mac'}]
|
149
160
|
end
|
150
161
|
|
151
|
-
it '
|
162
|
+
it 'creates inherited type' do
|
152
163
|
computers = Computer.all
|
153
164
|
Acfs.run
|
154
165
|
|
@@ -158,6 +169,11 @@ describe Acfs::Stub do
|
|
158
169
|
end
|
159
170
|
|
160
171
|
context 'with header' do
|
172
|
+
subject do
|
173
|
+
Acfs.run
|
174
|
+
comments
|
175
|
+
end
|
176
|
+
|
161
177
|
before do
|
162
178
|
Acfs::Stub.resource Comment, :list,
|
163
179
|
return: [{id: 1, text: 'Foo'}, {id: 2, text: 'Bar'}],
|
@@ -168,40 +184,40 @@ describe Acfs::Stub do
|
|
168
184
|
let(:headers) do
|
169
185
|
{
|
170
186
|
'X-Total-Pages' => '2',
|
171
|
-
'X-Total-Count' => '10'
|
187
|
+
'X-Total-Count' => '10',
|
172
188
|
}
|
173
189
|
end
|
174
|
-
subject { Acfs.run; comments }
|
175
190
|
|
176
|
-
its(:total_pages) {
|
177
|
-
its(:total_count) {
|
191
|
+
its(:total_pages) { is_expected.to eq 2 }
|
192
|
+
its(:total_count) { is_expected.to eq 10 }
|
178
193
|
end
|
179
194
|
end
|
180
195
|
|
181
196
|
context 'with update action' do
|
182
197
|
before do
|
183
198
|
Acfs::Stub.resource MyUser, :read, with: {id: 1}, return: {id: 1, name: 'John Smith', age: 32}
|
184
|
-
Acfs::Stub.resource MyUser, :update, with: {id: 1, name: 'John Smith', age: 22},
|
199
|
+
Acfs::Stub.resource MyUser, :update, with: {id: 1, name: 'John Smith', age: 22},
|
200
|
+
return: {id: 1, name: 'John Smith', age: 23}
|
185
201
|
Acfs::Stub.resource MyUser, :update, with: {id: 1, name: 'John Smith', age: 0}, raise: 422
|
186
202
|
end
|
187
203
|
|
188
204
|
let!(:update_stub) do
|
189
205
|
Acfs::Stub.resource MyUser, :update,
|
190
206
|
with: {id: 1, name: 'Jane Smith'},
|
191
|
-
return: ->(op) {
|
207
|
+
return: ->(op) { op.data.to_h {|k, v| [k, v.to_s.upcase] } }
|
192
208
|
end
|
193
209
|
|
194
|
-
it '
|
210
|
+
it 'allows stub resource update' do
|
195
211
|
user = MyUser.find 1
|
196
212
|
Acfs.run
|
197
213
|
|
198
214
|
user.age = 22
|
199
215
|
user.save!
|
200
216
|
|
201
|
-
expect(user.age).to
|
217
|
+
expect(user.age).to eq 23
|
202
218
|
end
|
203
219
|
|
204
|
-
it '
|
220
|
+
it 'allows to raise error' do
|
205
221
|
user = MyUser.find 1
|
206
222
|
Acfs.run
|
207
223
|
|
@@ -210,10 +226,10 @@ describe Acfs::Stub do
|
|
210
226
|
|
211
227
|
expect do
|
212
228
|
user.save!
|
213
|
-
end.to raise_error(
|
229
|
+
end.to raise_error(Acfs::InvalidResource)
|
214
230
|
end
|
215
231
|
|
216
|
-
it '
|
232
|
+
it 'matches partial :with' do
|
217
233
|
user = MyUser.find 1
|
218
234
|
Acfs.run
|
219
235
|
|
@@ -224,7 +240,7 @@ describe Acfs::Stub do
|
|
224
240
|
expect(update_stub).to be_called
|
225
241
|
end
|
226
242
|
|
227
|
-
it '
|
243
|
+
it 'processes response body' do
|
228
244
|
user = MyUser.find 1
|
229
245
|
Acfs.run
|
230
246
|
|
@@ -235,18 +251,6 @@ describe Acfs::Stub do
|
|
235
251
|
expect(user.name).to eq 'JANE SMITH'
|
236
252
|
end
|
237
253
|
end
|
238
|
-
|
239
|
-
context 'with create action' do
|
240
|
-
before do
|
241
|
-
Acfs::Stub.resource MyUser, :create, with: {name: 'John Smith', age: 0}, raise: 422
|
242
|
-
end
|
243
|
-
|
244
|
-
it 'should allow to raise error' do
|
245
|
-
expect do
|
246
|
-
MyUser.create! name: 'John Smith', age: 0
|
247
|
-
end.to raise_error(::Acfs::InvalidResource)
|
248
|
-
end
|
249
|
-
end
|
250
254
|
end
|
251
255
|
|
252
256
|
describe '.allow_requests=' do
|
@@ -256,9 +260,9 @@ describe Acfs::Stub do
|
|
256
260
|
stub_request(:get, 'http://users.example.org/users/2').to_return response(id: 2, name: 'John', age: 26)
|
257
261
|
end
|
258
262
|
|
259
|
-
it '
|
263
|
+
it 'allows real requests' do
|
260
264
|
@user = MyUser.find 2
|
261
|
-
expect { Acfs.run }.
|
265
|
+
expect { Acfs.run }.not_to raise_error
|
262
266
|
end
|
263
267
|
end
|
264
268
|
|
@@ -267,7 +271,7 @@ describe Acfs::Stub do
|
|
267
271
|
Acfs::Stub.allow_requests = false
|
268
272
|
end
|
269
273
|
|
270
|
-
it '
|
274
|
+
it 'does not allow real requests' do
|
271
275
|
@user = MyUser.find 2
|
272
276
|
expect { Acfs.run }.to raise_error(Acfs::RealRequestsNotAllowedError)
|
273
277
|
end
|
@@ -279,9 +283,8 @@ describe Acfs::Stub do
|
|
279
283
|
|
280
284
|
context 'with a match in params' do
|
281
285
|
let(:op) do
|
282
|
-
|
283
|
-
allow(op).to
|
284
|
-
allow(op).to receive(:data).and_return({})
|
286
|
+
instance_double(Acfs::Operation).tap do |op|
|
287
|
+
allow(op).to receive_messages(full_params: {id: 1337, blub: 'abc'}, data: {})
|
285
288
|
end
|
286
289
|
end
|
287
290
|
|
@@ -292,9 +295,8 @@ describe Acfs::Stub do
|
|
292
295
|
|
293
296
|
context 'with a match in data' do
|
294
297
|
let(:op) do
|
295
|
-
|
296
|
-
allow(op).to
|
297
|
-
allow(op).to receive(:data).and_return(id: 1337, blub: 'abc')
|
298
|
+
instance_double(Acfs::Operation).tap do |op|
|
299
|
+
allow(op).to receive_messages(full_params: {}, data: {id: 1337, blub: 'abc'})
|
298
300
|
end
|
299
301
|
end
|
300
302
|
|
@@ -305,9 +307,8 @@ describe Acfs::Stub do
|
|
305
307
|
|
306
308
|
context 'with no match in params nor data' do
|
307
309
|
let(:op) do
|
308
|
-
|
309
|
-
allow(op).to
|
310
|
-
allow(op).to receive(:data).and_return({})
|
310
|
+
instance_double(Acfs::Operation).tap do |op|
|
311
|
+
allow(op).to receive_messages(full_params: {id: 1337}, data: {})
|
311
312
|
end
|
312
313
|
end
|
313
314
|
|
@@ -318,9 +319,8 @@ describe Acfs::Stub do
|
|
318
319
|
|
319
320
|
context 'with a wrong match' do
|
320
321
|
let(:op) do
|
321
|
-
|
322
|
-
allow(op).to
|
323
|
-
allow(op).to receive(:data).and_return({})
|
322
|
+
instance_double(Acfs::Operation).tap do |op|
|
323
|
+
allow(op).to receive_messages(full_params: {id: 1337, blub: 'abc'}, data: {})
|
324
324
|
end
|
325
325
|
end
|
326
326
|
|
@@ -331,9 +331,8 @@ describe Acfs::Stub do
|
|
331
331
|
|
332
332
|
context 'with a missing match' do
|
333
333
|
let(:op) do
|
334
|
-
|
335
|
-
allow(op).to
|
336
|
-
allow(op).to receive(:data).and_return({})
|
334
|
+
instance_double(Acfs::Operation).tap do |op|
|
335
|
+
allow(op).to receive_messages(full_params: {id: 1337, blub: 'abc'}, data: {})
|
337
336
|
end
|
338
337
|
end
|
339
338
|
|
data/spec/acfs_spec.rb
CHANGED
@@ -4,57 +4,68 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe 'Acfs' do
|
6
6
|
before do
|
7
|
-
stub_request(:get, 'http://users.example.org/users')
|
8
|
-
|
9
|
-
|
10
|
-
stub_request(:get, 'http://users.example.org/users/
|
11
|
-
|
12
|
-
|
7
|
+
stub_request(:get, 'http://users.example.org/users')
|
8
|
+
.to_return response([{id: 1, name: 'Anon', age: 12}, {id: 2, name: 'John', age: 26}])
|
9
|
+
|
10
|
+
stub_request(:get, 'http://users.example.org/users/2')
|
11
|
+
.to_return response(id: 2, name: 'John', age: 26)
|
12
|
+
|
13
|
+
stub_request(:get, 'http://users.example.org/users/3')
|
14
|
+
.to_return response(id: 3, name: 'Miraculix', age: 122)
|
15
|
+
|
16
|
+
stub_request(:get, 'http://users.example.org/users/100')
|
17
|
+
.to_return response(id: 100, name: 'Jimmy', age: 45)
|
18
|
+
|
19
|
+
stub_request(:get, 'http://users.example.org/users/2/friends')
|
20
|
+
.to_return response([{id: 1, name: 'Anon', age: 12}])
|
21
|
+
|
22
|
+
stub_request(:get, 'http://comments.example.org/comments?user=2')
|
23
|
+
.to_return response([{id: 1, text: 'Comment #1'}, {id: 2, text: 'Comment #2'}])
|
13
24
|
end
|
14
25
|
|
15
|
-
it '
|
26
|
+
it 'updates single resource synchronously' do
|
16
27
|
stub = stub_request(:put, 'http://users.example.org/users/2')
|
17
|
-
|
28
|
+
.to_return {|request| {body: request.body, headers: {'Content-Type' => request.headers['Content-Type']}} }
|
18
29
|
|
19
|
-
|
30
|
+
user = MyUser.find 2
|
20
31
|
Acfs.run
|
21
32
|
|
22
|
-
expect(
|
23
|
-
expect(
|
33
|
+
expect(user).not_to be_changed
|
34
|
+
expect(user).to be_persisted
|
24
35
|
|
25
|
-
|
36
|
+
user.name = 'Johnny'
|
26
37
|
|
27
|
-
expect(
|
28
|
-
expect(
|
38
|
+
expect(user).to be_changed
|
39
|
+
expect(user).to be_persisted
|
29
40
|
|
30
|
-
|
41
|
+
user.save
|
31
42
|
|
32
43
|
expect(stub).to have_been_requested
|
33
|
-
expect(
|
34
|
-
expect(
|
44
|
+
expect(user).not_to be_changed
|
45
|
+
expect(user).to be_persisted
|
35
46
|
end
|
36
47
|
|
37
|
-
it '
|
48
|
+
it 'creates a single resource synchronously' do
|
38
49
|
stub = stub_request(:post, 'http://users.example.org/sessions').to_return response(id: 'sessionhash', user: 1)
|
39
50
|
|
40
51
|
session = Session.create ident: 'Anon'
|
41
52
|
|
42
53
|
expect(stub).to have_been_requested
|
43
|
-
expect(session.id).to
|
44
|
-
expect(session.user).to
|
54
|
+
expect(session.id).to eq 'sessionhash'
|
55
|
+
expect(session.user).to eq 1
|
45
56
|
end
|
46
57
|
|
47
|
-
it '
|
48
|
-
|
58
|
+
it 'loads single resource' do
|
59
|
+
user = MyUser.find(2)
|
49
60
|
|
50
|
-
expect(
|
61
|
+
expect(user).not_to be_loaded
|
51
62
|
|
52
63
|
Acfs.run
|
53
64
|
|
54
|
-
expect(
|
55
|
-
expect(
|
56
|
-
expect(
|
57
|
-
expect(
|
65
|
+
expect(user).to be_loaded
|
66
|
+
expect(user.id).to eq 2
|
67
|
+
expect(user.name).to eq 'John'
|
68
|
+
expect(user.age).to eq 26
|
58
69
|
end
|
59
70
|
|
60
71
|
describe 'singleton' do
|
@@ -62,144 +73,151 @@ describe 'Acfs' do
|
|
62
73
|
stub_request(:get, 'http://users.example.org/singles?user_id=5').to_return response(score: 250, user_id: 5)
|
63
74
|
end
|
64
75
|
|
65
|
-
it '
|
76
|
+
it 'creates a singleton resource' do
|
66
77
|
stub = stub_request(:post, 'http://users.example.org/singles').to_return response(score: 250, user_id: 5)
|
67
78
|
|
68
|
-
|
69
|
-
expect(
|
79
|
+
single = Single.new user_id: 5, score: 250
|
80
|
+
expect(single.new?).to be true
|
70
81
|
|
71
|
-
|
82
|
+
single.save
|
72
83
|
expect(stub).to have_been_requested
|
73
84
|
|
74
|
-
expect(
|
75
|
-
expect(
|
76
|
-
expect(
|
85
|
+
expect(single.new?).to be false
|
86
|
+
expect(single.user_id).to eq 5
|
87
|
+
expect(single.score).to eq 250
|
77
88
|
end
|
78
89
|
|
79
|
-
it '
|
80
|
-
|
90
|
+
it 'loads singleton resource' do
|
91
|
+
single = Single.find user_id: 5
|
81
92
|
Acfs.run
|
82
93
|
|
83
|
-
expect(
|
94
|
+
expect(single.score).to eq 250
|
84
95
|
end
|
85
96
|
|
86
|
-
it '
|
97
|
+
it 'updates singleton resource' do
|
87
98
|
stub = stub_request(:put, 'http://users.example.org/singles').to_return do |request|
|
88
99
|
{
|
89
100
|
body: request.body,
|
90
|
-
headers: {'Content-Type' => request.headers['Content-Type']}
|
101
|
+
headers: {'Content-Type' => request.headers['Content-Type']},
|
91
102
|
}
|
92
103
|
end
|
93
104
|
|
94
|
-
|
105
|
+
single = Single.find user_id: 5
|
95
106
|
Acfs.run
|
96
107
|
|
97
|
-
expect(
|
108
|
+
expect(single.score).to eq 250
|
98
109
|
|
99
|
-
|
100
|
-
|
110
|
+
single.score = 300
|
111
|
+
single.save
|
101
112
|
|
102
113
|
expect(stub).to have_been_requested
|
103
114
|
|
104
|
-
expect(
|
115
|
+
expect(single.score).to eq 300
|
105
116
|
end
|
106
117
|
|
107
|
-
it '
|
118
|
+
it 'deletes singleton resource' do
|
108
119
|
stub = stub_request(:delete, 'http://users.example.org/singles').to_return do |request|
|
109
120
|
{
|
110
121
|
body: request.body,
|
111
|
-
headers: {'Content-Type' => request.headers['Content-Type']}
|
122
|
+
headers: {'Content-Type' => request.headers['Content-Type']},
|
112
123
|
}
|
113
124
|
end
|
114
125
|
|
115
|
-
|
126
|
+
single = Single.find user_id: 5
|
116
127
|
Acfs.run
|
117
128
|
|
118
|
-
expect(
|
129
|
+
expect(single.new?).to be false
|
119
130
|
|
120
|
-
|
131
|
+
single.delete
|
121
132
|
|
122
133
|
expect(stub).to have_been_requested
|
123
134
|
end
|
124
135
|
|
125
|
-
it '
|
126
|
-
expect { Single.all }.to raise_error
|
136
|
+
it 'raises error when calling .all' do
|
137
|
+
expect { Single.all }.to raise_error Acfs::UnsupportedOperation
|
127
138
|
end
|
128
139
|
end
|
129
140
|
|
130
|
-
it '
|
131
|
-
|
141
|
+
it 'loads multiple single resources' do
|
142
|
+
john = nil
|
143
|
+
mirx = nil
|
144
|
+
jimy = nil
|
145
|
+
|
146
|
+
users = MyUser.find([2, 3, 100]) do |users|
|
132
147
|
# This block should be called only after *all* resources are loaded.
|
133
|
-
|
134
|
-
|
135
|
-
|
148
|
+
john = users[0]
|
149
|
+
mirx = users[1]
|
150
|
+
jimy = users[2]
|
136
151
|
end
|
137
152
|
|
138
|
-
expect(
|
153
|
+
expect(users).not_to be_loaded
|
139
154
|
|
140
155
|
Acfs.run
|
141
156
|
|
142
|
-
expect(
|
143
|
-
expect(
|
157
|
+
expect(users).to be_loaded
|
158
|
+
expect(users).to have(3).items
|
144
159
|
|
145
|
-
expect(
|
146
|
-
expect(
|
147
|
-
expect(
|
148
|
-
expect(
|
160
|
+
expect(users[0].id).to eq 2
|
161
|
+
expect(users[0].name).to eq 'John'
|
162
|
+
expect(users[0].age).to eq 26
|
163
|
+
expect(users[0]).to eq john
|
149
164
|
|
150
|
-
expect(
|
151
|
-
expect(
|
152
|
-
expect(
|
153
|
-
expect(
|
165
|
+
expect(users[1].id).to eq 3
|
166
|
+
expect(users[1].name).to eq 'Miraculix'
|
167
|
+
expect(users[1].age).to eq 122
|
168
|
+
expect(users[1]).to eq mirx
|
154
169
|
|
155
|
-
expect(
|
156
|
-
expect(
|
157
|
-
expect(
|
158
|
-
expect(
|
170
|
+
expect(users[2].id).to eq 100
|
171
|
+
expect(users[2].name).to eq 'Jimmy'
|
172
|
+
expect(users[2].age).to eq 45
|
173
|
+
expect(users[2]).to eq jimy
|
159
174
|
end
|
160
175
|
|
161
|
-
it '
|
162
|
-
|
176
|
+
it 'loads multiple resources' do
|
177
|
+
users = MyUser.all
|
163
178
|
|
164
|
-
expect(
|
179
|
+
expect(users).not_to be_loaded
|
165
180
|
|
166
181
|
Acfs.run
|
167
182
|
|
168
|
-
expect(
|
169
|
-
expect(
|
170
|
-
expect(
|
171
|
-
expect(
|
172
|
-
expect(
|
173
|
-
expect(
|
183
|
+
expect(users).to be_loaded
|
184
|
+
expect(users).to have(2).items
|
185
|
+
expect(users[0].name).to eq 'Anon'
|
186
|
+
expect(users[0].age).to eq 12
|
187
|
+
expect(users[1].name).to eq 'John'
|
188
|
+
expect(users[1].age).to eq 26
|
174
189
|
end
|
175
190
|
|
176
|
-
it '
|
191
|
+
it 'loads associated resources' do
|
177
192
|
pending 'TODO: Implement high level feature'
|
193
|
+
friends = nil
|
178
194
|
|
179
|
-
|
180
|
-
|
195
|
+
user = MyUser.find(2) do |user|
|
196
|
+
friends = user.friends.all
|
181
197
|
end
|
182
198
|
|
183
199
|
Acfs.run
|
184
200
|
|
185
|
-
expect(
|
186
|
-
expect(
|
201
|
+
expect(user.name).to eq 'John'
|
202
|
+
expect(user.age).to eq 26
|
187
203
|
|
188
|
-
expect(
|
204
|
+
expect(friends).to have(1).items
|
189
205
|
end
|
190
206
|
|
191
|
-
it '
|
192
|
-
|
193
|
-
|
194
|
-
|
207
|
+
it 'loads associated resources from different service' do
|
208
|
+
comments = nil
|
209
|
+
|
210
|
+
user = MyUser.find 2 do |user|
|
211
|
+
expect(user.id).to eq 2
|
212
|
+
comments = Comment.where({user: user.id})
|
195
213
|
end
|
196
214
|
|
197
215
|
Acfs.run
|
198
216
|
|
199
|
-
expect(
|
200
|
-
expect(
|
201
|
-
expect(
|
217
|
+
expect(user.id).to eq 2
|
218
|
+
expect(user.name).to eq 'John'
|
219
|
+
expect(user.age).to eq 26
|
202
220
|
|
203
|
-
expect(
|
221
|
+
expect(comments).to have(2).items
|
204
222
|
end
|
205
223
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,21 +4,23 @@ require 'rspec'
|
|
4
4
|
require 'webmock/rspec'
|
5
5
|
|
6
6
|
require 'simplecov'
|
7
|
+
require 'simplecov-cobertura'
|
8
|
+
|
7
9
|
SimpleCov.start do
|
8
10
|
add_filter 'spec'
|
9
11
|
end
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
SimpleCov
|
14
|
-
|
13
|
+
SimpleCov.formatters = [
|
14
|
+
SimpleCov::Formatter::HTMLFormatter,
|
15
|
+
SimpleCov::Formatter::CoberturaFormatter,
|
16
|
+
]
|
15
17
|
|
16
18
|
require 'bundler'
|
17
19
|
Bundler.require(:default, :test)
|
18
20
|
|
19
21
|
require 'acfs'
|
20
22
|
|
21
|
-
Dir[File.expand_path('spec/support/**/*.rb')].
|
23
|
+
Dir[File.expand_path('spec/support/**/*.rb')].each {|f| require f }
|
22
24
|
|
23
25
|
RSpec.configure do |config|
|
24
26
|
# ## Mock Framework
|
@@ -35,7 +37,9 @@ RSpec.configure do |config|
|
|
35
37
|
# --seed 1234
|
36
38
|
config.order = 'random'
|
37
39
|
|
38
|
-
config.
|
40
|
+
config.raise_errors_for_deprecations!
|
41
|
+
|
42
|
+
config.before do
|
39
43
|
Acfs.runner.clear
|
40
44
|
Acfs::Stub.clear
|
41
45
|
end
|