acfs 1.6.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (258) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +144 -115
  3. data/README.md +33 -41
  4. data/acfs.gemspec +9 -10
  5. data/lib/acfs/adapter/typhoeus.rb +6 -4
  6. data/lib/acfs/collections/paginatable.rb +11 -11
  7. data/lib/acfs/configuration.rb +13 -3
  8. data/lib/acfs/errors.rb +7 -7
  9. data/lib/acfs/global.rb +4 -4
  10. data/lib/acfs/location.rb +2 -2
  11. data/lib/acfs/operation.rb +1 -1
  12. data/lib/acfs/request/callbacks.rb +1 -1
  13. data/lib/acfs/request.rb +1 -1
  14. data/lib/acfs/resource/attributes/uuid.rb +2 -2
  15. data/lib/acfs/resource/attributes.rb +1 -1
  16. data/lib/acfs/resource/dirty.rb +1 -1
  17. data/lib/acfs/resource/locatable.rb +2 -2
  18. data/lib/acfs/resource/operational.rb +4 -4
  19. data/lib/acfs/resource/query_methods.rb +5 -5
  20. data/lib/acfs/response/status.rb +1 -1
  21. data/lib/acfs/runner.rb +15 -15
  22. data/lib/acfs/service/middleware.rb +2 -2
  23. data/lib/acfs/singleton_resource.rb +2 -2
  24. data/lib/acfs/stub.rb +35 -30
  25. data/lib/acfs/version.rb +3 -3
  26. data/lib/acfs/yard.rb +1 -0
  27. data/spec/acfs/adapter/typhoeus_spec.rb +4 -4
  28. data/spec/acfs/collection_spec.rb +66 -41
  29. data/spec/acfs/configuration_spec.rb +22 -12
  30. data/spec/acfs/global_spec.rb +14 -12
  31. data/spec/acfs/location_spec.rb +1 -1
  32. data/spec/acfs/middleware/json_spec.rb +9 -9
  33. data/spec/acfs/middleware/{msgpack_spec.rb → message_pack_spec.rb} +7 -7
  34. data/spec/acfs/operation_spec.rb +4 -3
  35. data/spec/acfs/request/callbacks_spec.rb +19 -10
  36. data/spec/acfs/request_spec.rb +15 -19
  37. data/spec/acfs/resource/attributes/boolean_spec.rb +32 -32
  38. data/spec/acfs/resource/attributes/date_time_spec.rb +17 -9
  39. data/spec/acfs/resource/attributes/dict_spec.rb +16 -10
  40. data/spec/acfs/resource/attributes/float_spec.rb +21 -11
  41. data/spec/acfs/resource/attributes/integer_spec.rb +11 -6
  42. data/spec/acfs/resource/attributes/list_spec.rb +13 -8
  43. data/spec/acfs/resource/attributes/uuid_spec.rb +14 -8
  44. data/spec/acfs/resource/attributes_spec.rb +33 -32
  45. data/spec/acfs/resource/dirty_spec.rb +7 -4
  46. data/spec/acfs/resource/initialization_spec.rb +4 -5
  47. data/spec/acfs/resource/loadable_spec.rb +3 -1
  48. data/spec/acfs/resource/locatable_spec.rb +24 -18
  49. data/spec/acfs/resource/{persistance_spec.rb → persistence_spec.rb} +119 -87
  50. data/spec/acfs/resource/query_methods_spec.rb +144 -111
  51. data/spec/acfs/resource/validation_spec.rb +34 -27
  52. data/spec/acfs/response/formats_spec.rb +8 -8
  53. data/spec/acfs/response/status_spec.rb +16 -9
  54. data/spec/acfs/runner_spec.rb +22 -20
  55. data/spec/acfs/service/middleware_spec.rb +3 -3
  56. data/spec/acfs/service_spec.rb +5 -4
  57. data/spec/acfs/singleton_resource_spec.rb +2 -1
  58. data/spec/acfs/stub_spec.rb +64 -65
  59. data/spec/acfs_spec.rb +112 -94
  60. data/spec/spec_helper.rb +10 -6
  61. data/spec/support/hash.rb +1 -1
  62. data/spec/support/response.rb +2 -2
  63. data/spec/support/service.rb +1 -1
  64. data/spec/support/shared/find_callbacks.rb +14 -10
  65. data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-67802c9d1826/LICENSE +21 -0
  66. data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-67802c9d1826/README.md +23 -0
  67. data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-67802c9d1826/rubocop-config.gemspec +31 -0
  68. data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.1/CHANGELOG.md +205 -0
  69. data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.1/MIT-LICENSE +21 -0
  70. data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.1/README.rdoc +57 -0
  71. data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.1/CHANGELOG.md +67 -0
  72. data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.1/MIT-LICENSE +21 -0
  73. data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.1/README.rdoc +40 -0
  74. data/vendor/bundle/ruby/3.4.0/gems/activemodel-8.0.1/CHANGELOG.md +110 -0
  75. data/vendor/bundle/ruby/3.4.0/gems/activemodel-8.0.1/MIT-LICENSE +21 -0
  76. data/vendor/bundle/ruby/3.4.0/gems/activemodel-8.0.1/README.rdoc +266 -0
  77. data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.1/CHANGELOG.md +157 -0
  78. data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.1/MIT-LICENSE +20 -0
  79. data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.1/README.rdoc +40 -0
  80. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/CHANGELOG.md +301 -0
  81. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/LICENSE.txt +202 -0
  82. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/README.md +121 -0
  83. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/addressable.gemspec +28 -0
  84. data/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/MIT-LICENSE +21 -0
  85. data/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/README.md +243 -0
  86. data/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/appraisal.gemspec +29 -0
  87. data/vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/LICENSE.txt +22 -0
  88. data/vendor/bundle/ruby/3.4.0/gems/base64-0.2.0/README.md +48 -0
  89. data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.0/README.md +138 -0
  90. data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.0/benchmark.gemspec +32 -0
  91. data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.1.9/LICENSE +56 -0
  92. data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.1.9/bigdecimal.gemspec +57 -0
  93. data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/MIT-LICENSE +20 -0
  94. data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/README.md +258 -0
  95. data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/builder.gemspec +49 -0
  96. data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/CHANGELOG.md +603 -0
  97. data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/LICENSE.txt +21 -0
  98. data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/README.md +407 -0
  99. data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.0/LICENSE +20 -0
  100. data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.0/README.md +167 -0
  101. data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.0/connection_pool.gemspec +24 -0
  102. data/vendor/bundle/ruby/3.4.0/gems/crack-1.0.0/LICENSE +20 -0
  103. data/vendor/bundle/ruby/3.4.0/gems/crack-1.0.0/README.md +43 -0
  104. data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/LICENSE +18 -0
  105. data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/README.md +192 -0
  106. data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/crass.gemspec +31 -0
  107. data/vendor/bundle/ruby/3.4.0/gems/diff-lcs-1.5.1/License.md +41 -0
  108. data/vendor/bundle/ruby/3.4.0/gems/diff-lcs-1.5.1/README.rdoc +84 -0
  109. data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.1/LICENSE.txt +22 -0
  110. data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.1/drb.gemspec +41 -0
  111. data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/CHANGELOG +111 -0
  112. data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/MIT-LICENSE +21 -0
  113. data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/README.rdoc +151 -0
  114. data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/CHANGELOG.md +375 -0
  115. data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/LICENSE +20 -0
  116. data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/README.md +118 -0
  117. data/vendor/bundle/ruby/3.4.0/gems/ethon-0.16.0/ethon.gemspec +26 -0
  118. data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/CHANGELOG.md +465 -0
  119. data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/LICENSE +24 -0
  120. data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/LICENSE.SPECS +22 -0
  121. data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/README.md +137 -0
  122. data/vendor/bundle/ruby/3.4.0/gems/ffi-1.17.1-x86_64-linux-gnu/ffi.gemspec +42 -0
  123. data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/LICENSE +19 -0
  124. data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/README.md +298 -0
  125. data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/changelog.md +119 -0
  126. data/vendor/bundle/ruby/3.4.0/gems/hashdiff-1.1.2/hashdiff.gemspec +39 -0
  127. data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.6/MIT-LICENSE +20 -0
  128. data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.6/README.md +127 -0
  129. data/vendor/bundle/ruby/3.4.0/gems/json-2.9.1/README.md +195 -0
  130. data/vendor/bundle/ruby/3.4.0/gems/json-2.9.1/json.gemspec +64 -0
  131. data/vendor/bundle/ruby/3.4.0/gems/logger-1.6.5/README.md +104 -0
  132. data/vendor/bundle/ruby/3.4.0/gems/logger-1.6.5/logger.gemspec +28 -0
  133. data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.0/CHANGELOG.md +591 -0
  134. data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.0/MIT-LICENSE.txt +23 -0
  135. data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.0/README.md +410 -0
  136. data/vendor/bundle/ruby/3.4.0/gems/minitest-5.25.4/README.rdoc +835 -0
  137. data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/CHANGELOG.md +275 -0
  138. data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/LICENSE.md +20 -0
  139. data/vendor/bundle/ruby/3.4.0/gems/multi_json-1.15.0/README.md +121 -0
  140. data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.1-x86_64-linux-gnu/LICENSE-DEPENDENCIES.md +2224 -0
  141. data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.1-x86_64-linux-gnu/LICENSE.md +9 -0
  142. data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.1-x86_64-linux-gnu/README.md +293 -0
  143. data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.1/CHANGELOG.md +491 -0
  144. data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.1/LICENSE.txt +22 -0
  145. data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.1/README.md +222 -0
  146. data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/ChangeLog +846 -0
  147. data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
  148. data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/README.rdoc +60 -0
  149. data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.8/CHANGELOG.md +998 -0
  150. data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.8/MIT-LICENSE +20 -0
  151. data/vendor/bundle/ruby/3.4.0/gems/rack-3.1.8/README.md +328 -0
  152. data/vendor/bundle/ruby/3.4.0/gems/rack-session-2.1.0/license.md +72 -0
  153. data/vendor/bundle/ruby/3.4.0/gems/rack-session-2.1.0/readme.md +47 -0
  154. data/vendor/bundle/ruby/3.4.0/gems/rack-test-2.2.0/MIT-LICENSE.txt +20 -0
  155. data/vendor/bundle/ruby/3.4.0/gems/rack-test-2.2.0/README.md +139 -0
  156. data/vendor/bundle/ruby/3.4.0/gems/rails-dom-testing-2.2.0/MIT-LICENSE +23 -0
  157. data/vendor/bundle/ruby/3.4.0/gems/rails-dom-testing-2.2.0/README.md +91 -0
  158. data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/CHANGELOG.md +255 -0
  159. data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/MIT-LICENSE +23 -0
  160. data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/README.md +267 -0
  161. data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/MIT-LICENSE +21 -0
  162. data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/README.rdoc +155 -0
  163. data/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/rake.gemspec +101 -0
  164. data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/LICENSE +21 -0
  165. data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/README.md +107 -0
  166. data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/rake-release.gemspec +23 -0
  167. data/vendor/bundle/ruby/3.4.0/gems/rexml-3.4.0/LICENSE.txt +22 -0
  168. data/vendor/bundle/ruby/3.4.0/gems/rexml-3.4.0/README.md +57 -0
  169. data/vendor/bundle/ruby/3.4.0/gems/rspec-3.13.0/LICENSE.md +27 -0
  170. data/vendor/bundle/ruby/3.4.0/gems/rspec-3.13.0/README.md +47 -0
  171. data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/Changelog.md +68 -0
  172. data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/LICENSE.txt +27 -0
  173. data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/README.md +76 -0
  174. data/vendor/bundle/ruby/3.4.0/gems/rspec-collection_matchers-1.2.1/rspec-collection_matchers.gemspec +33 -0
  175. data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.2/Changelog.md +2415 -0
  176. data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.2/LICENSE.md +26 -0
  177. data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.2/README.md +389 -0
  178. data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.3/Changelog.md +1352 -0
  179. data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.3/LICENSE.md +25 -0
  180. data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.3/README.md +326 -0
  181. data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/Changelog.md +73 -0
  182. data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/LICENSE.txt +27 -0
  183. data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/README.md +104 -0
  184. data/vendor/bundle/ruby/3.4.0/gems/rspec-its-2.0.0/rspec-its.gemspec +31 -0
  185. data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.2/Changelog.md +1299 -0
  186. data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.2/LICENSE.md +25 -0
  187. data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.2/README.md +465 -0
  188. data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/Changelog.md +408 -0
  189. data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/LICENSE.md +23 -0
  190. data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.2/README.md +40 -0
  191. data/vendor/bundle/ruby/3.4.0/gems/securerandom-0.4.1/README.md +72 -0
  192. data/vendor/bundle/ruby/3.4.0/gems/thor-1.3.2/LICENSE.md +20 -0
  193. data/vendor/bundle/ruby/3.4.0/gems/thor-1.3.2/README.md +45 -0
  194. data/vendor/bundle/ruby/3.4.0/gems/thor-1.3.2/thor.gemspec +33 -0
  195. data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/CHANGELOG.md +410 -0
  196. data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/LICENSE +22 -0
  197. data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/README.md +588 -0
  198. data/vendor/bundle/ruby/3.4.0/gems/typhoeus-1.4.1/typhoeus.gemspec +25 -0
  199. data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/LICENSE +19 -0
  200. data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/README.md +406 -0
  201. data/vendor/bundle/ruby/3.4.0/gems/uri-1.0.2/README.md +55 -0
  202. data/vendor/bundle/ruby/3.4.0/gems/useragent-0.16.11/LICENSE +20 -0
  203. data/vendor/bundle/ruby/3.4.0/gems/useragent-0.16.11/README.md +42 -0
  204. data/vendor/bundle/ruby/3.4.0/gems/webmock-3.24.0/CHANGELOG.md +2104 -0
  205. data/vendor/bundle/ruby/3.4.0/gems/webmock-3.24.0/LICENSE +20 -0
  206. data/vendor/bundle/ruby/3.4.0/gems/webmock-3.24.0/README.md +1222 -0
  207. data/vendor/bundle/ruby/3.4.0/specifications/actionpack-8.0.1.gemspec +36 -0
  208. data/vendor/bundle/ruby/3.4.0/specifications/actionview-8.0.1.gemspec +33 -0
  209. data/vendor/bundle/ruby/3.4.0/specifications/activemodel-8.0.1.gemspec +26 -0
  210. data/vendor/bundle/ruby/3.4.0/specifications/activesupport-8.0.1.gemspec +38 -0
  211. data/vendor/bundle/ruby/3.4.0/specifications/addressable-2.8.7.gemspec +30 -0
  212. data/vendor/bundle/ruby/3.4.0/specifications/appraisal-2.5.0.gemspec +31 -0
  213. data/vendor/bundle/ruby/3.4.0/specifications/base64-0.2.0.gemspec +23 -0
  214. data/vendor/bundle/ruby/3.4.0/specifications/benchmark-0.4.0.gemspec +23 -0
  215. data/vendor/bundle/ruby/3.4.0/specifications/bigdecimal-3.1.9.gemspec +25 -0
  216. data/vendor/bundle/ruby/3.4.0/specifications/builder-3.3.0.gemspec +22 -0
  217. data/vendor/bundle/ruby/3.4.0/specifications/concurrent-ruby-1.3.5.gemspec +24 -0
  218. data/vendor/bundle/ruby/3.4.0/specifications/connection_pool-2.5.0.gemspec +28 -0
  219. data/vendor/bundle/ruby/3.4.0/specifications/crack-1.0.0.gemspec +27 -0
  220. data/vendor/bundle/ruby/3.4.0/specifications/crass-1.0.6.gemspec +27 -0
  221. data/vendor/bundle/ruby/3.4.0/specifications/diff-lcs-1.5.1.gemspec +37 -0
  222. data/vendor/bundle/ruby/3.4.0/specifications/drb-2.2.1.gemspec +22 -0
  223. data/vendor/bundle/ruby/3.4.0/specifications/erubi-1.13.1.gemspec +29 -0
  224. data/vendor/bundle/ruby/3.4.0/specifications/ethon-0.16.0.gemspec +24 -0
  225. data/vendor/bundle/ruby/3.4.0/specifications/ffi-1.17.1-x86_64-linux-gnu.gemspec +31 -0
  226. data/vendor/bundle/ruby/3.4.0/specifications/hashdiff-1.1.2.gemspec +30 -0
  227. data/vendor/bundle/ruby/3.4.0/specifications/i18n-1.14.6.gemspec +27 -0
  228. data/vendor/bundle/ruby/3.4.0/specifications/json-2.9.1.gemspec +0 -0
  229. data/vendor/bundle/ruby/3.4.0/specifications/logger-1.6.5.gemspec +22 -0
  230. data/vendor/bundle/ruby/3.4.0/specifications/loofah-2.24.0.gemspec +27 -0
  231. data/vendor/bundle/ruby/3.4.0/specifications/minitest-5.25.4.gemspec +31 -0
  232. data/vendor/bundle/ruby/3.4.0/specifications/multi_json-1.15.0.gemspec +26 -0
  233. data/vendor/bundle/ruby/3.4.0/specifications/nokogiri-1.18.1-x86_64-linux-gnu.gemspec +31 -0
  234. data/vendor/bundle/ruby/3.4.0/specifications/public_suffix-6.0.1.gemspec +24 -0
  235. data/vendor/bundle/ruby/3.4.0/specifications/racc-1.8.1.gemspec +28 -0
  236. data/vendor/bundle/ruby/3.4.0/specifications/rack-3.1.8.gemspec +31 -0
  237. data/vendor/bundle/ruby/3.4.0/specifications/rack-session-2.1.0.gemspec +30 -0
  238. data/vendor/bundle/ruby/3.4.0/specifications/rack-test-2.2.0.gemspec +29 -0
  239. data/vendor/bundle/ruby/3.4.0/specifications/rails-dom-testing-2.2.0.gemspec +28 -0
  240. data/vendor/bundle/ruby/3.4.0/specifications/rails-html-sanitizer-1.6.2.gemspec +27 -0
  241. data/vendor/bundle/ruby/3.4.0/specifications/rake-13.2.1.gemspec +26 -0
  242. data/vendor/bundle/ruby/3.4.0/specifications/rake-release-1.3.0.gemspec +26 -0
  243. data/vendor/bundle/ruby/3.4.0/specifications/rexml-3.4.0.gemspec +25 -0
  244. data/vendor/bundle/ruby/3.4.0/specifications/rspec-3.13.0.gemspec +31 -0
  245. data/vendor/bundle/ruby/3.4.0/specifications/rspec-collection_matchers-1.2.1.gemspec +27 -0
  246. data/vendor/bundle/ruby/3.4.0/specifications/rspec-core-3.13.2.gemspec +39 -0
  247. data/vendor/bundle/ruby/3.4.0/specifications/rspec-expectations-3.13.3.gemspec +33 -0
  248. data/vendor/bundle/ruby/3.4.0/specifications/rspec-its-2.0.0.gemspec +27 -0
  249. data/vendor/bundle/ruby/3.4.0/specifications/rspec-mocks-3.13.2.gemspec +33 -0
  250. data/vendor/bundle/ruby/3.4.0/specifications/rspec-support-3.13.2.gemspec +29 -0
  251. data/vendor/bundle/ruby/3.4.0/specifications/securerandom-0.4.1.gemspec +23 -0
  252. data/vendor/bundle/ruby/3.4.0/specifications/thor-1.3.2.gemspec +28 -0
  253. data/vendor/bundle/ruby/3.4.0/specifications/typhoeus-1.4.1.gemspec +24 -0
  254. data/vendor/bundle/ruby/3.4.0/specifications/tzinfo-2.0.6.gemspec +30 -0
  255. data/vendor/bundle/ruby/3.4.0/specifications/uri-1.0.2.gemspec +23 -0
  256. data/vendor/bundle/ruby/3.4.0/specifications/useragent-0.16.11.gemspec +25 -0
  257. data/vendor/bundle/ruby/3.4.0/specifications/webmock-3.24.0.gemspec +45 -0
  258. metadata +208 -70
