diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..36c9214 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,26 @@ +name: tests + +on: + push: + branches: [master] + pull_request: + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + gemfile: [rails_7_2, rails_8_0, rails_8_1] + env: + BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile + steps: + - uses: actions/checkout@v4 + # reads the ruby version from .ruby-version + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - run: bundle exec rake diff --git a/.ruby-version b/.ruby-version index 77fee73..6c165c2 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -1.9.3 +3.3.13 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..76e3cf2 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +# mirrors .ruby-version so mise loads the repo-local version; keep the two in sync +ruby 3.3.13 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a1dfbfd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -language: ruby -rvm: - - "1.9.3" - - "2.0" - - "2.1" - - "2.2" - - "2.3" - - "2.4" - - "2.5" -env: - - RAILS_VERSION="" - - RAILS_VERSION="~>3.2.0" - - RAILS_VERSION="~>3.1.0" - - RAILS_VERSION="~>3.0.0" - - RAILS_VERSION="~>4.0.0" - - RAILS_VERSION="~>4.1.0" - - RAILS_VERSION="~>4.2.0" - - RAILS_VERSION="~>5.0.0" - - RAILS_VERSION="~>5.1.0" - - RAILS_VERSION="~>5.2.0" - - RAILS_VERSION="" MONETA_VERSION="~> 0.6.0" - - RAILS_VERSION="" MONETA_VERSION="~> 0.7.0" -notifications: - email: - - sutto@sutto.net diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cfc601..d81a73d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ **Please Note**: This change log only covers v1.3 forwards - apologies for anything missing prior to that. +## Version 1.13.3 (cloud66 fork) + +* Support for Rails 8.1: removed the unused `protected_instance_variables` setting, which relied on `config_accessor`, and the `api` / `rocket_pants` routes helper now passes its options to `scope` as keywords. +* **Breaking:** JSONP support is removed. It has not worked since Rails 5.1, and calling `jsonp` now raises `NotImplementedError` when the controller class is loaded. +* `RocketPants::Client` accepts the response object returned by current HTTParty versions again. +* The gemspec now requires Ruby 3.3 or newer and Rails 7.2 or newer, which is what the fork is tested on. +* The `api` / `rocket_pants` routes helper accepts string-keyed options. +* `RocketPants::Client` raises `RocketPants::Error` for a malformed JSON body. +* The specs run against Rails 7.2, 8.0 and 8.1 (see "Running the tests" in the README), including a suite that boots a real Rails application, and raise on any Rails deprecation. + ## Version 1.13.1 * Bug fix to bugsnag, thanks to [DamirSvrtan](https://github.com/DamirSvrtan). diff --git a/Gemfile b/Gemfile index 93bfc47..3c2aaff 100644 --- a/Gemfile +++ b/Gemfile @@ -1,25 +1,7 @@ source 'https://rubygems.org' -# Allow testing multiple versions with Travis. -rails_version = ENV['RAILS_VERSION'] -if rails_version && rails_version.length > 0 - puts "Testing Rails Version = #{rails_version}" - # Override the specific versions - gem 'railties', rails_version - gem 'actionpack', rails_version - gem 'activerecord', rails_version -end - -if (moneta_version = ENV["MONETA_VERSION"]) - gem 'moneta', moneta_version -end - +# the supported rails versions each have their own gemfile under gemfiles/; see the README. gem 'rspec' - -if (wp_version = ENV['WILL_PAGINATE_VERSION']) - gem 'will_paginate', wp_version -end - -gem 'active_model_serializers', ENV['AMS_VERSION'] || '> 0.0' +gem 'active_model_serializers', '> 0.0' gemspec diff --git a/README.md b/README.md index f54cf5e..ba942ba 100644 --- a/README.md +++ b/README.md @@ -104,24 +104,7 @@ with the `Etag` header set. #### JSONP -If you want to enable JSONP support, it's as simple as calling `jsonp` in your class method: - -```ruby -class MyController < RocketPants::Base - jsonp -end -``` - -By default this will use the `callback` parameter, e.g. `GET /1/my?callback=console.log`. -To change this parameter, specify the `parameter` option like so: - -```ruby -class MyController < RocketPants::Base - jsonp :parameter => :jsonp -end -``` - -Finally, to disable it in a subclass, simple call `jsonp` in the child and pass `:enable => false` as an option. +JSONP is **not supported** in this fork. The original implementation relied on controller callbacks that Rails removed in 5.1, so it has not worked for a long time. Calling `jsonp` in a controller now raises `NotImplementedError` as soon as the class is loaded, with a message naming the controller, so it cannot be switched on by mistake. #### Header Metadata @@ -696,6 +679,27 @@ Inside the `RSpec.configure do |config|` block. If you're not on this list and thing you should be, let @Sutto know. +## Running the tests + +This fork is tested against Rails 7.2, 8.0 and 8.1 on the Ruby version in `.ruby-version`. Each Rails version has its own gemfile under `gemfiles/`. GitHub Actions runs all three on every pull request (`.github/workflows/tests.yml`), and `bin/test` does the same locally, refusing to run on a different Ruby version: + +```bash +bin/test +``` + +To run against one Rails version: + +```bash +export BUNDLE_GEMFILE=gemfiles/rails_8_1.gemfile +bundle install +bundle exec rake spec # the main suite +bundle exec rake spec:smoke # boots a real Rails application around the gem +``` + +The `smoke` specs run in their own process because Rails has to be loaded before the gem for its Railtie to be set up. Every Rails deprecation is raised as an error in both suites. + +The kaminari and RSpec matcher integration specs (`spec/integration`) are not maintained in this fork and currently fail. + ## Contributing We encourage all community contributions. Keeping this in mind, please follow these general guidelines when contributing: diff --git a/Rakefile b/Rakefile index ec6adb9..be799c3 100644 --- a/Rakefile +++ b/Rakefile @@ -8,6 +8,8 @@ desc "Run all specs in spec directory (excluding plugin specs)" RSpec::Core::RakeTask.new(:spec) INTEGRATION_LIBS = %w(will_paginate kaminari active_record active_model_serializers rspec) +# kaminari and the rspec matchers are not maintained in this fork, and their specs fail. +MAINTAINED_INTEGRATION_LIBS = INTEGRATION_LIBS - %w(kaminari rspec) namespace :spec do @@ -25,6 +27,12 @@ namespace :spec do end + # separate process: rails must be loaded before rocket_pants for the railtie to exist. + desc "Run the specs that boot a real Rails application" + RSpec::Core::RakeTask.new(:smoke) do |t| + t.pattern = "./smoke/*_spec.rb" + end + desc "Run all specs with rcov" RSpec::Core::RakeTask.new(:rcov) do |t| t.rcov = true @@ -33,4 +41,4 @@ namespace :spec do end end -task :default => ([:spec] + INTEGRATION_LIBS.map { |l| "spec:integration:#{l}" }) +task :default => ([:spec, "spec:smoke"] + MAINTAINED_INTEGRATION_LIBS.map { |l| "spec:integration:#{l}" }) diff --git a/bin/test b/bin/test new file mode 100755 index 0000000..a4935ca --- /dev/null +++ b/bin/test @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# runs the default rake task (specs, smoke and maintained integrations) on every supported rails version. +set -euo pipefail +cd "$(dirname "$0")/.." + +wanted="$(cat .ruby-version)" +actual="$(ruby -e 'print RUBY_VERSION')" +if [ "${actual}" != "${wanted}" ]; then + echo "bin/test needs ruby ${wanted} but found ${actual}; try: mise exec -- bin/test" >&2 + exit 1 +fi + +for gemfile in gemfiles/rails_*.gemfile; do + echo "== ${gemfile}" + export BUNDLE_GEMFILE="${gemfile}" + bundle install --quiet + bundle exec rake +done diff --git a/gemfiles/rails_7_2.gemfile b/gemfiles/rails_7_2.gemfile new file mode 100644 index 0000000..11845bd --- /dev/null +++ b/gemfiles/rails_7_2.gemfile @@ -0,0 +1,13 @@ +source "https://rubygems.org" + +gemspec path: ".." + +gem "railties", "~> 7.2.0" +gem "actionpack", "~> 7.2.0" +gem "activerecord", "~> 7.2.0" + +gem "rspec" +gem "active_model_serializers", "> 0.0" + +# central locks json 2.21.x; on rails 8.1 that selects active support's newer json encoder +gem "json", "~> 2.21" diff --git a/gemfiles/rails_7_2.gemfile.lock b/gemfiles/rails_7_2.gemfile.lock new file mode 100644 index 0000000..af4e489 --- /dev/null +++ b/gemfiles/rails_7_2.gemfile.lock @@ -0,0 +1,359 @@ +PATH + remote: .. + specs: + rocket_pants (1.13.3) + actionpack (>= 7.2) + api_smith + hashie (>= 1.0, < 4) + moneta + railties (>= 7.2) + will_paginate (>= 3.0, < 5) + +GEM + remote: https://rubygems.org/ + specs: + actionpack (7.2.4) + actionview (= 7.2.4) + activesupport (= 7.2.4) + cgi + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.3) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actionview (7.2.4) + activesupport (= 7.2.4) + builder (~> 3.1) + cgi + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + active_model_serializers (0.10.16) + actionpack (>= 4.1) + activemodel (>= 4.1) + case_transform (>= 0.2) + jsonapi-renderer (>= 0.1.1.beta1, < 0.3) + activemodel (7.2.4) + activesupport (= 7.2.4) + activerecord (7.2.4) + activemodel (= 7.2.4) + activesupport (= 7.2.4) + timeout (>= 0.4.0) + activesupport (7.2.4) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5, < 3) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1, < 6) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + addressable (2.9.2) + public_suffix (>= 2.0.2, < 8.0) + api_smith (1.3.0) + hashie (>= 1.0, < 3.0) + httparty + base64 (0.3.0) + benchmark (0.5.0) + bigdecimal (4.1.3) + builder (3.3.0) + case_transform (0.2) + activesupport + cgi (0.5.2) + concurrent-ruby (1.3.8) + connection_pool (2.5.5) + crack (1.0.1) + bigdecimal + rexml + crass (1.0.8) + csv (3.3.7) + diff-lcs (1.6.2) + drb (2.2.3) + erb (6.0.7) + erubi (1.13.1) + hashdiff (1.2.2) + hashie (2.1.2) + httparty (0.24.3) + csv + mini_mime (>= 1.0.0) + multi_xml (>= 0.5.2) + i18n (1.15.2) + concurrent-ruby (~> 1.0) + io-console (0.9.5) + irb (1.19.0) + pp (>= 0.6.0) + prism (>= 1.3.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + json (2.21.2) + jsonapi-renderer (0.2.2) + kaminari (1.3.3) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.3.3) + kaminari-activerecord (= 1.3.3) + kaminari-core (= 1.3.3) + kaminari-actionview (1.3.3) + actionview + kaminari-core (= 1.3.3) + kaminari-activerecord (1.3.3) + activerecord + kaminari-core (= 1.3.3) + kaminari-core (1.3.3) + logger (1.7.0) + loofah (2.25.3) + crass (~> 1.0.2) + nokogiri (>= 1.19.5) + mini_mime (1.1.5) + minitest (5.27.0) + moneta (1.6.0) + multi_xml (0.9.1) + bigdecimal (>= 3.1, < 5) + nokogiri (1.19.7-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.7-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.19.7-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.7-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.19.7-arm64-darwin) + racc (~> 1.4) + nokogiri (1.19.7-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.19.7-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.7-x86_64-linux-musl) + racc (~> 1.4) + pp (0.6.4) + prettyprint + prettyprint (0.2.1) + prism (2.1.0-aarch64-linux-gnu) + prism (2.1.0-aarch64-linux-musl) + prism (2.1.0-arm-linux-gnu) + prism (2.1.0-arm-linux-musl) + prism (2.1.0-arm64-darwin) + prism (2.1.0-x86_64-darwin) + prism (2.1.0-x86_64-linux-gnu) + prism (2.1.0-x86_64-linux-musl) + public_suffix (7.0.5) + racc (1.8.1) + rack (3.2.8) + rack-session (2.1.2) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.3.0) + rack (>= 1.3) + rackup (2.3.1) + rack (>= 3) + rails-dom-testing (2.3.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.7.2) + loofah (~> 2.25, >= 2.25.3) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (7.2.4) + actionpack (= 7.2.4) + activesupport (= 7.2.4) + cgi + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) + zeitwerk (~> 2.6) + rake (13.4.2) + rbs (4.2.0) + logger + prism (>= 1.6.0) + tsort + rdoc (8.1.0) + erb + prism (>= 1.6.0) + rbs (>= 4.0.0) + tsort + reline (0.7.0) + io-console (~> 0.5) + reversible_data (1.0.0) + activerecord + activesupport + rexml (3.4.4) + rr (3.1.2) + rspec (3.13.2) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.7) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.9) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-rails (8.1.0) + actionpack (>= 7.2) + activesupport (>= 7.2) + railties (>= 7.2) + rspec-core (>= 3.13.0, < 5.0.0) + rspec-expectations (>= 3.13.0, < 5.0.0) + rspec-mocks (>= 3.13.0, < 5.0.0) + rspec-support (>= 3.13.0, < 5.0.0) + rspec-support (3.13.8) + securerandom (0.4.1) + sqlite3 (2.10.2-aarch64-linux-gnu) + sqlite3 (2.10.2-aarch64-linux-musl) + sqlite3 (2.10.2-arm-linux-gnu) + sqlite3 (2.10.2-arm-linux-musl) + sqlite3 (2.10.2-arm64-darwin) + sqlite3 (2.10.2-x86_64-darwin) + sqlite3 (2.10.2-x86_64-linux-gnu) + sqlite3 (2.10.2-x86_64-linux-musl) + thor (1.5.0) + timeout (0.6.1) + tsort (0.2.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + useragent (0.16.11) + webmock (3.34.0) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + will_paginate (4.0.1) + zeitwerk (2.8.3) + +PLATFORMS + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + actionpack (~> 7.2.0) + active_model_serializers (> 0.0) + activerecord (~> 7.2.0, >= 7.2) + json (~> 2.21) + kaminari + railties (~> 7.2.0) + reversible_data (~> 1.0) + rocket_pants! + rr (>= 3.0) + rspec (>= 2.4, >= 0) + rspec-rails (>= 2.4) + sqlite3 + webmock + +CHECKSUMS + actionpack (7.2.4) sha256=c7acf80263cf09125e5c4d866abda3536cc941f436e81673f17be11ad407a4eb + actionview (7.2.4) sha256=6005a3427881b2e8f509a5f7ed894e66f256410f734f7a227d01c4d3d9cb06a2 + active_model_serializers (0.10.16) sha256=aab6371a27eac08fac0c0d57c8207c4e08127515a7394d28eafbaabbedcc061a + activemodel (7.2.4) sha256=c6a2f2290fdf8728b596fba1fc528e65852c6e015ccc385ddf0f93c455588773 + activerecord (7.2.4) sha256=b3549deb6a4c469e0cb652194cf566b6010f1f1796404b4213d8b47469d411e5 + activesupport (7.2.4) sha256=b97027b31e111675dba67b86edcd589acc25a0dddf8eecacca18d33a703a0788 + addressable (2.9.2) sha256=9117c7e7d6ee07230e75ce41fb9401ae55354dc654fcd0e862ba41d539e9a610 + api_smith (1.3.0) sha256=9b32e1a74419c065756b276903f9a0eda6f8d3f33ed558a9ef8f1aa632d0bab2 + base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b + benchmark (0.5.0) sha256=465df122341aedcb81a2a24b4d3bd19b6c67c1530713fd533f3ff034e419236c + bigdecimal (4.1.3) sha256=61ebe1e5e559bdc3cc6f2c0ee7f427321fc838f59611c294356eb04d6e21cf66 + builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f + bundler (4.0.16) sha256=d6ca5dd440c24f9abce9844cf44cc8e18c6a553de65a47efb4544137af92c47d + case_transform (0.2) sha256=e2ad4418dceeb227cf474cc332cd5004c95c136c04186c1cceaad8ab8de6fe3b + cgi (0.5.2) sha256=61ca30298171190fd4fa0d8018e57ada456eae9b7a2b78526debf7f0a0e6f8bb + concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1 + connection_pool (2.5.5) sha256=e54ff92855753df1fd7c59fa04a398833355f27dd14c074f8c83a05f72a716ad + crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e + crass (1.0.8) sha256=7a0145c7a2c59f8e7923b3a69ce819c444823a00a5127d805298fea13be24efe + csv (3.3.7) sha256=15a3f16f6628da8664d455eb634e7f22031bcf53044923caf56975109e71b9f8 + diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962 + drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373 + erb (6.0.7) sha256=c5ca6dc25b0ef974a44dc8f59fe847577122483b1968a38dec305c60bf91ee92 + erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9 + hashdiff (1.2.2) sha256=e2e287452b42f18d2a8d82dd48c435e214a81dbadccf49344b956842a3b9127f + hashie (2.1.2) sha256=a9e1e4928bf4f5a5683ea9c7ef29e50fb93f72542f9a9550e205fe33a6568923 + httparty (0.24.3) sha256=5c95cf29ca70d5bfd834e56140ddfca6e94166c3b870cde9c25d157cdb5a00d2 + i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5 + io-console (0.9.5) sha256=83dd9bbf4c4680416629245b39cd4212eb5f4d9a4ea91804870c1f6b846414d5 + irb (1.19.0) sha256=55ee56acbdd6c9fe06a2e6909f46a24e5c41f45f16906bab04e8049cf46f1d27 + json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a + jsonapi-renderer (0.2.2) sha256=b5c44b033d61b4abdb6500fa4ab84807ca0b36ea0e59e47a2c3ca7095a6e447b + kaminari (1.3.3) sha256=92e59eebb4da655136e631435bb339088449183b1c677fc52bc00d4792dfd0de + kaminari-actionview (1.3.3) sha256=c4a3938d920d7149989ec2044580c64256f5280bf441c80bb077c4fd88500960 + kaminari-activerecord (1.3.3) sha256=4d871b4d0014f49c801d5afac386ef62436320df600dd5561313a9acf2163043 + kaminari-core (1.3.3) sha256=3120cbe13f41872a60a9019756a4d957c346d497938efd6c1e560b30c36c95f4 + logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203 + loofah (2.25.3) sha256=545f14eef0cc2a7de80df560530d593232b7c07e515c5c4e37532d9cb5b0185c + mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef + minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5 + moneta (1.6.0) sha256=73f4dfc690399b3e5093d36f3a07c2b2dc174e414fa8e14bd90ab82b2d9644c0 + multi_xml (0.9.1) sha256=7ce766b59c17241ed62976caeae1fae9b2431b263398c35396239a68c4a64e57 + nokogiri (1.19.7-aarch64-linux-gnu) sha256=8f5e15d299602456406e1f03a9f3456cceb33a0722811e818d2ee2214eb4c84a + nokogiri (1.19.7-aarch64-linux-musl) sha256=efe0c3602e6e54521bc21c681930ce5568e2d11203de17400710b2b3ca2e4cb4 + nokogiri (1.19.7-arm-linux-gnu) sha256=7fd1907125691aa89e838cc91161761c758b4e17bb32f0dd9b5515a82cc759af + nokogiri (1.19.7-arm-linux-musl) sha256=28d0ff0c87b6bb2e56580323a6fb049d5d4a02b94f0958fdd47e9ac146991c77 + nokogiri (1.19.7-arm64-darwin) sha256=f27d7f25f4873fbc3aa35a2cc2fb680c98555fec1925348da439d0869d541142 + nokogiri (1.19.7-x86_64-darwin) sha256=508e81e8c5f84aaa240dce981bf1c43faae60808726f0ce7024ee92effc5cafe + nokogiri (1.19.7-x86_64-linux-gnu) sha256=25865ccb462f714e712fdf8906fde07849cb6704a808e3d629d75baa5af5dd3b + nokogiri (1.19.7-x86_64-linux-musl) sha256=464d1f3dfb0d53cf54c0c6a7e23e8e91cf68ec3cafc2b27dc4a7682f2d9bf546 + pp (0.6.4) sha256=dfcb0fce700c41456265922884f9fe195d7fbb0674a3578e6c0f69588e82b570 + prettyprint (0.2.1) sha256=d555d57ea6d7cf001d4774b693546a6bd88bec1e778ddffb5c60b68ceec4b7d4 + prism (2.1.0-aarch64-linux-gnu) sha256=808dddc72def68e1a0463689414c97e0ba211938eddbab05387a4844aa2b3ec2 + prism (2.1.0-aarch64-linux-musl) sha256=dd1a0732620c1e575dabb07a297a62911fabd72f8e20ce850b522a866f877930 + prism (2.1.0-arm-linux-gnu) sha256=96b2426b9dbab05448c4add735619929042be3cd7e871ff186468121b62bcfa8 + prism (2.1.0-arm-linux-musl) sha256=00ef918e42a3dc98f11a461bf473586a3424b0f78bee8a4e43b5a65a5f5e2cd0 + prism (2.1.0-arm64-darwin) sha256=2d0c2e3e011cfd89c041940907d3ff3def379d7b0f2ba158d1d42238e8ad8afc + prism (2.1.0-x86_64-darwin) sha256=6c645d8e6afc742956c7518220ce5106367727c4d9980ac9ab386d55004ddab4 + prism (2.1.0-x86_64-linux-gnu) sha256=b2b647afce09551e650b8bb3e2fc91d7d73d392a09534ca307ec0d619c33bfd4 + prism (2.1.0-x86_64-linux-musl) sha256=249f45981726923e259b927902246219fa25ad10a76f43849c9aee1a3d3ec5b8 + public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623 + racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f + rack (3.2.8) sha256=1fecc85e463ebc7a2a945fff829ffcd549babeb1556384796fad946c28dc4ec7 + rack-session (2.1.2) sha256=595434f8c0c3473ae7d7ac56ecda6cc6dfd9d37c0b2b5255330aa1576967ffe8 + rack-test (2.3.0) sha256=b118d177cc002c572fc1b6fd8d19c9ed5881a36e8d6f689f9e618f9f861241e8 + rackup (2.3.1) sha256=6c79c26753778e90983761d677a48937ee3192b3ffef6bc963c0950f94688868 + rails-dom-testing (2.3.0) sha256=8acc7953a7b911ca44588bf08737bc16719f431a1cc3091a292bca7317925c1d + rails-html-sanitizer (1.7.2) sha256=a21ef45b7a6639fc8e2282473c547514cb86ae271616162a946bf89148fa2424 + railties (7.2.4) sha256=e4b754edc7b42c9f3d6cc3048832efe634d727aa59093a03bf8a78096917f121 + rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701 + rbs (4.2.0) sha256=51f7b886dcc05bc09e10b901daa6a81829f6adc03101d6ca9ea4aac6103e0674 + rdoc (8.1.0) sha256=befc37880a5cfd36dcb176c748b5fd5ee39dd3536a75e81824e4972ce230f60a + reline (0.7.0) sha256=5b012d8e55dbf9d450f12bde2cf7d15ff546ae80b3f8f3b30e570d431815583d + reversible_data (1.0.0) sha256=84a2344787b8c9ea2b5f4ef8762a273fd1cff575a23344a13ee96d95e53b68d4 + rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 + rocket_pants (1.13.3) + rr (3.1.2) sha256=cc4a5cc91f012327d317dc661154419f9d36d8f9c05031ac46accd89ceb0ff1b + rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587 + rspec-core (3.13.7) sha256=c64ff16d9788119805cbc6a3f4b6d87cc22417c2d25976a3330de136896b5469 + rspec-expectations (3.13.6) sha256=bf538ca6d367ff5b0d85a87fdb5c0c6038f2cd1308a0eeba07476caa02d22f35 + rspec-mocks (3.13.9) sha256=ea5c7ff3054a6098ca6039aacef80aec69d5a8a3ef80be8fc88337359b672a30 + rspec-rails (8.1.0) sha256=5e6c6a4e7f7d644b56e412d410824f6480c1e5a9c61b8448998236b4a4dbf3be + rspec-support (3.13.8) sha256=e4160030309b7e3e9d9863dfe720a35dfcc577162f5402cd68fc8c5258a0ffd6 + securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 + sqlite3 (2.10.2-aarch64-linux-gnu) sha256=e9aea2c2b3476fc875dd8a89313a9a2862818519c0186bfb5b56d6f57bb08d98 + sqlite3 (2.10.2-aarch64-linux-musl) sha256=4986fc40cdf21342362b72a941df28e95cfe0e644f3ad2532d948b157c39dbee + sqlite3 (2.10.2-arm-linux-gnu) sha256=762f609ef891463226b472d3df66aea84d5466ff4376d3ccf4a059718c4ce9c9 + sqlite3 (2.10.2-arm-linux-musl) sha256=833623eaf1157b1b85d1c0830e3e8f9beb3bb95a9bec3d252f20557a50e9803a + sqlite3 (2.10.2-arm64-darwin) sha256=5b0d235ea037e6dcd1b8387a19d73be571917db9f93044d35741cf933a21a37d + sqlite3 (2.10.2-x86_64-darwin) sha256=fd2c67b49d313031af112e172c83ab321681a2b4996bf882eefac50be7bea08f + sqlite3 (2.10.2-x86_64-linux-gnu) sha256=ca92731ab464df9cae503fa1a439a549e2724f6953c8c05a7769b59366e38f15 + sqlite3 (2.10.2-x86_64-linux-musl) sha256=b9f8fc62f3e0eb8966b41de251b492b4c8e9d1b23559beb6e150ad7f8d590941 + thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73 + timeout (0.6.1) sha256=78f57368a7e7bbadec56971f78a3f5ecbcfb59b7fcbb0a3ed6ddc08a5094accb + tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f + tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b + useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844 + webmock (3.34.0) sha256=72eed29dc8c00148d592acaedaaa6b869e2e397de57dfc8602b84aa834f46b33 + will_paginate (4.0.1) sha256=107b226ebe1d393d274575956a7c472e1eefdd97d8828e01b72d425d15a875b9 + zeitwerk (2.8.3) sha256=2c85125a8467ce069e20123d1e709a08955c9d29c118c25b46b7b7fafdbb92e5 + +BUNDLED WITH + 4.0.16 diff --git a/gemfiles/rails_8_0.gemfile b/gemfiles/rails_8_0.gemfile new file mode 100644 index 0000000..446ff37 --- /dev/null +++ b/gemfiles/rails_8_0.gemfile @@ -0,0 +1,13 @@ +source "https://rubygems.org" + +gemspec path: ".." + +gem "railties", "~> 8.0.0" +gem "actionpack", "~> 8.0.0" +gem "activerecord", "~> 8.0.0" + +gem "rspec" +gem "active_model_serializers", "> 0.0" + +# central locks json 2.21.x; on rails 8.1 that selects active support's newer json encoder +gem "json", "~> 2.21" diff --git a/gemfiles/rails_8_0.gemfile.lock b/gemfiles/rails_8_0.gemfile.lock new file mode 100644 index 0000000..f09a9a9 --- /dev/null +++ b/gemfiles/rails_8_0.gemfile.lock @@ -0,0 +1,358 @@ +PATH + remote: .. + specs: + rocket_pants (1.13.3) + actionpack (>= 7.2) + api_smith + hashie (>= 1.0, < 4) + moneta + railties (>= 7.2) + will_paginate (>= 3.0, < 5) + +GEM + remote: https://rubygems.org/ + specs: + actionpack (8.0.5.2) + actionview (= 8.0.5.2) + activesupport (= 8.0.5.2) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actionview (8.0.5.2) + activesupport (= 8.0.5.2) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6, >= 1.7.2) + active_model_serializers (0.10.16) + actionpack (>= 4.1) + activemodel (>= 4.1) + case_transform (>= 0.2) + jsonapi-renderer (>= 0.1.1.beta1, < 0.3) + activemodel (8.0.5.2) + activesupport (= 8.0.5.2) + activerecord (8.0.5.2) + activemodel (= 8.0.5.2) + activesupport (= 8.0.5.2) + timeout (>= 0.4.0) + activesupport (8.0.5.2) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + addressable (2.9.2) + public_suffix (>= 2.0.2, < 8.0) + api_smith (1.3.0) + hashie (>= 1.0, < 3.0) + httparty + base64 (0.3.0) + benchmark (0.5.0) + bigdecimal (4.1.3) + builder (3.3.0) + case_transform (0.2) + activesupport + concurrent-ruby (1.3.8) + connection_pool (3.0.2) + crack (1.0.1) + bigdecimal + rexml + crass (1.0.8) + csv (3.3.7) + diff-lcs (1.6.2) + drb (2.2.3) + erb (6.0.7) + erubi (1.13.1) + hashdiff (1.2.2) + hashie (2.1.2) + httparty (0.24.3) + csv + mini_mime (>= 1.0.0) + multi_xml (>= 0.5.2) + i18n (1.15.2) + concurrent-ruby (~> 1.0) + io-console (0.9.5) + irb (1.19.0) + pp (>= 0.6.0) + prism (>= 1.3.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + json (2.21.2) + jsonapi-renderer (0.2.2) + kaminari (1.3.3) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.3.3) + kaminari-activerecord (= 1.3.3) + kaminari-core (= 1.3.3) + kaminari-actionview (1.3.3) + actionview + kaminari-core (= 1.3.3) + kaminari-activerecord (1.3.3) + activerecord + kaminari-core (= 1.3.3) + kaminari-core (1.3.3) + logger (1.7.0) + loofah (2.25.3) + crass (~> 1.0.2) + nokogiri (>= 1.19.5) + mini_mime (1.1.5) + minitest (6.1.0) + drb (~> 2.0) + prism (>= 1.5, < 3) + moneta (1.6.0) + multi_xml (0.9.1) + bigdecimal (>= 3.1, < 5) + nokogiri (1.19.7-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.7-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.19.7-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.7-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.19.7-arm64-darwin) + racc (~> 1.4) + nokogiri (1.19.7-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.19.7-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.7-x86_64-linux-musl) + racc (~> 1.4) + pp (0.6.4) + prettyprint + prettyprint (0.2.1) + prism (2.1.0-aarch64-linux-gnu) + prism (2.1.0-aarch64-linux-musl) + prism (2.1.0-arm-linux-gnu) + prism (2.1.0-arm-linux-musl) + prism (2.1.0-arm64-darwin) + prism (2.1.0-x86_64-darwin) + prism (2.1.0-x86_64-linux-gnu) + prism (2.1.0-x86_64-linux-musl) + public_suffix (7.0.5) + racc (1.8.1) + rack (3.2.8) + rack-session (2.1.2) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.3.0) + rack (>= 1.3) + rackup (2.3.1) + rack (>= 3) + rails-dom-testing (2.3.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.7.2) + loofah (~> 2.25, >= 2.25.3) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.0.5.2) + actionpack (= 8.0.5.2) + activesupport (= 8.0.5.2) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) + zeitwerk (~> 2.6) + rake (13.4.2) + rbs (4.2.0) + logger + prism (>= 1.6.0) + tsort + rdoc (8.1.0) + erb + prism (>= 1.6.0) + rbs (>= 4.0.0) + tsort + reline (0.7.0) + io-console (~> 0.5) + reversible_data (1.0.0) + activerecord + activesupport + rexml (3.4.4) + rr (3.1.2) + rspec (3.13.2) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.7) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.9) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-rails (8.1.0) + actionpack (>= 7.2) + activesupport (>= 7.2) + railties (>= 7.2) + rspec-core (>= 3.13.0, < 5.0.0) + rspec-expectations (>= 3.13.0, < 5.0.0) + rspec-mocks (>= 3.13.0, < 5.0.0) + rspec-support (>= 3.13.0, < 5.0.0) + rspec-support (3.13.8) + securerandom (0.4.1) + sqlite3 (2.10.2-aarch64-linux-gnu) + sqlite3 (2.10.2-aarch64-linux-musl) + sqlite3 (2.10.2-arm-linux-gnu) + sqlite3 (2.10.2-arm-linux-musl) + sqlite3 (2.10.2-arm64-darwin) + sqlite3 (2.10.2-x86_64-darwin) + sqlite3 (2.10.2-x86_64-linux-gnu) + sqlite3 (2.10.2-x86_64-linux-musl) + thor (1.5.0) + timeout (0.6.1) + tsort (0.2.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + uri (1.1.2) + useragent (0.16.11) + webmock (3.34.0) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + will_paginate (4.0.1) + zeitwerk (2.8.3) + +PLATFORMS + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + actionpack (~> 8.0.0) + active_model_serializers (> 0.0) + activerecord (~> 8.0.0, >= 7.2) + json (~> 2.21) + kaminari + railties (~> 8.0.0) + reversible_data (~> 1.0) + rocket_pants! + rr (>= 3.0) + rspec (>= 2.4, >= 0) + rspec-rails (>= 2.4) + sqlite3 + webmock + +CHECKSUMS + actionpack (8.0.5.2) sha256=5b96a0a841192954151047b4f6e8d992d56f767922e53b9e2c94449a26aebd61 + actionview (8.0.5.2) sha256=8bba8b4a165a555eda0d9bf1c035de0644a77b6700fc5f214a7c0f75ae241cab + active_model_serializers (0.10.16) sha256=aab6371a27eac08fac0c0d57c8207c4e08127515a7394d28eafbaabbedcc061a + activemodel (8.0.5.2) sha256=8aabf86d1dc1516f47329d0cc8d61dea2af9652606e1bbfa467558bef615f375 + activerecord (8.0.5.2) sha256=f2abc9288493a2ca9617a2287c229daad425d2eeb74f44027a8cdb3b46055d14 + activesupport (8.0.5.2) sha256=673acec3133cc8108a03d5ae0e3a9d0f5c7f818d02db33bcfed527a6c57bcdd1 + addressable (2.9.2) sha256=9117c7e7d6ee07230e75ce41fb9401ae55354dc654fcd0e862ba41d539e9a610 + api_smith (1.3.0) sha256=9b32e1a74419c065756b276903f9a0eda6f8d3f33ed558a9ef8f1aa632d0bab2 + base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b + benchmark (0.5.0) sha256=465df122341aedcb81a2a24b4d3bd19b6c67c1530713fd533f3ff034e419236c + bigdecimal (4.1.3) sha256=61ebe1e5e559bdc3cc6f2c0ee7f427321fc838f59611c294356eb04d6e21cf66 + builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f + bundler (4.0.16) sha256=d6ca5dd440c24f9abce9844cf44cc8e18c6a553de65a47efb4544137af92c47d + case_transform (0.2) sha256=e2ad4418dceeb227cf474cc332cd5004c95c136c04186c1cceaad8ab8de6fe3b + concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1 + connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a + crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e + crass (1.0.8) sha256=7a0145c7a2c59f8e7923b3a69ce819c444823a00a5127d805298fea13be24efe + csv (3.3.7) sha256=15a3f16f6628da8664d455eb634e7f22031bcf53044923caf56975109e71b9f8 + diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962 + drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373 + erb (6.0.7) sha256=c5ca6dc25b0ef974a44dc8f59fe847577122483b1968a38dec305c60bf91ee92 + erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9 + hashdiff (1.2.2) sha256=e2e287452b42f18d2a8d82dd48c435e214a81dbadccf49344b956842a3b9127f + hashie (2.1.2) sha256=a9e1e4928bf4f5a5683ea9c7ef29e50fb93f72542f9a9550e205fe33a6568923 + httparty (0.24.3) sha256=5c95cf29ca70d5bfd834e56140ddfca6e94166c3b870cde9c25d157cdb5a00d2 + i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5 + io-console (0.9.5) sha256=83dd9bbf4c4680416629245b39cd4212eb5f4d9a4ea91804870c1f6b846414d5 + irb (1.19.0) sha256=55ee56acbdd6c9fe06a2e6909f46a24e5c41f45f16906bab04e8049cf46f1d27 + json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a + jsonapi-renderer (0.2.2) sha256=b5c44b033d61b4abdb6500fa4ab84807ca0b36ea0e59e47a2c3ca7095a6e447b + kaminari (1.3.3) sha256=92e59eebb4da655136e631435bb339088449183b1c677fc52bc00d4792dfd0de + kaminari-actionview (1.3.3) sha256=c4a3938d920d7149989ec2044580c64256f5280bf441c80bb077c4fd88500960 + kaminari-activerecord (1.3.3) sha256=4d871b4d0014f49c801d5afac386ef62436320df600dd5561313a9acf2163043 + kaminari-core (1.3.3) sha256=3120cbe13f41872a60a9019756a4d957c346d497938efd6c1e560b30c36c95f4 + logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203 + loofah (2.25.3) sha256=545f14eef0cc2a7de80df560530d593232b7c07e515c5c4e37532d9cb5b0185c + mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef + minitest (6.1.0) sha256=ff373595aa8888631e8a5463986a76b3845346ae6d7fa46e139c1633d418076e + moneta (1.6.0) sha256=73f4dfc690399b3e5093d36f3a07c2b2dc174e414fa8e14bd90ab82b2d9644c0 + multi_xml (0.9.1) sha256=7ce766b59c17241ed62976caeae1fae9b2431b263398c35396239a68c4a64e57 + nokogiri (1.19.7-aarch64-linux-gnu) sha256=8f5e15d299602456406e1f03a9f3456cceb33a0722811e818d2ee2214eb4c84a + nokogiri (1.19.7-aarch64-linux-musl) sha256=efe0c3602e6e54521bc21c681930ce5568e2d11203de17400710b2b3ca2e4cb4 + nokogiri (1.19.7-arm-linux-gnu) sha256=7fd1907125691aa89e838cc91161761c758b4e17bb32f0dd9b5515a82cc759af + nokogiri (1.19.7-arm-linux-musl) sha256=28d0ff0c87b6bb2e56580323a6fb049d5d4a02b94f0958fdd47e9ac146991c77 + nokogiri (1.19.7-arm64-darwin) sha256=f27d7f25f4873fbc3aa35a2cc2fb680c98555fec1925348da439d0869d541142 + nokogiri (1.19.7-x86_64-darwin) sha256=508e81e8c5f84aaa240dce981bf1c43faae60808726f0ce7024ee92effc5cafe + nokogiri (1.19.7-x86_64-linux-gnu) sha256=25865ccb462f714e712fdf8906fde07849cb6704a808e3d629d75baa5af5dd3b + nokogiri (1.19.7-x86_64-linux-musl) sha256=464d1f3dfb0d53cf54c0c6a7e23e8e91cf68ec3cafc2b27dc4a7682f2d9bf546 + pp (0.6.4) sha256=dfcb0fce700c41456265922884f9fe195d7fbb0674a3578e6c0f69588e82b570 + prettyprint (0.2.1) sha256=d555d57ea6d7cf001d4774b693546a6bd88bec1e778ddffb5c60b68ceec4b7d4 + prism (2.1.0-aarch64-linux-gnu) sha256=808dddc72def68e1a0463689414c97e0ba211938eddbab05387a4844aa2b3ec2 + prism (2.1.0-aarch64-linux-musl) sha256=dd1a0732620c1e575dabb07a297a62911fabd72f8e20ce850b522a866f877930 + prism (2.1.0-arm-linux-gnu) sha256=96b2426b9dbab05448c4add735619929042be3cd7e871ff186468121b62bcfa8 + prism (2.1.0-arm-linux-musl) sha256=00ef918e42a3dc98f11a461bf473586a3424b0f78bee8a4e43b5a65a5f5e2cd0 + prism (2.1.0-arm64-darwin) sha256=2d0c2e3e011cfd89c041940907d3ff3def379d7b0f2ba158d1d42238e8ad8afc + prism (2.1.0-x86_64-darwin) sha256=6c645d8e6afc742956c7518220ce5106367727c4d9980ac9ab386d55004ddab4 + prism (2.1.0-x86_64-linux-gnu) sha256=b2b647afce09551e650b8bb3e2fc91d7d73d392a09534ca307ec0d619c33bfd4 + prism (2.1.0-x86_64-linux-musl) sha256=249f45981726923e259b927902246219fa25ad10a76f43849c9aee1a3d3ec5b8 + public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623 + racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f + rack (3.2.8) sha256=1fecc85e463ebc7a2a945fff829ffcd549babeb1556384796fad946c28dc4ec7 + rack-session (2.1.2) sha256=595434f8c0c3473ae7d7ac56ecda6cc6dfd9d37c0b2b5255330aa1576967ffe8 + rack-test (2.3.0) sha256=b118d177cc002c572fc1b6fd8d19c9ed5881a36e8d6f689f9e618f9f861241e8 + rackup (2.3.1) sha256=6c79c26753778e90983761d677a48937ee3192b3ffef6bc963c0950f94688868 + rails-dom-testing (2.3.0) sha256=8acc7953a7b911ca44588bf08737bc16719f431a1cc3091a292bca7317925c1d + rails-html-sanitizer (1.7.2) sha256=a21ef45b7a6639fc8e2282473c547514cb86ae271616162a946bf89148fa2424 + railties (8.0.5.2) sha256=4b43a2c134a1b9887dd9ef659c71f61e8376d18a8fc52a09471979666b919fa6 + rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701 + rbs (4.2.0) sha256=51f7b886dcc05bc09e10b901daa6a81829f6adc03101d6ca9ea4aac6103e0674 + rdoc (8.1.0) sha256=befc37880a5cfd36dcb176c748b5fd5ee39dd3536a75e81824e4972ce230f60a + reline (0.7.0) sha256=5b012d8e55dbf9d450f12bde2cf7d15ff546ae80b3f8f3b30e570d431815583d + reversible_data (1.0.0) sha256=84a2344787b8c9ea2b5f4ef8762a273fd1cff575a23344a13ee96d95e53b68d4 + rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 + rocket_pants (1.13.3) + rr (3.1.2) sha256=cc4a5cc91f012327d317dc661154419f9d36d8f9c05031ac46accd89ceb0ff1b + rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587 + rspec-core (3.13.7) sha256=c64ff16d9788119805cbc6a3f4b6d87cc22417c2d25976a3330de136896b5469 + rspec-expectations (3.13.6) sha256=bf538ca6d367ff5b0d85a87fdb5c0c6038f2cd1308a0eeba07476caa02d22f35 + rspec-mocks (3.13.9) sha256=ea5c7ff3054a6098ca6039aacef80aec69d5a8a3ef80be8fc88337359b672a30 + rspec-rails (8.1.0) sha256=5e6c6a4e7f7d644b56e412d410824f6480c1e5a9c61b8448998236b4a4dbf3be + rspec-support (3.13.8) sha256=e4160030309b7e3e9d9863dfe720a35dfcc577162f5402cd68fc8c5258a0ffd6 + securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 + sqlite3 (2.10.2-aarch64-linux-gnu) sha256=e9aea2c2b3476fc875dd8a89313a9a2862818519c0186bfb5b56d6f57bb08d98 + sqlite3 (2.10.2-aarch64-linux-musl) sha256=4986fc40cdf21342362b72a941df28e95cfe0e644f3ad2532d948b157c39dbee + sqlite3 (2.10.2-arm-linux-gnu) sha256=762f609ef891463226b472d3df66aea84d5466ff4376d3ccf4a059718c4ce9c9 + sqlite3 (2.10.2-arm-linux-musl) sha256=833623eaf1157b1b85d1c0830e3e8f9beb3bb95a9bec3d252f20557a50e9803a + sqlite3 (2.10.2-arm64-darwin) sha256=5b0d235ea037e6dcd1b8387a19d73be571917db9f93044d35741cf933a21a37d + sqlite3 (2.10.2-x86_64-darwin) sha256=fd2c67b49d313031af112e172c83ab321681a2b4996bf882eefac50be7bea08f + sqlite3 (2.10.2-x86_64-linux-gnu) sha256=ca92731ab464df9cae503fa1a439a549e2724f6953c8c05a7769b59366e38f15 + sqlite3 (2.10.2-x86_64-linux-musl) sha256=b9f8fc62f3e0eb8966b41de251b492b4c8e9d1b23559beb6e150ad7f8d590941 + thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73 + timeout (0.6.1) sha256=78f57368a7e7bbadec56971f78a3f5ecbcfb59b7fcbb0a3ed6ddc08a5094accb + tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f + tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b + uri (1.1.2) sha256=89292e98eabbef6248b0a0ed5e7e398e152f83f17560023a6d94a7f492b169fb + useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844 + webmock (3.34.0) sha256=72eed29dc8c00148d592acaedaaa6b869e2e397de57dfc8602b84aa834f46b33 + will_paginate (4.0.1) sha256=107b226ebe1d393d274575956a7c472e1eefdd97d8828e01b72d425d15a875b9 + zeitwerk (2.8.3) sha256=2c85125a8467ce069e20123d1e709a08955c9d29c118c25b46b7b7fafdbb92e5 + +BUNDLED WITH + 4.0.16 diff --git a/gemfiles/rails_8_1.gemfile b/gemfiles/rails_8_1.gemfile new file mode 100644 index 0000000..e8e3982 --- /dev/null +++ b/gemfiles/rails_8_1.gemfile @@ -0,0 +1,13 @@ +source "https://rubygems.org" + +gemspec path: ".." + +gem "railties", "~> 8.1.0" +gem "actionpack", "~> 8.1.0" +gem "activerecord", "~> 8.1.0" + +gem "rspec" +gem "active_model_serializers", "> 0.0" + +# central locks json 2.21.x; on rails 8.1 that selects active support's newer json encoder +gem "json", "~> 2.21" diff --git a/gemfiles/rails_8_1.gemfile.lock b/gemfiles/rails_8_1.gemfile.lock new file mode 100644 index 0000000..14ee2e6 --- /dev/null +++ b/gemfiles/rails_8_1.gemfile.lock @@ -0,0 +1,356 @@ +PATH + remote: .. + specs: + rocket_pants (1.13.3) + actionpack (>= 7.2) + api_smith + hashie (>= 1.0, < 4) + moneta + railties (>= 7.2) + will_paginate (>= 3.0, < 5) + +GEM + remote: https://rubygems.org/ + specs: + actionpack (8.1.4.1) + actionview (= 8.1.4.1) + activesupport (= 8.1.4.1) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actionview (8.1.4.1) + activesupport (= 8.1.4.1) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6, >= 1.7.2) + active_model_serializers (0.10.16) + actionpack (>= 4.1) + activemodel (>= 4.1) + case_transform (>= 0.2) + jsonapi-renderer (>= 0.1.1.beta1, < 0.3) + activemodel (8.1.4.1) + activesupport (= 8.1.4.1) + activerecord (8.1.4.1) + activemodel (= 8.1.4.1) + activesupport (= 8.1.4.1) + timeout (>= 0.4.0) + activesupport (8.1.4.1) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + json + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + addressable (2.9.2) + public_suffix (>= 2.0.2, < 8.0) + api_smith (1.3.0) + hashie (>= 1.0, < 3.0) + httparty + base64 (0.3.0) + bigdecimal (4.1.3) + builder (3.3.0) + case_transform (0.2) + activesupport + concurrent-ruby (1.3.8) + connection_pool (3.0.2) + crack (1.0.1) + bigdecimal + rexml + crass (1.0.8) + csv (3.3.7) + diff-lcs (1.6.2) + drb (2.2.3) + erb (6.0.7) + erubi (1.13.1) + hashdiff (1.2.2) + hashie (2.1.2) + httparty (0.24.3) + csv + mini_mime (>= 1.0.0) + multi_xml (>= 0.5.2) + i18n (1.15.2) + concurrent-ruby (~> 1.0) + io-console (0.9.5) + irb (1.19.0) + pp (>= 0.6.0) + prism (>= 1.3.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + json (2.21.2) + jsonapi-renderer (0.2.2) + kaminari (1.3.3) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.3.3) + kaminari-activerecord (= 1.3.3) + kaminari-core (= 1.3.3) + kaminari-actionview (1.3.3) + actionview + kaminari-core (= 1.3.3) + kaminari-activerecord (1.3.3) + activerecord + kaminari-core (= 1.3.3) + kaminari-core (1.3.3) + logger (1.7.0) + loofah (2.25.3) + crass (~> 1.0.2) + nokogiri (>= 1.19.5) + mini_mime (1.1.5) + minitest (6.1.0) + drb (~> 2.0) + prism (>= 1.5, < 3) + moneta (1.6.0) + multi_xml (0.9.1) + bigdecimal (>= 3.1, < 5) + nokogiri (1.19.7-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.7-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.19.7-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.7-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.19.7-arm64-darwin) + racc (~> 1.4) + nokogiri (1.19.7-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.19.7-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.7-x86_64-linux-musl) + racc (~> 1.4) + pp (0.6.4) + prettyprint + prettyprint (0.2.1) + prism (2.1.0-aarch64-linux-gnu) + prism (2.1.0-aarch64-linux-musl) + prism (2.1.0-arm-linux-gnu) + prism (2.1.0-arm-linux-musl) + prism (2.1.0-arm64-darwin) + prism (2.1.0-x86_64-darwin) + prism (2.1.0-x86_64-linux-gnu) + prism (2.1.0-x86_64-linux-musl) + public_suffix (7.0.5) + racc (1.8.1) + rack (3.2.8) + rack-session (2.1.2) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.3.0) + rack (>= 1.3) + rackup (2.3.1) + rack (>= 3) + rails-dom-testing (2.3.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.7.2) + loofah (~> 2.25, >= 2.25.3) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.1.4.1) + actionpack (= 8.1.4.1) + activesupport (= 8.1.4.1) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) + zeitwerk (~> 2.6) + rake (13.4.2) + rbs (4.2.0) + logger + prism (>= 1.6.0) + tsort + rdoc (8.1.0) + erb + prism (>= 1.6.0) + rbs (>= 4.0.0) + tsort + reline (0.7.0) + io-console (~> 0.5) + reversible_data (1.0.0) + activerecord + activesupport + rexml (3.4.4) + rr (3.1.2) + rspec (3.13.2) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.7) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.9) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-rails (8.1.0) + actionpack (>= 7.2) + activesupport (>= 7.2) + railties (>= 7.2) + rspec-core (>= 3.13.0, < 5.0.0) + rspec-expectations (>= 3.13.0, < 5.0.0) + rspec-mocks (>= 3.13.0, < 5.0.0) + rspec-support (>= 3.13.0, < 5.0.0) + rspec-support (3.13.8) + securerandom (0.4.1) + sqlite3 (2.10.2-aarch64-linux-gnu) + sqlite3 (2.10.2-aarch64-linux-musl) + sqlite3 (2.10.2-arm-linux-gnu) + sqlite3 (2.10.2-arm-linux-musl) + sqlite3 (2.10.2-arm64-darwin) + sqlite3 (2.10.2-x86_64-darwin) + sqlite3 (2.10.2-x86_64-linux-gnu) + sqlite3 (2.10.2-x86_64-linux-musl) + thor (1.5.0) + timeout (0.6.1) + tsort (0.2.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + uri (1.1.2) + useragent (0.16.11) + webmock (3.34.0) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + will_paginate (4.0.1) + zeitwerk (2.8.3) + +PLATFORMS + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + actionpack (~> 8.1.0) + active_model_serializers (> 0.0) + activerecord (~> 8.1.0, >= 7.2) + json (~> 2.21) + kaminari + railties (~> 8.1.0) + reversible_data (~> 1.0) + rocket_pants! + rr (>= 3.0) + rspec (>= 2.4, >= 0) + rspec-rails (>= 2.4) + sqlite3 + webmock + +CHECKSUMS + actionpack (8.1.4.1) sha256=8c6f2e7cbd2653ef0539bde1ff20eb3e2e264e366affe56f0ba7f06d3670cb4b + actionview (8.1.4.1) sha256=d25b4d9cf8d0c0195ffcfe8b2cf3fcbe6fea54fd7c17f1a9cb8182881463f12b + active_model_serializers (0.10.16) sha256=aab6371a27eac08fac0c0d57c8207c4e08127515a7394d28eafbaabbedcc061a + activemodel (8.1.4.1) sha256=063caf105372fbc98b2d789e4be23de63ac5c043f7d9330f04e2caddb7012805 + activerecord (8.1.4.1) sha256=bd65599ca0b5d210937f835d42c7aff69d271741c75aab022730be6cbce67e87 + activesupport (8.1.4.1) sha256=16ac4f341ca65c85a1fcdb8ac73f68891aae9e3c4a6f9c3a27daed8b00017ed7 + addressable (2.9.2) sha256=9117c7e7d6ee07230e75ce41fb9401ae55354dc654fcd0e862ba41d539e9a610 + api_smith (1.3.0) sha256=9b32e1a74419c065756b276903f9a0eda6f8d3f33ed558a9ef8f1aa632d0bab2 + base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b + bigdecimal (4.1.3) sha256=61ebe1e5e559bdc3cc6f2c0ee7f427321fc838f59611c294356eb04d6e21cf66 + builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f + bundler (4.0.16) sha256=d6ca5dd440c24f9abce9844cf44cc8e18c6a553de65a47efb4544137af92c47d + case_transform (0.2) sha256=e2ad4418dceeb227cf474cc332cd5004c95c136c04186c1cceaad8ab8de6fe3b + concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1 + connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a + crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e + crass (1.0.8) sha256=7a0145c7a2c59f8e7923b3a69ce819c444823a00a5127d805298fea13be24efe + csv (3.3.7) sha256=15a3f16f6628da8664d455eb634e7f22031bcf53044923caf56975109e71b9f8 + diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962 + drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373 + erb (6.0.7) sha256=c5ca6dc25b0ef974a44dc8f59fe847577122483b1968a38dec305c60bf91ee92 + erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9 + hashdiff (1.2.2) sha256=e2e287452b42f18d2a8d82dd48c435e214a81dbadccf49344b956842a3b9127f + hashie (2.1.2) sha256=a9e1e4928bf4f5a5683ea9c7ef29e50fb93f72542f9a9550e205fe33a6568923 + httparty (0.24.3) sha256=5c95cf29ca70d5bfd834e56140ddfca6e94166c3b870cde9c25d157cdb5a00d2 + i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5 + io-console (0.9.5) sha256=83dd9bbf4c4680416629245b39cd4212eb5f4d9a4ea91804870c1f6b846414d5 + irb (1.19.0) sha256=55ee56acbdd6c9fe06a2e6909f46a24e5c41f45f16906bab04e8049cf46f1d27 + json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a + jsonapi-renderer (0.2.2) sha256=b5c44b033d61b4abdb6500fa4ab84807ca0b36ea0e59e47a2c3ca7095a6e447b + kaminari (1.3.3) sha256=92e59eebb4da655136e631435bb339088449183b1c677fc52bc00d4792dfd0de + kaminari-actionview (1.3.3) sha256=c4a3938d920d7149989ec2044580c64256f5280bf441c80bb077c4fd88500960 + kaminari-activerecord (1.3.3) sha256=4d871b4d0014f49c801d5afac386ef62436320df600dd5561313a9acf2163043 + kaminari-core (1.3.3) sha256=3120cbe13f41872a60a9019756a4d957c346d497938efd6c1e560b30c36c95f4 + logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203 + loofah (2.25.3) sha256=545f14eef0cc2a7de80df560530d593232b7c07e515c5c4e37532d9cb5b0185c + mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef + minitest (6.1.0) sha256=ff373595aa8888631e8a5463986a76b3845346ae6d7fa46e139c1633d418076e + moneta (1.6.0) sha256=73f4dfc690399b3e5093d36f3a07c2b2dc174e414fa8e14bd90ab82b2d9644c0 + multi_xml (0.9.1) sha256=7ce766b59c17241ed62976caeae1fae9b2431b263398c35396239a68c4a64e57 + nokogiri (1.19.7-aarch64-linux-gnu) sha256=8f5e15d299602456406e1f03a9f3456cceb33a0722811e818d2ee2214eb4c84a + nokogiri (1.19.7-aarch64-linux-musl) sha256=efe0c3602e6e54521bc21c681930ce5568e2d11203de17400710b2b3ca2e4cb4 + nokogiri (1.19.7-arm-linux-gnu) sha256=7fd1907125691aa89e838cc91161761c758b4e17bb32f0dd9b5515a82cc759af + nokogiri (1.19.7-arm-linux-musl) sha256=28d0ff0c87b6bb2e56580323a6fb049d5d4a02b94f0958fdd47e9ac146991c77 + nokogiri (1.19.7-arm64-darwin) sha256=f27d7f25f4873fbc3aa35a2cc2fb680c98555fec1925348da439d0869d541142 + nokogiri (1.19.7-x86_64-darwin) sha256=508e81e8c5f84aaa240dce981bf1c43faae60808726f0ce7024ee92effc5cafe + nokogiri (1.19.7-x86_64-linux-gnu) sha256=25865ccb462f714e712fdf8906fde07849cb6704a808e3d629d75baa5af5dd3b + nokogiri (1.19.7-x86_64-linux-musl) sha256=464d1f3dfb0d53cf54c0c6a7e23e8e91cf68ec3cafc2b27dc4a7682f2d9bf546 + pp (0.6.4) sha256=dfcb0fce700c41456265922884f9fe195d7fbb0674a3578e6c0f69588e82b570 + prettyprint (0.2.1) sha256=d555d57ea6d7cf001d4774b693546a6bd88bec1e778ddffb5c60b68ceec4b7d4 + prism (2.1.0-aarch64-linux-gnu) sha256=808dddc72def68e1a0463689414c97e0ba211938eddbab05387a4844aa2b3ec2 + prism (2.1.0-aarch64-linux-musl) sha256=dd1a0732620c1e575dabb07a297a62911fabd72f8e20ce850b522a866f877930 + prism (2.1.0-arm-linux-gnu) sha256=96b2426b9dbab05448c4add735619929042be3cd7e871ff186468121b62bcfa8 + prism (2.1.0-arm-linux-musl) sha256=00ef918e42a3dc98f11a461bf473586a3424b0f78bee8a4e43b5a65a5f5e2cd0 + prism (2.1.0-arm64-darwin) sha256=2d0c2e3e011cfd89c041940907d3ff3def379d7b0f2ba158d1d42238e8ad8afc + prism (2.1.0-x86_64-darwin) sha256=6c645d8e6afc742956c7518220ce5106367727c4d9980ac9ab386d55004ddab4 + prism (2.1.0-x86_64-linux-gnu) sha256=b2b647afce09551e650b8bb3e2fc91d7d73d392a09534ca307ec0d619c33bfd4 + prism (2.1.0-x86_64-linux-musl) sha256=249f45981726923e259b927902246219fa25ad10a76f43849c9aee1a3d3ec5b8 + public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623 + racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f + rack (3.2.8) sha256=1fecc85e463ebc7a2a945fff829ffcd549babeb1556384796fad946c28dc4ec7 + rack-session (2.1.2) sha256=595434f8c0c3473ae7d7ac56ecda6cc6dfd9d37c0b2b5255330aa1576967ffe8 + rack-test (2.3.0) sha256=b118d177cc002c572fc1b6fd8d19c9ed5881a36e8d6f689f9e618f9f861241e8 + rackup (2.3.1) sha256=6c79c26753778e90983761d677a48937ee3192b3ffef6bc963c0950f94688868 + rails-dom-testing (2.3.0) sha256=8acc7953a7b911ca44588bf08737bc16719f431a1cc3091a292bca7317925c1d + rails-html-sanitizer (1.7.2) sha256=a21ef45b7a6639fc8e2282473c547514cb86ae271616162a946bf89148fa2424 + railties (8.1.4.1) sha256=ff2ef4b5a62cbc89811f88be11c776e2ed71b14dd012eae6a494d37994aa9782 + rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701 + rbs (4.2.0) sha256=51f7b886dcc05bc09e10b901daa6a81829f6adc03101d6ca9ea4aac6103e0674 + rdoc (8.1.0) sha256=befc37880a5cfd36dcb176c748b5fd5ee39dd3536a75e81824e4972ce230f60a + reline (0.7.0) sha256=5b012d8e55dbf9d450f12bde2cf7d15ff546ae80b3f8f3b30e570d431815583d + reversible_data (1.0.0) sha256=84a2344787b8c9ea2b5f4ef8762a273fd1cff575a23344a13ee96d95e53b68d4 + rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 + rocket_pants (1.13.3) + rr (3.1.2) sha256=cc4a5cc91f012327d317dc661154419f9d36d8f9c05031ac46accd89ceb0ff1b + rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587 + rspec-core (3.13.7) sha256=c64ff16d9788119805cbc6a3f4b6d87cc22417c2d25976a3330de136896b5469 + rspec-expectations (3.13.6) sha256=bf538ca6d367ff5b0d85a87fdb5c0c6038f2cd1308a0eeba07476caa02d22f35 + rspec-mocks (3.13.9) sha256=ea5c7ff3054a6098ca6039aacef80aec69d5a8a3ef80be8fc88337359b672a30 + rspec-rails (8.1.0) sha256=5e6c6a4e7f7d644b56e412d410824f6480c1e5a9c61b8448998236b4a4dbf3be + rspec-support (3.13.8) sha256=e4160030309b7e3e9d9863dfe720a35dfcc577162f5402cd68fc8c5258a0ffd6 + securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 + sqlite3 (2.10.2-aarch64-linux-gnu) sha256=e9aea2c2b3476fc875dd8a89313a9a2862818519c0186bfb5b56d6f57bb08d98 + sqlite3 (2.10.2-aarch64-linux-musl) sha256=4986fc40cdf21342362b72a941df28e95cfe0e644f3ad2532d948b157c39dbee + sqlite3 (2.10.2-arm-linux-gnu) sha256=762f609ef891463226b472d3df66aea84d5466ff4376d3ccf4a059718c4ce9c9 + sqlite3 (2.10.2-arm-linux-musl) sha256=833623eaf1157b1b85d1c0830e3e8f9beb3bb95a9bec3d252f20557a50e9803a + sqlite3 (2.10.2-arm64-darwin) sha256=5b0d235ea037e6dcd1b8387a19d73be571917db9f93044d35741cf933a21a37d + sqlite3 (2.10.2-x86_64-darwin) sha256=fd2c67b49d313031af112e172c83ab321681a2b4996bf882eefac50be7bea08f + sqlite3 (2.10.2-x86_64-linux-gnu) sha256=ca92731ab464df9cae503fa1a439a549e2724f6953c8c05a7769b59366e38f15 + sqlite3 (2.10.2-x86_64-linux-musl) sha256=b9f8fc62f3e0eb8966b41de251b492b4c8e9d1b23559beb6e150ad7f8d590941 + thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73 + timeout (0.6.1) sha256=78f57368a7e7bbadec56971f78a3f5ecbcfb59b7fcbb0a3ed6ddc08a5094accb + tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f + tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b + uri (1.1.2) sha256=89292e98eabbef6248b0a0ed5e7e398e152f83f17560023a6d94a7f492b169fb + useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844 + webmock (3.34.0) sha256=72eed29dc8c00148d592acaedaaa6b869e2e397de57dfc8602b84aa834f46b33 + will_paginate (4.0.1) sha256=107b226ebe1d393d274575956a7c472e1eefdd97d8828e01b72d425d15a875b9 + zeitwerk (2.8.3) sha256=2c85125a8467ce069e20123d1e709a08955c9d29c118c25b46b7b7fafdbb92e5 + +BUNDLED WITH + 4.0.16 diff --git a/lib/rocket_pants/base.rb b/lib/rocket_pants/base.rb index f5becdc..fe0a246 100644 --- a/lib/rocket_pants/base.rb +++ b/lib/rocket_pants/base.rb @@ -67,12 +67,6 @@ class Base < ActionController::Metal include mixin end - # Bug fix for rails - include compatibility. - config_accessor :protected_instance_variables - self.protected_instance_variables = %w(@assigns @performed_redirect @performed_render - @variables_added @request_origin @url @parent_controller @action_name - @before_filter_chain_aborted @_headers @_params @_response) - ActiveSupport.run_load_hooks(:rocket_pants, self) # Methods for integration purposes. diff --git a/lib/rocket_pants/client.rb b/lib/rocket_pants/client.rb index faee34d..fe16447 100644 --- a/lib/rocket_pants/client.rb +++ b/lib/rocket_pants/client.rb @@ -123,6 +123,7 @@ def unpack(object, options = {}) # @param [Hash, Object] response the response to check errors on # @raise [RocketPants::Error] a generic error when the type is wrong, or a registered error subclass otherwise. def check_response_errors(response) + response = parsed_body(response) if !response.is_a?(Hash) raise RocketPants::Error, "The response from the server was not in a supported format." elsif response.has_key?("error") @@ -137,6 +138,15 @@ def check_response_errors(response) raise klass.new(*error_messages) end end + + # httparty wraps the body in a response object that is no longer a Hash, and parses it lazily: + # a malformed body only fails here, and must end up as the unsupported format error. + def parsed_body(response) + return response unless response.respond_to?(:parsed_response) + response.parsed_response + rescue JSON::ParserError + nil + end end end \ No newline at end of file diff --git a/lib/rocket_pants/controller/jsonp.rb b/lib/rocket_pants/controller/jsonp.rb index fe74cdc..7894834 100644 --- a/lib/rocket_pants/controller/jsonp.rb +++ b/lib/rocket_pants/controller/jsonp.rb @@ -1,50 +1,19 @@ module RocketPants - # This mixin implements easy JSONP support in your application, - # making it easy for developers to support it in their response. + # jsonp is not supported in this fork: it relied on callbacks removed in rails 5.1, + # so `jsonp` raises an error that says so instead of an unexplained NoMethodError. module JSONP extend ActiveSupport::Concern - included do - class_attribute :_jsonp_parameter - self._jsonp_parameter = :callback - end - module ClassMethods - # Marks the current controller as supporting JSONP-style responses. - # @parameter [Hash{Symbol => Object}] options An optional hash of options to configure the callback. - # Non-specified options are passed to the filter call. - # @option options [Symbol,String] :parameter If set, specifies the param name of the callback. Defaults to :callback. - # @option options [true, false] :enable Whether to enable JSONP. true by default. - def jsonp(options = {}) - enable = options.delete(:enable) { true } - param = options.delete(:parameter).try(:to_sym) - if enable - after_filter :wrap_response_in_jsonp, {:if => :jsonp_is_possible?}.reverse_merge(options) - self._jsonp_parameter = param if param - else - skip_after_filter :wrap_response_in_jsonp, options - end + # @raise [NotImplementedError] always, naming the controller that called it. + def jsonp(*) + raise NotImplementedError, "JSONP is not supported in the cloud66 fork of rocket_pants " \ + "(it has been broken since Rails 5.1). " \ + "Remove the `jsonp` call from #{name || 'this controller'}." end end - private - - def jsonp_is_possible? - request.get? && response.content_type == "application/json" && jsonp_parameter.present? - end - - def jsonp_parameter - params[_jsonp_parameter] - end - - def wrap_response_in_jsonp - # Finally, set up the callback using the JSONP parameter. - response.content_type = 'application/javascript' - response.body = "#{jsonp_parameter}(#{response.body});" - headers['Content-Length'] = (response.body.bytesize).to_s - end - end end diff --git a/lib/rocket_pants/routing.rb b/lib/rocket_pants/routing.rb index 854c669..725fd4d 100644 --- a/lib/rocket_pants/routing.rb +++ b/lib/rocket_pants/routing.rb @@ -7,6 +7,8 @@ module Routing # @option options [Array, Integer] :version the single version to support # @raise [ArgumentError] raised when the version isn't provided. def rocket_pants(options = {}, &blk) + # string keys would be dropped by the keyword splat below, so normalise them first. + options = options.to_hash.symbolize_keys versions = extract_rocket_pants_versions options defaults = {:format => 'json'} @@ -25,7 +27,8 @@ def rocket_pants(options = {}, &blk) :path => ':version', :defaults => defaults }) - scope options, &blk + # keywords, not a positional hash: rails 8.1 deprecates the hash form and 8.2 removes it. + scope(**options, &blk) end alias api rocket_pants diff --git a/rocket_pants.gemspec b/rocket_pants.gemspec index f1ff5a9..6922c45 100644 --- a/rocket_pants.gemspec +++ b/rocket_pants.gemspec @@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib) Gem::Specification.new do |s| s.name = "rocket_pants" - s.version = "1.13.2" + s.version = "1.13.3" s.platform = Gem::Platform::RUBY s.authors = ["Darcy Laycock"] s.email = ["sutto@sutto.net"] @@ -12,18 +12,19 @@ Gem::Specification.new do |s| s.summary = "JSON API love for Rails and ActionController" s.description = "Rocket Pants adds JSON API love to Rails and ActionController, making it simpler to build API-oriented controllers." s.required_rubygems_version = ">= 1.3.6" + s.required_ruby_version = ">= 3.3" - s.add_dependency 'actionpack', '>= 3.0' - s.add_dependency 'railties', '>= 3.0' + s.add_dependency 'actionpack', '>= 7.2' + s.add_dependency 'railties', '>= 7.2' s.add_dependency 'will_paginate', '>= 3.0', '< 5' s.add_dependency 'hashie', '>= 1.0', '< 4' s.add_dependency 'api_smith' s.add_dependency 'moneta' s.add_development_dependency 'rspec', '>= 2.4' s.add_development_dependency 'rspec-rails', '>= 2.4' - s.add_development_dependency 'rr', '~> 1.0' + s.add_development_dependency 'rr', '>= 3.0' s.add_development_dependency 'webmock' - s.add_development_dependency 'activerecord', '>= 3.0' + s.add_development_dependency 'activerecord', '>= 7.2' s.add_development_dependency 'sqlite3' s.add_development_dependency 'reversible_data', '~> 1.0' s.add_development_dependency 'kaminari' diff --git a/smoke/app/controllers/smoke/base_controller.rb b/smoke/app/controllers/smoke/base_controller.rb new file mode 100644 index 0000000..9386509 --- /dev/null +++ b/smoke/app/controllers/smoke/base_controller.rb @@ -0,0 +1,9 @@ +module Smoke + class BaseController < RocketPants::Base + version 1 + + self.exception_notifier_callback = lambda do |controller, exception, request| + SmokeApp::NOTIFIED << exception + end + end +end diff --git a/smoke/app/controllers/smoke/central_style_controller.rb b/smoke/app/controllers/smoke/central_style_controller.rb new file mode 100644 index 0000000..50051a3 --- /dev/null +++ b/smoke/app/controllers/smoke/central_style_controller.rb @@ -0,0 +1,29 @@ +module Smoke + # mirrors how central's Api::RocketPantsLogFixController renders errors through gem internals. + class CentralStyleController < BaseController + rescue_from RocketPants::Error, :with => :render_rocket_pants_error + + def missing + error! :not_found + end + + def expired + error! :trial_expired, "Your trial has expired.", :metadata => {:details => "day 15"} + end + + private + + def render_rocket_pants_error(exception) + normalised_class = exception.class.ancestors.detect do |klass| + klass < StandardError and error_mapping.has_key?(klass) + end + exception = error_mapping[normalised_class].new(exception.message) if normalised_class + self.status = lookup_error_status(exception) + result = { + :error => lookup_error_name(exception).to_s, + :error_description => lookup_error_message(exception) + } + render_json result.merge(lookup_error_metadata(exception)) + end + end +end diff --git a/smoke/app/controllers/smoke/widgets_controller.rb b/smoke/app/controllers/smoke/widgets_controller.rb new file mode 100644 index 0000000..4c103d9 --- /dev/null +++ b/smoke/app/controllers/smoke/widgets_controller.rb @@ -0,0 +1,69 @@ +module Smoke + class WidgetsController < BaseController + before_action :authenticate, :only => :secret + + def single + expose :id => 1, :name => "anvil" + end + + def list + expose [{:id => 1}, {:id => 2}] + end + + def paged + page = WillPaginate::Collection.create(2, 2, 5) { |pager| pager.replace [{:id => 3}, {:id => 4}] } + expose page + end + + def with_metadata + expose({:id => 1}, :metadata => {:ok => true}) + end + + # characters that json encoders escape differently: html entities, a line separator, non-ascii. + def awkward + expose :html => %(Tom & Jerry's), :separator => "a
b", :accent => "café" + end + + def missing + error! :not_found + end + + def expired + error! :trial_expired, "Your trial has expired.", :metadata => {:details => "day 15"} + end + + def boom + raise "kaboom" + end + + def needs_param + expose :name => params.require(:widget) + end + + def nothing + head :no_content + end + + def link + expose :url => single_widget_url + end + + def request_id + expose :request_id => request.request_id + end + + def away + redirect_to "/" + end + + def secret + expose :secret => true + end + + private + + def authenticate + authenticate_or_request_with_http_basic("Smoke") { |user, password| user == "smoke" && password == "test" } + end + end +end diff --git a/smoke/config/initializers/rocket_pants.rb b/smoke/config/initializers/rocket_pants.rb new file mode 100644 index 0000000..b7f3f19 --- /dev/null +++ b/smoke/config/initializers/rocket_pants.rb @@ -0,0 +1 @@ +RocketPants::Errors.register! :trial_expired, :http_status => 402 diff --git a/smoke/config/routes.rb b/smoke/config/routes.rb new file mode 100644 index 0000000..56378ab --- /dev/null +++ b/smoke/config/routes.rb @@ -0,0 +1,22 @@ +# loaded by rails itself at boot, because the smoke app eager loads as central does. +Rails.application.routes.draw do + api :versions => [1, 2], :module => "smoke" do + get "widgets/single", :to => "widgets#single", :as => :single_widget + get "widgets/list", :to => "widgets#list" + get "widgets/paged", :to => "widgets#paged" + get "widgets/with_metadata", :to => "widgets#with_metadata" + get "widgets/awkward", :to => "widgets#awkward" + get "widgets/missing", :to => "widgets#missing" + get "widgets/expired", :to => "widgets#expired" + get "widgets/boom", :to => "widgets#boom" + get "widgets/needs_param", :to => "widgets#needs_param" + get "widgets/nothing", :to => "widgets#nothing" + get "widgets/link", :to => "widgets#link" + get "widgets/request_id", :to => "widgets#request_id" + get "widgets/away", :to => "widgets#away" + get "widgets/secret", :to => "widgets#secret" + + get "central/missing", :to => "central_style#missing" + get "central/expired", :to => "central_style#expired" + end +end diff --git a/smoke/rails_app_spec.rb b/smoke/rails_app_spec.rb new file mode 100644 index 0000000..7be25af --- /dev/null +++ b/smoke/rails_app_spec.rb @@ -0,0 +1,247 @@ +require_relative 'smoke_helper' +require 'rake' + +# bodies are asserted as exact strings on purpose: the envelope is a contract with api clients, +# and the same strings must come out of every supported rails version. +describe 'rocket_pants inside a real Rails application' do + + describe 'booting through the railtie' do + + it 'should insert the cache middleware directly before Rack::Runtime' do + names = Rails.application.middleware.map(&:name) + names.should include 'RocketPants::CacheMiddleware' + names.index('RocketPants::CacheMiddleware').should == names.index('Rack::Runtime') - 1 + end + + it 'should copy the application configuration across' do + RocketPants.caching_enabled?.should be true + RocketPants.pass_through_errors?.should be false + end + + it 'should give controllers the application logger' do + RocketPants::Base.logger.should equal Rails.logger + end + + it 'should include the testing support in the test environment' do + RocketPants::Base.should include ActionController::Testing + end + + it 'should have loaded the controllers at boot' do + Rails.application.config.eager_load.should be true + Smoke.const_defined?(:WidgetsController, false).should be true + end + + it 'should draw the api routes without raising a deprecation' do + paths = Rails.application.routes.routes.map { |route| route.path.spec.to_s } + paths.should include '/:version/widgets/single(.:format)' + end + + it 'should list the registered errors from the rake task' do + Rails.application.load_tasks + output = StringIO.new + original, $stdout = $stdout, output + begin + Rake::Task['rocket_pants:errors'].invoke + ensure + $stdout = original + end + output.string.should include 'not_found' + output.string.should include 'trial_expired' + output.string.should include '402' + end + + end + + describe 'exposing data' do + + it 'should wrap a single object' do + get '/1/widgets/single' + response.status.should == 200 + response.content_type.should == 'application/json; charset=utf-8' + response.body.should == %({"response":{"id":1,"name":"anvil"}}) + response.headers['Content-Length'].should == response.body.bytesize.to_s + end + + it 'should wrap a collection with its count' do + get '/1/widgets/list' + response.status.should == 200 + response.body.should == %({"response":[{"id":1},{"id":2}],"count":2}) + end + + it 'should wrap a paginated collection with its pagination' do + get '/1/widgets/paged' + response.status.should == 200 + response.body.should == %({"response":[{"id":3},{"id":4}],"count":2,) + + %("pagination":{"previous":1,"next":3,"current":2,"per_page":2,"count":5,"pages":3}}) + end + + it 'should merge custom metadata into the envelope' do + get '/1/widgets/with_metadata' + response.body.should == %({"response":{"id":1},"ok":true}) + end + + it 'should escape awkward characters the same way on every rails version' do + get '/1/widgets/awkward' + response.body.should == %q|{"response":{"html":"\u003ca href=\"x\"\u003eTom \u0026 Jerry's\u003c/a\u003e","separator":"a\u2028b","accent":"café"}}| + end + + it 'should build urls that carry the api version' do + get '/1/widgets/link' + json['response']['url'].should == 'http://example.org/1/widgets/single' + end + + it 'should expose the request id' do + get '/1/widgets/request_id' + json['response']['request_id'].should be_present + end + + it 'should return an empty json response for head' do + get '/1/widgets/nothing' + response.status.should == 204 + response.body.should == '' + end + + it 'should redirect' do + get '/1/widgets/away' + response.status.should == 302 + response.headers['Location'].should == 'http://example.org/' + end + + end + + describe 'versioning' do + + it 'should reject a routable version the controller does not support' do + get '/2/widgets/single' + response.status.should == 404 + response.body.should == %({"error":"invalid_version",) + + %("error_description":"This action is not available in the given version of the api."}) + end + + it 'should not route an unknown version' do + get '/3/widgets/single' + response.status.should == 404 + response.content_type.to_s.should_not include 'application/json' + end + + end + + describe 'errors' do + + it 'should render a built in error' do + get '/1/widgets/missing' + response.status.should == 404 + response.content_type.should == 'application/json; charset=utf-8' + response.body.should == %({"error":"not_found","error_description":"The requested resource could not be found."}) + end + + it 'should render a registered error with its status, message and metadata' do + get '/1/widgets/expired' + response.status.should == 402 + response.body.should == %({"error":"trial_expired","error_description":"Your trial has expired.","details":"day 15"}) + end + + it 'should render an unhandled exception as a system error and notify' do + get '/1/widgets/boom' + response.status.should == 500 + json['error'].should == 'system' + SmokeApp::NOTIFIED.map(&:message).should == ['kaboom'] + end + + it 'should map a missing parameter to a bad request' do + get '/1/widgets/needs_param' + response.status.should == 400 + # only the name is asserted: rails 8.1 words the underlying message differently from 7.2. + json['error'].should == 'bad_request' + end + + it 'should render the same bodies through the internals central calls directly' do + get '/1/central/missing' + response.status.should == 404 + response.body.should == %({"error":"not_found","error_description":"The requested resource could not be found."}) + get '/1/central/expired' + response.status.should == 402 + response.body.should == %({"error":"trial_expired","error_description":"Your trial has expired.","details":"day 15"}) + end + + end + + describe 'http basic authentication' do + + it 'should challenge a request without credentials' do + get '/1/widgets/secret' + response.status.should == 401 + response.headers['WWW-Authenticate'].should == 'Basic realm="Smoke"' + end + + it 'should let valid credentials through' do + get '/1/widgets/secret', basic_auth('smoke', 'test') + response.status.should == 200 + response.body.should == %({"response":{"secret":true}}) + end + + end + + describe 'instrumentation' do + + it 'should publish process_action.rocket_pants with the keys central reads' do + payloads = events_for('process_action.rocket_pants') { get '/1/widgets/single?colour=red' } + payloads.size.should == 1 + payload = payloads.first + payload[:controller].should == 'Smoke::WidgetsController' + payload[:action].should == 'single' + payload[:method].should == 'GET' + payload[:path].should == '/1/widgets/single?colour=red' + payload[:status].should == 200 + payload[:formats].should == [:json] + payload[:params]['colour'].should == 'red' + payload[:params]['action'].should == 'single' + payload[:params]['controller'].should == 'smoke/widgets' + end + + it 'should publish start_processing.rocket_pants' do + payloads = events_for('start_processing.rocket_pants') { get '/1/widgets/single' } + payloads.size.should == 1 + payloads.first[:controller].should == 'Smoke::WidgetsController' + end + + it 'should report the status of an error response' do + payloads = events_for('process_action.rocket_pants') { get '/1/widgets/missing' } + payloads.first[:status].should == 404 + end + + it 'should not publish under the action_controller process_action name' do + payloads = events_for('process_action.action_controller') { get '/1/widgets/single' } + payloads.should be_empty + end + + it 'should log the request through the attached log subscriber' do + get '/1/widgets/single' + SmokeApp::LOG.string.should include 'Processing by Smoke::WidgetsController#single' + SmokeApp::LOG.string.should include 'Completed 200 OK' + SmokeApp::LOG.string.should_not include 'Could not log' + end + + end + + describe 'the cache middleware' do + + it 'should pass a request with an unknown etag through' do + get '/1/widgets/single', 'HTTP_IF_NONE_MATCH' => '"widget:stale"' + response.status.should == 200 + end + + it 'should answer not modified for a recorded etag' do + RocketPants.cache['widget'] = 'fresh' + begin + get '/1/widgets/single', 'HTTP_IF_NONE_MATCH' => '"widget:fresh"' + response.status.should == 304 + response.body.should == '' + ensure + RocketPants.cache.delete 'widget' + end + end + + end + +end diff --git a/smoke/smoke_helper.rb b/smoke/smoke_helper.rb new file mode 100644 index 0000000..01d27b9 --- /dev/null +++ b/smoke/smoke_helper.rb @@ -0,0 +1,83 @@ +# boots a real rails application around rocket_pants, in its own process: the main suite +# never loads rails, so the railtie, middleware stack and route loading are only run here. +ENV["RAILS_ENV"] = "test" + +require 'bundler/setup' +require 'stringio' +require 'logger' +# rails must be loaded first: rocket_pants only loads its railtie when Rails::Railtie exists. +require 'rails' +require 'action_controller/railtie' +require 'will_paginate/collection' +require 'rocket_pants' + +module SmokeApp + LOG = StringIO.new + NOTIFIED = [] + + class Application < Rails::Application + config.root = File.expand_path(__dir__) + # central stays on the 7.2 defaults while it moves to rails 8.1. + config.load_defaults 7.2 + # as central does in every environment: controllers and routes load at boot, after + # deprecations have been set to raise, so a deprecation in a class body fails the boot. + config.eager_load = true + config.secret_key_base = "smoke" + config.hosts.clear + config.logger = ActiveSupport::Logger.new(LOG) + config.log_level = :debug + config.active_support.deprecation = :raise + # rails 8.0 alone warns at boot unless this is set, and 8.1 deprecates the setting itself. + config.active_support.to_time_preserves_timezone = :zone if Rails.gem_version.segments.first(2) == [8, 0] + + # production values: the railtie only inserts the cache middleware when caching is on. + config.rocket_pants.use_caching = true + config.rocket_pants.pass_through_errors = false + end + + module Requests + def app_request + Rack::MockRequest.new(Rails.application) + end + + def get(path, env = {}) + @response = app_request.get(path, env) + end + + def response + @response + end + + def json + ActiveSupport::JSON.decode(response.body) + end + + def basic_auth(user, password) + {"HTTP_AUTHORIZATION" => ActionController::HttpAuthentication::Basic.encode_credentials(user, password)} + end + + # collects the payloads of every event matching the pattern while the block runs. + def events_for(pattern) + payloads = [] + callback = lambda { |*args| payloads << ActiveSupport::Notifications::Event.new(*args).payload } + ActiveSupport::Notifications.subscribed(callback, pattern) { yield } + payloads + end + end +end + +SmokeApp::Application.initialize! + +RSpec.configure do |config| + config.include SmokeApp::Requests + + config.expect_with :rspec do |c| + c.syntax = [:should, :expect] + end + + config.before(:each) do + SmokeApp::NOTIFIED.clear + SmokeApp::LOG.truncate(0) + SmokeApp::LOG.rewind + end +end diff --git a/spec/rocket_pants/client_spec.rb b/spec/rocket_pants/client_spec.rb index d3dd02e..3488b75 100644 --- a/spec/rocket_pants/client_spec.rb +++ b/spec/rocket_pants/client_spec.rb @@ -54,31 +54,49 @@ stub_with_fixture :get, 'error?', 'simple_error' expect do client.get 'error' - end.to raise_error + end.to raise_error(RocketPants::Error) end - + it 'should use error description for the exception' do - begin - stub_with_fixture :get, 'error?', 'simple_error' - client.get 'error' - rescue RocketPants::Error => e - error_object = Crack::JSON.parse(api_fixture_json('simple_error')) + stub_with_fixture :get, 'error?', 'simple_error' + error_object = JSON.parse(api_fixture_json('simple_error')) + expect { client.get 'error' }.to raise_error(RocketPants::Error) do |e| e.message.should == error_object["error_description"] end end - + it 'should use error messages for invalid_resource exception' do - begin - stub_with_fixture :get, 'error?', 'invalid_resource_error' - client.get 'error' - rescue RocketPants::Error => e - error_object = Crack::JSON.parse(api_fixture_json('invalid_resource_error')) + stub_with_fixture :get, 'error?', 'invalid_resource_error' + error_object = JSON.parse(api_fixture_json('invalid_resource_error')) + expect { client.get 'error' }.to raise_error(RocketPants::InvalidResource) do |e| e.context.should be_kind_of(Hash) e.errors.should == error_object["messages"] e.message.should == error_object["error_description"] end end + unsupported = "The response from the server was not in a supported format." + + it 'should raise a rocket pants error for a body that is not json' do + stub_api(:get, 'error?').to_return :status => 502, :body => "Bad Gateway", :headers => {'Content-Type' => 'text/html'} + expect { client.get 'error' }.to raise_error(RocketPants::Error, unsupported) + end + + it 'should raise a rocket pants error for malformed json' do + stub_api(:get, 'error?').to_return :status => 200, :body => '{"response": ', :headers => {'Content-Type' => 'application/json'} + expect { client.get 'error' }.to raise_error(RocketPants::Error, unsupported) + end + + it 'should raise a rocket pants error for an empty body' do + stub_api(:get, 'error?').to_return :status => 204, :body => '', :headers => {'Content-Type' => 'application/json'} + expect { client.get 'error' }.to raise_error(RocketPants::Error, unsupported) + end + + it 'should raise a rocket pants error for json that is not an object' do + stub_api(:get, 'error?').to_return :status => 200, :body => '[1, 2]', :headers => {'Content-Type' => 'application/json'} + expect { client.get 'error' }.to raise_error(RocketPants::Error, unsupported) + end + it 'should use the rocket pants error registry' do stub_with_fixture :get, 'error?', 'simple_error' expect do @@ -125,14 +143,14 @@ response.should be_kind_of(WillPaginate::Collection) response.total_pages.should == 5 response.total_entries.should == 20 - response.should == Crack::JSON.parse(api_fixture_json('paginated'))['response'] + response.should == JSON.parse(api_fixture_json('paginated'))['response'] end it 'should correctly unpack arrays of objects' do stub_with_fixture :get, 'test?', 'collection' response = client.get('test') response.should be_kind_of(Array) - response.should == Crack::JSON.parse(api_fixture_json('collection'))['response'] + response.should == JSON.parse(api_fixture_json('collection'))['response'] end end @@ -198,7 +216,7 @@ class Structured < APISmith::Smash it 'should make it easy to set an api host' do add_response_stub stub_request(:get, 'http://localhost:3001/1/test?'), 'simple_object' - client.get('test').should == Crack::JSON.parse(api_fixture_json('simple_object'))['response'] + client.get('test').should == JSON.parse(api_fixture_json('simple_object'))['response'] end end diff --git a/spec/rocket_pants/controller_spec.rb b/spec/rocket_pants/controller_spec.rb index a15a8f2..60fda55 100644 --- a/spec/rocket_pants/controller_spec.rb +++ b/spec/rocket_pants/controller_spec.rb @@ -230,7 +230,7 @@ def object.serializable_hash(*); {:serialised => true}; end it 'should let you override the content type' do stub(TestController).test_data { {:hello => "World"} } - stub(TestController).test_options { {:content_type => Mime::HTML} } + stub(TestController).test_options { {:content_type => Mime[:html]} } get :test_data response.headers['Content-Type'].should =~ /text\/html/ end @@ -346,71 +346,29 @@ def object.serializable_hash(*); {:serialised => true}; end describe 'jsonp support' do - let!(:first_controller) { Class.new(TestController) } - let!(:controller_class) { Class.new(first_controller) } + let!(:controller_class) { Class.new(TestController) } - it 'should let you specify requests as having jsonp' do - controller_class.jsonp - get :echo, :echo => "Hello World" - response.content_type.should include 'application/json' - response.body.should == %({"response":{"echo":"Hello World"}}) - get :echo, :echo => "Hello World", :callback => "test" - response.content_type.should include 'application/javascript' - response.body.should == %|test({"response":{"echo":"Hello World"}});| + it 'should refuse to enable jsonp, saying why and what to do' do + expect { controller_class.jsonp }.to raise_error(NotImplementedError, /JSONP is not supported.*Remove the `jsonp` call/) end - it 'should automatically inherit it' do - first_controller.jsonp :enable => true - get :echo, :echo => "Hello World", :callback => "test" - response.content_type.should include 'application/javascript' - response.body.should == %|test({"response":{"echo":"Hello World"}});| - get :echo, :echo => "Hello World", :other_callback => "test" - response.content_type.should include 'application/json' - response.body.should == %({"response":{"echo":"Hello World"}}) + it 'should refuse jsonp with options' do + expect { controller_class.jsonp :parameter => 'cb' }.to raise_error(NotImplementedError, /JSONP is not supported/) + expect { controller_class.jsonp :only => [:test_data] }.to raise_error(NotImplementedError, /JSONP is not supported/) end - it 'should allow you to disable at a lower level' do - first_controller.jsonp :enable => true - controller_class.jsonp :enable => false - get :echo, :echo => "Hello World", :callback => "test" - response.content_type.should include 'application/json' - response.body.should == %({"response":{"echo":"Hello World"}}) + it 'should refuse an explicit disable too' do + expect { controller_class.jsonp :enable => false }.to raise_error(NotImplementedError, /JSONP is not supported/) end - it 'should let you specify options to it' do - controller_class.jsonp :parameter => 'cb' - get :echo, :echo => "Hello World", :cb => "test" - response.content_type.should include 'application/javascript' - response.body.should == %|test({"response":{"echo":"Hello World"}});| - get :echo, :echo => "Hello World", :callback => "test" - response.content_type.should include 'application/json' - response.body.should == %({"response":{"echo":"Hello World"}}) + it 'should name the controller that called it' do + expect { TestController.jsonp }.to raise_error(NotImplementedError, /from TestController\./) end - it 'should let you specify it on a per action level' do - controller_class.jsonp :only => [:test_data] + it 'should not wrap a response when a callback parameter is given' do get :echo, :echo => "Hello World", :callback => "test" response.content_type.should include 'application/json' response.body.should == %({"response":{"echo":"Hello World"}}) - stub(controller_class).test_data { {"other" => true} } - get :test_data, :callback => "test" - response.content_type.should include 'application/javascript' - response.body.should == %|test({"response":{"other":true}});| - end - - it 'should not wrap non-get actions' do - controller_class.jsonp - post :echo, :echo => "Hello World", :callback => "test" - response.content_type.should include 'application/json' - response.body.should == %({"response":{"echo":"Hello World"}}) - end - - it 'should have the correct content length' do - controller_class.jsonp - get :echo, :echo => "Hello World", :callback => "test" - response.content_type.should include 'application/javascript' - response.body.should == %|test({"response":{"echo":"Hello World"}});| - response.headers['Content-Length'].to_i.should == response.body.bytesize end end diff --git a/spec/rocket_pants/routing_spec.rb b/spec/rocket_pants/routing_spec.rb index bc61576..01099e3 100644 --- a/spec/rocket_pants/routing_spec.rb +++ b/spec/rocket_pants/routing_spec.rb @@ -50,6 +50,43 @@ def expect_options(*args) end + context 'api routes with extra scope options' do + + before :each do + draw_routes do + api :version => 3, :module => 'v3' do + get 'a', :to => 'test#echo' + end + end + end + + it 'should pass the options through to the scope' do + # asserted on the route itself: recognising the path would need a real V3::TestController. + route = router.routes.first + route.path.spec.to_s.should == '/:version/a(.:format)' + route.defaults.should == {:controller => 'v3/test', :action => 'echo', :format => 'json'} + end + + end + + context 'api routes given string keyed options' do + + before :each do + draw_routes do + api({'version' => 3, 'module' => 'v3'}.with_indifferent_access) do + get 'a', :to => 'test#echo' + end + end + end + + it 'should treat them like symbol keys' do + route = router.routes.first + route.path.spec.to_s.should == '/:version/a(.:format)' + route.defaults.should == {:controller => 'v3/test', :action => 'echo', :format => 'json'} + end + + end + context 'api routes with prefix support' do before :each do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4493c75..b0bb85e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -15,10 +15,20 @@ self.include_root_in_json = false end +# loaded here, not by the support files, so its deprecator exists before the loop below. +require 'active_record' + +# central raises on every deprecation in development and test, so the suite must too. +[ActiveSupport, ActionDispatch, ActionController, AbstractController, ActiveModel, ActiveRecord].each do |framework| + framework.deprecator.behavior = :raise +end + Dir[Pathname(__FILE__).dirname.join("support/**/*.rb")].each { |f| require f } RSpec.configure do |config| config.mock_with :rr + # rspec's rr adapter mixes in a module that rr 3 left empty, so the dsl is included directly. + config.include RR::DSL config.include I18nSpecHelper config.include ConfigHelper config.include WebmockResponses diff --git a/spec/support/controller.rb b/spec/support/controller.rb index fd8a8e9..131dacb 100644 --- a/spec/support/controller.rb +++ b/spec/support/controller.rb @@ -71,7 +71,7 @@ def test_error end def test_metadata - expose({:test => true}, :metadata => params[:metadata]) + expose({:test => true}, :metadata => params[:metadata].to_unsafe_h) end def premature_termination diff --git a/spec/support/models.rb b/spec/support/models.rb index e517fb9..83c98e4 100644 --- a/spec/support/models.rb +++ b/spec/support/models.rb @@ -1,5 +1,7 @@ require 'reversible_data' ReversibleData.in_memory! +# active record connects lazily since 7.2, and reversible_data silently skips table creation until connected. +ActiveRecord::Base.connection.verify! ReversibleData.add(:users) do |t| t.integer :age