@@ -4,16 +4,28 @@ require 'spec_helper'
4
4
 
5
5
  describe Acfs::Resource::Persistence do
6
6
  let(:model_class) { MyUser }
7
- before do
8
- @get_stub = stub_request(:get, 'http://users.example.org/users/1').to_return response(id: 1, name: 'Anon', age: 12)
9
7
 
10
- @patch_stub = stub_request(:put, 'http://users.example.org/users/1')
11
- .with(body: '{"id":1,"name":"Idefix","age":12}')
12
- .to_return response(id: 1, name: 'Idefix', age: 12)
8
+ let!(:patch_stub) do
9
+ stub_request(:put, 'http://users.example.org/users/1')
10
+ .with(body: '{"id":1,"name":"Idefix","age":12}')
11
+ .to_return response(id: 1, name: 'Idefix', age: 12)
12
+ end
13
+
14
+ let!(:post_stub) do
15
+ stub_request(:post, 'http://users.example.org/users')
16
+ .with(body: '{"id":null,"name":"Idefix","age":12}')
17
+ .to_return response(id: 5, name: 'Idefix', age: 12)
18
+ end
19
+
20
+ let!(:delete_stub) do
21
+ stub_request(:delete, 'http://users.example.org/users/1')
22
+ .with(body: '{}')
23
+ .to_return response({id: 1, name: 'Idefix', age: 12}, {status: 200})
24
+ end
13
25
 
14
- @post_stub = stub_request(:post, 'http://users.example.org/users')
15
- .with(body: '{"id":null,"name":"Idefix","age":12}')
16
- .to_return response(id: 5, name: 'Idefix', age: 12)
26
+ before do
27
+ stub_request(:get, 'http://users.example.org/users/1')
28
+ .to_return response(id: 1, name: 'Anon', age: 12)
17
29
 
18
30
  stub_request(:post, 'http://users.example.org/users')
19
31
  .with(body: '{"id":null,"name":"Anon","age":null}')
@@ -26,41 +38,38 @@ describe Acfs::Resource::Persistence do
26
38
  stub_request(:post, 'http://users.example.org/users')
27
39
  .with(body: '{"id":null,"name":null,"age":12}')
28
40
  .to_return response({errors: {name: ['required']}}, {status: 422})
29
-
30
- @del = stub_request(:delete, 'http://users.example.org/users/1')
31
- .with(body: '{}')
32
- .to_return response({id: 1, name: 'Idefix', age: 12}, {status: 200})
33
41
  end
34
42
 
35
43
  context 'new model' do
36
44
  let(:model) { model_class.new }
37
45
 
38
- it { expect(model).to_not be_persisted }
46
+ it { expect(model).not_to be_persisted }
39
47
  it { expect(model).to be_new }
40
48
 
41
49
  describe '#save!' do
42
50
  context 'when modified' do
43
51
  let(:model) { model_class.find 1 }
52
+
44
53
  before do
45
54
  model
46
55
  Acfs.run
47
56
  model.name = 'Idefix'
48
57
  end
49
58
 
50
- it 'should PUT to model URL' do
59
+ it 'PUTS to model URL' do
51
60
  model.save!
52
61
 
53
- expect(@patch_stub).to have_been_requested
62
+ expect(patch_stub).to have_been_requested
54
63
  end
55
64
  end
56
65
 
57
66
  context 'when new' do
58
67
  let(:model) { model_class.new name: 'Idefix', age: 12 }
59
68
 
60
- it 'should POST to collection URL' do
69
+ it 'POSTS to collection URL' do
61
70
  model.save!
62
71
 
63
- expect(@post_stub).to have_been_requested
72
+ expect(post_stub).to have_been_requested
64
73
  end
65
74
 
66
75
  context 'with unknown attributes' do
@@ -71,17 +80,17 @@ describe Acfs::Resource::Persistence do
71
80
  end
72
81
  let(:model) { model_class.new name: 'Idefix', born_at: 'Berlin' }
73
82
 
74
- it 'should POST to collection URL' do
83
+ it 'POSTS to collection URL' do
75
84
  model.save!
76
85
  expect(req).to have_been_requested
77
86
  end
78
87
 
79
- it 'should still have unknown attribute' do
88
+ it 'stills have unknown attribute' do
80
89
  model.save!
81
90
  expect(model.attributes).to include 'born_at' => 'Berlin'
82
91
  end
83
92
 
84
- it 'should include server send unknown attribute' do
93
+ it 'includes server send unknown attribute' do
85
94
  model.save!
86
95
  expect(model.attributes).to include 'wuff' => 'woa'
87
96
  end
@@ -93,7 +102,7 @@ describe Acfs::Resource::Persistence do
93
102
  before { model.save! }
94
103
 
95
104
  it { expect(model).to be_persisted }
96
- it { expect(model).to_not be_new }
105
+ it { expect(model).not_to be_new }
97
106
  end
98
107
  end
99
108
 
@@ -101,46 +110,63 @@ describe Acfs::Resource::Persistence do
101
110
  let!(:model) { model_class.find 1 }
102
111
 
103
112
  describe '#update_attributes' do
104
- subject { -> { model.update_attributes({name: 'John'}) } }
105
- it { expect { subject.call }.to raise_error Acfs::ResourceNotLoaded }
113
+ it 'to raise error' do
114
+ expect do
115
+ model.update_attributes({name: 'John'})
116
+ end.to raise_error Acfs::ResourceNotLoaded
117
+ end
106
118
  end
107
119
 
108
120
  describe '#update_attributes!' do
109
- subject { -> { model.update_attributes!({name: 'John'}) } }
110
- it { expect { subject.call }.to raise_error Acfs::ResourceNotLoaded }
121
+ it 'to raise error' do
122
+ expect do
123
+ model.update_attributes!({name: 'John'})
124
+ end.to raise_error Acfs::ResourceNotLoaded
125
+ end
111
126
  end
112
127
  end
113
128
 
114
129
  context 'loaded model' do
115
130
  context 'without changes' do
116
131
  let(:model) { model_class.find 1 }
117
- before { model; Acfs.run }
132
+
133
+ before do
134
+ model
135
+ Acfs.run
136
+ end
118
137
 
119
138
  it { expect(model).to be_persisted }
120
- it { expect(model).to_not be_new }
139
+ it { expect(model).not_to be_new }
121
140
  end
122
141
 
123
142
  context 'with changes' do
124
143
  let(:model) { model_class.find 1 }
125
- before { model; Acfs.run; model.name = 'dhh' }
144
+
145
+ before do
146
+ model
147
+ Acfs.run
148
+ model.name = 'dhh'
149
+ end
126
150
 
127
151
  it { expect(model).to be_persisted }
128
- it { expect(model).to_not be_new }
152
+ it { expect(model).not_to be_new }
129
153
  end
130
154
 
131
155
  describe '#delete!' do
132
156
  let(:model) { model_class.find 1 }
133
- let(:before_acfs_run) {}
134
157
 
135
158
  describe 'normal delete actions' do
136
- before { model; Acfs.run }
159
+ before do
160
+ model
161
+ Acfs.run
162
+ end
137
163
 
138
- it 'should trigger DELETE request' do
164
+ it 'triggers DELETE request' do
139
165
  model.delete!
140
- expect(@del).to have_been_requested
166
+ expect(delete_stub).to have_been_requested
141
167
  end
142
168
 
143
- it 'should be frozen after DELETE' do
169
+ it 'is frozen after DELETE' do
144
170
  model.delete!
145
171
  expect(model.__getobj__).to be_frozen
146
172
  end
@@ -149,46 +175,54 @@ describe Acfs::Resource::Persistence do
149
175
  describe 'correct URL generation' do
150
176
  let(:model_class) { PathArguments }
151
177
  let(:model) { model_class.find 1, params: {required_arg: 'some_value'} }
178
+ let(:resource_url) { 'http://users.example.org/some_value/users/1' }
179
+
180
+ let!(:delete_stub) do
181
+ stub_request(:delete, resource_url)
182
+ .with(body: '{}')
183
+ .to_return response({id: 1, required_arg: 'some_value'}, {status: 200})
184
+ end
185
+
186
+ before do
187
+ stub_request(:get, resource_url)
188
+ .to_return response(id: 1, required_arg: 'some_value')
152
189
 
153
- before :each do
154
- resource_url = 'http://users.example.org/some_value/users/1'
155
- @my_get_stub = stub_request(:get, resource_url)
156
- .to_return response(id: 1, required_arg: 'some_value')
157
- @my_delete_stub = stub_request(:delete, resource_url)
158
- .with(body: '{}')
159
- .to_return response({id: 1, required_arg: 'some_value'}, {status: 200})
160
190
  model
161
191
  Acfs.run
162
192
  end
163
193
 
164
- it 'should not raise an error on URL generation' do
194
+ it 'does not raise an error on URL generation' do
165
195
  expect do
166
196
  model.delete!
167
197
  end.not_to raise_error
168
198
  end
169
199
 
170
- it 'should request the delete' do
200
+ it 'requests the delete' do
171
201
  model.delete!
172
- expect(@my_delete_stub).to have_been_requested
202
+ expect(delete_stub).to have_been_requested
173
203
  end
174
204
  end
175
205
  end
176
206
 
177
207
  describe '#update_atributes!' do
178
208
  let(:model) { model_class.find 1 }
179
- before { model; Acfs.run }
180
209
 
181
- it 'should set attributes' do
210
+ before do
211
+ model
212
+ Acfs.run
213
+ end
214
+
215
+ it 'sets attributes' do
182
216
  model.update_attributes({name: 'Idefix'})
183
217
  expect(model.attributes.symbolize_keys).to eq id: 1, name: 'Idefix', age: 12
184
218
  end
185
219
 
186
- it 'should save resource' do
220
+ it 'saves resource' do
187
221
  expect(model.__getobj__).to receive(:save)
188
222
  model.update_attributes({name: 'Idefix'})
189
223
  end
190
224
 
191
- it 'should kwargs to save' do
225
+ it 'kwargses to save' do
192
226
  expect(model.__getobj__).to receive(:save).with(bla: 'blub')
193
227
  model.update_attributes({name: 'Idefix'}, bla: 'blub')
194
228
  end
@@ -196,19 +230,23 @@ describe Acfs::Resource::Persistence do
196
230
 
197
231
  describe '#update_atributes' do
198
232
  let(:model) { model_class.find 1 }
199
- before { model; Acfs.run }
200
233
 
201
- it 'should set attributes' do
234
+ before do
235
+ model
236
+ Acfs.run
237
+ end
238
+
239
+ it 'sets attributes' do
202
240
  model.update_attributes!({name: 'Idefix'})
203
241
  expect(model.attributes.symbolize_keys).to eq id: 1, name: 'Idefix', age: 12
204
242
  end
205
243
 
206
- it 'should save resource' do
244
+ it 'saves resource' do
207
245
  expect(model.__getobj__).to receive(:save!)
208
246
  model.update_attributes!({name: 'Idefix'})
209
247
  end
210
248
 
211
- it 'should pass second hash to save' do
249
+ it 'passes second hash to save' do
212
250
  expect(model.__getobj__).to receive(:save!).with(bla: 'blub')
213
251
  model.update_attributes!({name: 'Idefix'}, bla: 'blub')
214
252
  end
@@ -218,7 +256,11 @@ describe Acfs::Resource::Persistence do
218
256
  describe '.save!' do
219
257
  context 'with invalid data validated on server side' do
220
258
  let(:model) { model_class.find 1 }
221
- before { model; Acfs.run }
259
+
260
+ before do
261
+ model
262
+ Acfs.run
263
+ end
222
264
 
223
265
  before do
224
266
  stub_request(:put, 'http://users.example.org/users/1')
@@ -226,25 +268,14 @@ describe Acfs::Resource::Persistence do
226
268
  .to_return response({errors: {name: ['required']}}, {status: 422})
227
269
  end
228
270
 
229
- it 'should set local errors hash' do
271
+ it 'sets local errors hash' do
230
272
  model.name = ''
231
273
  begin
232
274
  model.save!
233
275
  rescue StandardError
234
276
  nil
235
277
  end
236
- expect(model.errors.to_hash).to be == {name: %w[required]}
237
- end
238
- end
239
-
240
- context 'hash modification on iteration in ActiveModel when errors on field is nil' do
241
- let(:model) { model_class.find 1 }
242
- before { model; Acfs.run }
243
-
244
- before do
245
- stub_request(:put, 'http://users.example.org/users/1')
246
- .with(body: '{"id":1,"name":"","age":12}')
247
- .to_return response({errors: {name: ['required']}}, {status: 422})
278
+ expect(model.errors.to_hash).to eq({name: %w[required]})
248
279
  end
249
280
  end
250
281
  end
@@ -253,13 +284,13 @@ describe Acfs::Resource::Persistence do
253
284
  context 'with valid data' do
254
285
  let(:data) { {name: 'Idefix', age: 12} }
255
286
 
256
- it 'should create new resource' do
287
+ it 'creates new resource' do
257
288
  model = model_class.create! data
258
- expect(model.name).to be == 'Idefix'
259
- expect(model.age).to be == 12
289
+ expect(model.name).to eq 'Idefix'
290
+ expect(model.age).to eq 12
260
291
  end
261
292
 
262
- it 'should be persisted' do
293
+ it 'is persisted' do
263
294
  model = model_class.create! data
264
295
  expect(model).to be_persisted
265
296
  end
@@ -268,54 +299,55 @@ describe Acfs::Resource::Persistence do
268
299
  context 'with invalid data' do
269
300
  let(:data) { {name: nil, age: 12} }
270
301
 
271
- it 'should raise an error' do
302
+ it 'raises an error' do
272
303
  expect { model_class.create! data }.to \
273
- raise_error(::Acfs::InvalidResource) do |error|
274
- expect(error.errors).to be == {'name' => %w[required]}
304
+ raise_error(Acfs::InvalidResource) do |error|
305
+ expect(error.errors).to eq({'name' => %w[required]})
275
306
  end
276
307
  end
277
308
  end
278
309
  end
279
310
 
280
311
  describe '.create' do
281
- subject { model_class.create data }
312
+ subject(:model) { model_class.create data }
282
313
 
283
314
  context 'with valid data' do
284
315
  let(:data) { {name: 'Idefix', age: 12} }
285
316
 
286
- it 'should create new resource' do
287
- expect(subject.name).to be == 'Idefix'
288
- expect(subject.age).to be == 12
317
+ it 'creates new resource' do
318
+ expect(model.name).to eq 'Idefix'
319
+ expect(model.age).to eq 12
289
320
  end
290
321
 
291
- it 'should be persisted' do
292
- expect(subject).to be_persisted
322
+ it 'is persisted' do
323
+ expect(model).to be_persisted
293
324
  end
294
325
  end
295
326
 
296
327
  context 'with invalid data' do
297
328
  let(:data) { {name: nil, age: 12} }
298
329
 
299
- it 'should return not persisted resource' do
300
- expect(subject).to_not be_persisted
330
+ it 'returns not persisted resource' do
331
+ expect(model).not_to be_persisted
301
332
  end
302
333
 
303
- it 'should contain error hash' do
304
- expect(subject.errors.to_hash).to eq name: %w[required]
334
+ it 'contains error hash' do
335
+ expect(model.errors.to_hash).to eq name: %w[required]
305
336
  end
306
337
  end
307
338
 
308
339
  context 'with additional data' do
309
- let!(:req) do
340
+ before do
310
341
  stub_request(:post, 'http://users.example.org/users')
311
342
  .with(body: '{"id":null,"name":"Anon","age":9,"born_at":"today"}')
312
343
  .to_return response(id: 5, name: 'Anon', age: 9)
313
344
  end
345
+
314
346
  let(:data) { {age: 9, born_at: 'today'} }
315
347
 
316
- it 'should store them in attributes' do
317
- expect(subject.attributes).to eq 'id' => 5, 'name' => 'Anon',
318
- 'age' => 9, 'born_at' => 'today'
348
+ it 'stores them in attributes' do
349
+ expect(model.attributes).to eq 'id' => 5, 'name' => 'Anon',
350
+ 'age' => 9, 'born_at' => 'today'
319
351
  end
320
352
  end
321
353
  end