├── .fasterer.yml
├── .github
├── FUNDING.yml
└── workflows
│ ├── linters.yml
│ ├── specs.yml
│ ├── specs2.yml
│ └── specs3.yml
├── .gitignore
├── .reviewdog.yml
├── .rspec
├── .rubocop.yml
├── Appraisals
├── Gemfile
├── LICENSE.txt
├── Procfile
├── README.md
├── Rakefile
├── activeadmin_active_resource.gemspec
├── bin
├── appraisal
├── fasterer
├── rails
├── rake
├── rspec
└── rubocop
├── examples
├── rails6-admin
│ └── app
│ │ ├── admin
│ │ ├── authors.rb
│ │ ├── dashboard.rb
│ │ ├── posts.rb
│ │ └── tags.rb
│ │ └── models
│ │ ├── application_record.rb
│ │ ├── author.rb
│ │ ├── post.rb
│ │ ├── post_tag.rb
│ │ ├── profile.rb
│ │ └── tag.rb
├── rails6-api
│ ├── app
│ │ ├── controllers
│ │ │ ├── application_controller.rb
│ │ │ ├── authors_controller.rb
│ │ │ ├── posts_controller.rb
│ │ │ └── tags_controller.rb
│ │ └── models
│ │ │ ├── application_record.rb
│ │ │ ├── author.rb
│ │ │ ├── post.rb
│ │ │ ├── post_tag.rb
│ │ │ ├── profile.rb
│ │ │ └── tag.rb
│ ├── config
│ │ └── routes.rb
│ └── db
│ │ └── migrate
│ │ ├── 20180607053251_create_authors.rb
│ │ ├── 20180607053254_create_profiles.rb
│ │ ├── 20180607053255_create_tags.rb
│ │ ├── 20180607053257_create_post_tags.rb
│ │ └── 20180607053739_create_posts.rb
└── roda-api
│ ├── Gemfile
│ ├── Procfile
│ ├── README.md
│ ├── app
│ ├── conf.rb
│ ├── main.rb
│ └── models
│ │ ├── author.rb
│ │ ├── post.rb
│ │ └── tag.rb
│ ├── bin
│ └── setup
│ ├── config.ru
│ └── db
│ ├── migrate
│ ├── 001_create_authors.rb
│ ├── 002_create_tags.rb
│ └── 003_create_posts.rb
│ └── seeds.rb
├── extra
├── .env
├── Dockerfile_26
├── Dockerfile_27
├── Dockerfile_30
├── README.md
└── docker-compose.yml
├── gemfiles
├── rails60_activeadmin_activeresource.gemfile
├── rails60_activeadmin_activeresource.gemfile.lock
├── rails61_activeadmin29_activeresource51.gemfile
├── rails61_activeadmin29_activeresource51.gemfile.lock
├── rails61_activeadmin_activeresource.gemfile
├── rails61_activeadmin_activeresource.gemfile.lock
├── rails70_activeadmin_activeresource.gemfile
└── rails70_activeadmin_activeresource.gemfile.lock
├── lib
├── activeadmin
│ ├── active_resource.rb
│ └── active_resource
│ │ ├── base.rb
│ │ ├── connection.rb
│ │ ├── engine.rb
│ │ ├── results.rb
│ │ └── version.rb
└── activeadmin_active_resource.rb
└── spec
├── dummy
├── Rakefile
├── app
│ ├── admin
│ │ ├── authors.rb
│ │ ├── dashboard.rb
│ │ ├── posts.rb
│ │ └── tags.rb
│ ├── assets
│ │ ├── config
│ │ │ └── manifest.js
│ │ ├── images
│ │ │ └── .keep
│ │ ├── javascripts
│ │ │ └── active_admin.js
│ │ └── stylesheets
│ │ │ ├── active_admin.scss
│ │ │ └── application.css
│ ├── channels
│ │ └── application_cable
│ │ │ ├── channel.rb
│ │ │ └── connection.rb
│ ├── controllers
│ │ ├── application_controller.rb
│ │ └── concerns
│ │ │ └── .keep
│ ├── helpers
│ │ └── application_helper.rb
│ ├── javascript
│ │ └── packs
│ │ │ └── application.js
│ ├── jobs
│ │ └── application_job.rb
│ ├── mailers
│ │ └── application_mailer.rb
│ ├── models
│ │ ├── application_record.rb
│ │ ├── author.rb
│ │ ├── concerns
│ │ │ └── .keep
│ │ ├── post.rb
│ │ ├── post_tag.rb
│ │ ├── profile.rb
│ │ └── tag.rb
│ └── views
│ │ └── layouts
│ │ ├── application.html.erb
│ │ ├── mailer.html.erb
│ │ └── mailer.text.erb
├── bin
│ ├── rails
│ ├── rake
│ └── setup
├── config.ru
├── config
│ ├── application.rb
│ ├── boot.rb
│ ├── cable.yml
│ ├── database.yml
│ ├── environment.rb
│ ├── environments
│ │ └── test.rb
│ ├── initializers
│ │ ├── active_admin.rb
│ │ ├── application_controller_renderer.rb
│ │ ├── assets.rb
│ │ ├── backtrace_silencers.rb
│ │ ├── content_security_policy.rb
│ │ ├── cookies_serializer.rb
│ │ ├── filter_parameter_logging.rb
│ │ ├── inflections.rb
│ │ ├── mime_types.rb
│ │ ├── permissions_policy.rb
│ │ └── wrap_parameters.rb
│ ├── locales
│ │ └── en.yml
│ ├── puma.rb
│ ├── routes.rb
│ └── storage.yml
├── db
│ └── .keep
├── lib
│ └── assets
│ │ └── .keep
└── public
│ ├── 404.html
│ ├── 422.html
│ ├── 500.html
│ ├── apple-touch-icon-precomposed.png
│ ├── apple-touch-icon.png
│ └── favicon.ico
├── fixtures
└── vcr_cassettes
│ ├── Authors
│ ├── creates_an_author.yml
│ ├── fails_to_create_an_author.yml
│ └── with_some_authors
│ │ ├── destroys_an_author.yml
│ │ ├── fails_to_update_an_author.yml
│ │ ├── loads_an_author.yml
│ │ ├── loads_the_authors_list.yml
│ │ └── updates_an_author.yml
│ ├── Posts
│ ├── fails_to_create_a_post.yml
│ ├── with_some_authors
│ │ └── creates_a_post.yml
│ └── with_some_posts
│ │ ├── destroys_a_post.yml
│ │ ├── fails_to_update_a_post.yml
│ │ ├── loads_a_post.yml
│ │ ├── loads_the_posts_list.yml
│ │ └── updates_a_post.yml
│ └── Tags
│ └── with_some_tags
│ ├── filters_the_tags.yml
│ ├── loads_a_tag.yml
│ └── loads_the_tags_list.yml
├── rails_helper.rb
├── spec_helper.rb
├── support
├── capybara.rb
├── capybara_cuprite.rb
├── output.rb
└── vcr.rb
└── system
├── authors_spec.rb
├── posts_spec.rb
└── tags_spec.rb
/.fasterer.yml:
--------------------------------------------------------------------------------
1 | ---
2 | exclude_paths:
3 | - bin/*
4 | - db/schema.rb
5 | - examples/**/*
6 | - spec/dummy/**/*
7 | - vendor/**/*
8 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [blocknotes]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
14 |
--------------------------------------------------------------------------------
/.github/workflows/linters.yml:
--------------------------------------------------------------------------------
1 | ---
2 | name: Linters
3 |
4 | on:
5 | pull_request:
6 | branches: [main]
7 | push:
8 | branches: [main]
9 |
10 | jobs:
11 | reviewdog:
12 | name: Reviewdog
13 | runs-on: ubuntu-latest
14 |
15 | steps:
16 | - name: Checkout repository
17 | uses: actions/checkout@v2
18 |
19 | - name: Set up Ruby
20 | uses: ruby/setup-ruby@v1
21 | with:
22 | ruby-version: '2.7'
23 | bundler-cache: true
24 |
25 | - name: Set up Reviewdog
26 | uses: reviewdog/action-setup@v1
27 | with:
28 | reviewdog_version: latest
29 |
30 | - name: Run Reviewdog
31 | env:
32 | REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 | run: |
34 | reviewdog -fail-on-error -reporter=github-pr-review -runners=fasterer,rubocop
35 |
36 | # NOTE: check with: reviewdog -fail-on-error -reporter=github-pr-review -runners=fasterer -diff="git diff" -tee
37 |
--------------------------------------------------------------------------------
/.github/workflows/specs.yml:
--------------------------------------------------------------------------------
1 | ---
2 | name: Specs Rails 6.0
3 |
4 | on:
5 | pull_request:
6 | branches: [main]
7 | push:
8 | branches: [main]
9 |
10 | jobs:
11 | test:
12 | runs-on: ubuntu-latest
13 |
14 | strategy:
15 | matrix:
16 | ruby: ['2.7', '3.0']
17 | gemfile: ['rails60_activeadmin_activeresource']
18 |
19 | env:
20 | BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
21 |
22 | steps:
23 | - name: Checkout repository
24 | uses: actions/checkout@v2
25 |
26 | - name: Set up Ruby
27 | uses: ruby/setup-ruby@v1
28 | with:
29 | ruby-version: ${{ matrix.ruby }}
30 | bundler-cache: true
31 |
32 | - name: Run tests
33 | run: bundle exec rspec --profile
34 |
35 | - name: On failure, archive screenshots as artifacts
36 | uses: actions/upload-artifact@v2
37 | if: failure()
38 | with:
39 | name: test-failed-screenshots
40 | path: spec/dummy/tmp/screenshots
41 |
--------------------------------------------------------------------------------
/.github/workflows/specs2.yml:
--------------------------------------------------------------------------------
1 | ---
2 | name: Specs Rails 6.1
3 |
4 | on:
5 | pull_request:
6 | branches: [main]
7 | push:
8 | branches: [main]
9 |
10 | jobs:
11 | test:
12 | runs-on: ubuntu-latest
13 |
14 | strategy:
15 | matrix:
16 | ruby: ['2.7', '3.0']
17 | gemfile: ['rails61_activeadmin29_activeresource51', 'rails61_activeadmin_activeresource']
18 |
19 | env:
20 | BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
21 |
22 | steps:
23 | - name: Checkout repository
24 | uses: actions/checkout@v2
25 |
26 | - name: Set up Ruby
27 | uses: ruby/setup-ruby@v1
28 | with:
29 | ruby-version: ${{ matrix.ruby }}
30 | bundler-cache: true
31 |
32 | - name: Run tests
33 | run: bundle exec rspec --profile
34 |
35 | - name: On failure, archive screenshots as artifacts
36 | uses: actions/upload-artifact@v2
37 | if: failure()
38 | with:
39 | name: test-failed-screenshots
40 | path: spec/dummy/tmp/screenshots
41 |
--------------------------------------------------------------------------------
/.github/workflows/specs3.yml:
--------------------------------------------------------------------------------
1 | ---
2 | name: Specs Rails 7.0
3 |
4 | on:
5 | pull_request:
6 | branches: [main]
7 | push:
8 | branches: [main]
9 |
10 | jobs:
11 | test:
12 | runs-on: ubuntu-latest
13 |
14 | strategy:
15 | matrix:
16 | ruby: ['2.7', '3.0', '3.1', '3.2']
17 | gemfile: ['rails70_activeadmin_activeresource']
18 |
19 | env:
20 | BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
21 |
22 | steps:
23 | - name: Checkout repository
24 | uses: actions/checkout@v2
25 |
26 | - name: Set up Ruby
27 | uses: ruby/setup-ruby@v1
28 | with:
29 | ruby-version: ${{ matrix.ruby }}
30 | bundler-cache: true
31 |
32 | - name: Run tests
33 | run: bundle exec rspec --profile
34 |
35 | - name: On failure, archive screenshots as artifacts
36 | uses: actions/upload-artifact@v2
37 | if: failure()
38 | with:
39 | name: test-failed-screenshots
40 | path: spec/dummy/tmp/screenshots
41 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.gem
2 | *.orig
3 |
4 | /.rspec_failures
5 | /.rubocop-*
6 | /Gemfile.lock
7 |
8 | /_misc/
9 | /coverage/
10 | /spec/dummy/db/*.sqlite3*
11 | /spec/dummy/log/
12 | /spec/dummy/storage/
13 | /spec/dummy/tmp/
14 |
15 | /examples/roda-api/db/test.db
16 |
--------------------------------------------------------------------------------
/.reviewdog.yml:
--------------------------------------------------------------------------------
1 | ---
2 | runner:
3 | fasterer:
4 | cmd: bin/fasterer
5 | level: info
6 | rubocop:
7 | cmd: bin/rubocop
8 | level: info
9 |
--------------------------------------------------------------------------------
/.rspec:
--------------------------------------------------------------------------------
1 | --require rails_helper
2 | --format documentation
3 |
--------------------------------------------------------------------------------
/.rubocop.yml:
--------------------------------------------------------------------------------
1 | ---
2 | inherit_from:
3 | - https://relaxed.ruby.style/rubocop.yml
4 |
5 | require:
6 | - rubocop-packaging
7 | - rubocop-performance
8 | - rubocop-rails
9 | - rubocop-rspec
10 |
11 | AllCops:
12 | Exclude:
13 | - bin/*
14 | - db/schema.rb
15 | - examples/**/*
16 | - gemfiles/**/*
17 | - spec/dummy/**/*
18 | - vendor/**/*
19 | NewCops: enable
20 |
21 | Style/OpenStructUse:
22 | Enabled: false # TODO: fix me
23 |
24 | RSpec/ExampleLength:
25 | # default 5
26 | Max: 10
27 |
--------------------------------------------------------------------------------
/Appraisals:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | appraise 'rails60-activeadmin-activeresource' do
4 | gem 'activeadmin'
5 | gem 'activeresource'
6 | gem 'psych', '~> 3.0'
7 | gem 'rails', '~> 6.0.0'
8 | gem 'selenium-webdriver', require: false # Fix
9 | end
10 |
11 | appraise 'rails61-activeadmin29-activeresource51' do
12 | gem 'activeadmin', '~> 2.9.0'
13 | gem 'activeresource', '~> 5.1.0'
14 | gem 'rails', '~> 6.1.0'
15 | end
16 |
17 | appraise 'rails61-activeadmin-activeresource' do
18 | gem 'activeadmin'
19 | gem 'activeresource'
20 | gem 'rails', '~> 6.1.0'
21 | end
22 |
23 | appraise 'rails70-activeadmin-activeresource' do
24 | gem 'activeadmin'
25 | gem 'activeresource'
26 | gem 'rails', '~> 7.0.0'
27 | end
28 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source 'https://rubygems.org'
4 |
5 | gemspec
6 |
7 | group :development, :test do
8 | gem 'puma'
9 | gem 'sassc'
10 | gem 'sqlite3'
11 |
12 | # Testing
13 | gem 'capybara'
14 | gem 'cuprite'
15 | gem 'rspec_junit_formatter'
16 | gem 'rspec-rails'
17 | gem 'vcr'
18 | gem 'webmock'
19 |
20 | # Linters
21 | gem 'fasterer'
22 | gem 'rubocop'
23 | gem 'rubocop-packaging'
24 | gem 'rubocop-performance'
25 | gem 'rubocop-rails'
26 | gem 'rubocop-rspec'
27 |
28 | # Tools
29 | gem 'pry-rails'
30 | end
31 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2020 Mattia Roccoberton
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | admin: bin/appraisal rails61-activeadmin-activeresource rails server -p 3000
2 | api: rackup -p 4000 examples/roda-api/config.ru
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Active Admin + Active Resource
2 | [](https://badge.fury.io/rb/activeadmin_active_resource)
3 | [](https://rubygems.org/gems/activeadmin_active_resource)
4 | [](https://github.com/blocknotes/activeadmin_active_resource/actions/workflows/linters.yml)
5 | [](https://github.com/blocknotes/activeadmin_active_resource/actions/workflows/specs.yml)
6 | [](https://github.com/blocknotes/activeadmin_active_resource/actions/workflows/specs2.yml)
7 |
8 | An Active Admin plugin to use a REST API data source in place of a local database using [Active Resource](https://github.com/rails/activeresource).
9 |
10 | **NOTICE**: currently some Active Admin features don't work as expected:
11 |
12 | - Filters are partially supported (see example)
13 | - Some form fields must be configured explicitly (like the associations)
14 | - Comments are not supported
15 |
16 | Please :star: if you like it.
17 |
18 | ## Install
19 |
20 | - Add to your project's Gemfile (with Active Admin installed): `gem 'activeadmin_active_resource'`
21 | - Execute bundle
22 | - Disable comments in Active Admin config initializer (`config.comments = false`)
23 |
24 | ## Examples
25 |
26 | Please take a look at the examples folder:
27 |
28 | - a Rails6 application with Active Admin and this component, see [here](examples/rails6-admin);
29 | - a Rails6 API application used as data source, see [here](examples/rails6-api);
30 | - a Roda API application used as data source, see [here](examples/roda-api).
31 |
32 | For more examples check the [specs](spec).
33 |
34 | Basic instructions:
35 |
36 | - Post model:
37 | ```rb
38 | class Post < ActiveResource::Base
39 | self.site = 'http://localhost:3000' # API url: another Rails project, a REST API, etc.
40 |
41 | self.schema = { # Fields must be declared explicitly
42 | id: :integer,
43 | title: :string,
44 | description: :text,
45 | author_id: :integer,
46 | category: :string,
47 | dt: :datetime,
48 | position: :float,
49 | published: :boolean,
50 | created_at: :datetime,
51 | updated_at: :datetime,
52 | }
53 | end
54 | ```
55 |
56 | - Post admin config:
57 | ```rb
58 | ActiveAdmin.register Post do
59 | filter :title_cont # Ransack postfixes required (_eq, _cont, etc.)
60 |
61 | controller do
62 | def permitted_params
63 | params.permit! # Permit all just for testing
64 | end
65 | end
66 |
67 | form do |f|
68 | f.inputs do
69 | f.input :id, as: :hidden unless f.object.new_record? # Required
70 | f.input :title
71 | # ... other fields
72 | end
73 | f.actions
74 | end
75 | end
76 | ```
77 |
78 | - Ransack options [here](https://github.com/activerecord-hackery/ransack#search-matchers)
79 | - Rails API index example with Ransack and Kaminari:
80 | ```rb
81 | after_action :set_pagination, only: [:index]
82 |
83 | def index
84 | per_page = params[:per_page].to_i
85 | per_page = 15 if per_page < 1
86 | @posts = Post.ransack( params[:q] ).result.order( params[:order] ).page( params[:page].to_i ).per( per_page )
87 | end
88 |
89 | def set_pagination
90 | headers['Pagination-Limit'] = @posts.limit_value.to_s
91 | headers['Pagination-Offset'] = @posts.offset_value.to_s
92 | headers['Pagination-TotalCount'] = @posts.total_count.to_s
93 | end
94 | ```
95 |
96 | ## Notes
97 |
98 | If you create a new rails project don't use *--skip-active-record*.
99 |
100 | ## Do you like it? Star it!
101 |
102 | If you use this component just star it. A developer is more motivated to improve a project when there is some interest. My other [Active Admin components](https://github.com/blocknotes?utf8=✓&tab=repositories&q=activeadmin&type=source).
103 |
104 | Or consider offering me a coffee, it's a small thing but it is greatly appreciated: [about me](https://www.blocknot.es/about-me).
105 |
106 | ## Contributors
107 |
108 | - [Mattia Roccoberton](http://blocknot.es): author
109 |
110 | ## License
111 |
112 | The gem is available as open-source under the terms of the [MIT](LICENSE.txt).
113 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'bundler/gem_tasks'
4 |
5 | begin
6 | require 'rspec/core/rake_task'
7 |
8 | RSpec::Core::RakeTask.new(:spec) do |t|
9 | # t.ruby_opts = %w[-w]
10 | t.rspec_opts = ['--color', '--format documentation']
11 | end
12 |
13 | task default: :spec
14 | rescue LoadError
15 | puts '! LoadError: no RSpec available'
16 | end
17 |
--------------------------------------------------------------------------------
/activeadmin_active_resource.gemspec:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | lib = File.expand_path('lib', __dir__)
4 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5 | require 'activeadmin/active_resource/version'
6 |
7 | Gem::Specification.new do |spec|
8 | spec.name = 'activeadmin_active_resource'
9 | spec.version = ActiveAdmin::ActiveResource::VERSION
10 | spec.summary = 'Active Resource for ActiveAdmin'
11 | spec.description = 'An Active Admin plugin to use Active Resource'
12 | spec.license = 'MIT'
13 | spec.authors = ['Mattia Roccoberton']
14 | spec.email = 'mat@blocknot.es'
15 | spec.homepage = 'https://github.com/blocknotes/activeadmin_active_resource'
16 |
17 | spec.metadata['homepage_uri'] = spec.homepage
18 | spec.metadata['source_code_uri'] = spec.homepage
19 | spec.metadata['rubygems_mfa_required'] = 'true'
20 |
21 | spec.files = Dir['{lib}/**/*', 'LICENSE.txt', 'Rakefile', 'README.md']
22 | spec.require_paths = ['lib']
23 |
24 | spec.required_ruby_version = '>= 2.7.0'
25 |
26 | spec.add_runtime_dependency 'activeadmin', '>= 2.0', '< 4'
27 | spec.add_runtime_dependency 'activeresource', '>= 5.1'
28 |
29 | spec.add_development_dependency 'appraisal', '~> 2.4'
30 | end
31 |
--------------------------------------------------------------------------------
/bin/appraisal:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'appraisal' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | require "pathname"
12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13 | Pathname.new(__FILE__).realpath)
14 |
15 | bundle_binstub = File.expand_path("../bundle", __FILE__)
16 |
17 | if File.file?(bundle_binstub)
18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19 | load(bundle_binstub)
20 | else
21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23 | end
24 | end
25 |
26 | require "rubygems"
27 | require "bundler/setup"
28 |
29 | load Gem.bin_path("appraisal", "appraisal")
30 |
--------------------------------------------------------------------------------
/bin/fasterer:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'fasterer' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | require "pathname"
12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13 | Pathname.new(__FILE__).realpath)
14 |
15 | bundle_binstub = File.expand_path("../bundle", __FILE__)
16 |
17 | if File.file?(bundle_binstub)
18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19 | load(bundle_binstub)
20 | else
21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23 | end
24 | end
25 |
26 | require "rubygems"
27 | require "bundler/setup"
28 |
29 | load Gem.bin_path("fasterer", "fasterer")
30 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | # This command will automatically be run when you run "rails" with Rails gems
5 | # installed from the root of your application.
6 |
7 | ENV['RAILS_ENV'] ||= 'test'
8 |
9 | ENGINE_ROOT = File.expand_path('..', __dir__)
10 | ENGINE_PATH = File.expand_path('../lib/activeadmin/active_resource/engine', __dir__)
11 | APP_PATH = File.expand_path('../spec/dummy/config/application', __dir__)
12 |
13 | # Set up gems listed in the Gemfile.
14 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
15 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
16 |
17 | require 'rails/all'
18 | require 'rails/engine/commands'
19 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'rake' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | require "pathname"
12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13 | Pathname.new(__FILE__).realpath)
14 |
15 | bundle_binstub = File.expand_path("../bundle", __FILE__)
16 |
17 | if File.file?(bundle_binstub)
18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19 | load(bundle_binstub)
20 | else
21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23 | end
24 | end
25 |
26 | require "rubygems"
27 | require "bundler/setup"
28 |
29 | load Gem.bin_path("rake", "rake")
30 |
--------------------------------------------------------------------------------
/bin/rspec:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'rspec' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | require "pathname"
12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13 | Pathname.new(__FILE__).realpath)
14 |
15 | bundle_binstub = File.expand_path("../bundle", __FILE__)
16 |
17 | if File.file?(bundle_binstub)
18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19 | load(bundle_binstub)
20 | else
21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23 | end
24 | end
25 |
26 | require "rubygems"
27 | require "bundler/setup"
28 |
29 | load Gem.bin_path("rspec-core", "rspec")
30 |
--------------------------------------------------------------------------------
/bin/rubocop:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'rubocop' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | require "pathname"
12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13 | Pathname.new(__FILE__).realpath)
14 |
15 | bundle_binstub = File.expand_path("../bundle", __FILE__)
16 |
17 | if File.file?(bundle_binstub)
18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19 | load(bundle_binstub)
20 | else
21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23 | end
24 | end
25 |
26 | require "rubygems"
27 | require "bundler/setup"
28 |
29 | load Gem.bin_path("rubocop", "rubocop")
30 |
--------------------------------------------------------------------------------
/examples/rails6-admin/app/admin/authors.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ActiveAdmin.register Author do
4 | controller do
5 | def permitted_params
6 | params.permit!
7 | end
8 | end
9 |
10 | form do |f|
11 | f.semantic_errors
12 |
13 | f.inputs do
14 | f.input :id, as: :hidden unless f.object.new_record? # Required
15 | f.input :name
16 | f.input :age
17 | f.input :email
18 | end
19 |
20 | f.actions
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/examples/rails6-admin/app/admin/dashboard.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ActiveAdmin.register_page "Dashboard" do
4 | menu priority: 1, label: proc { I18n.t("active_admin.dashboard") }
5 |
6 | content title: proc { I18n.t("active_admin.dashboard") } do
7 | # Some content
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/examples/rails6-admin/app/admin/posts.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ActiveAdmin.register Post do
4 | controller do
5 | def permitted_params
6 | params.permit!
7 | end
8 | end
9 |
10 | index do
11 | selectable_column
12 | id_column
13 | column :title
14 | column :author
15 | column :published
16 | column :created_at
17 | actions
18 | end
19 |
20 | show do
21 | attributes_table do
22 | row :author
23 | row :title
24 | row :description
25 | row :category
26 | row :dt
27 | row :position
28 | row :published
29 | row :tags
30 | row :created_at
31 | row :updated_at
32 | end
33 | # active_admin_comments # NOTE: comments not working
34 | end
35 |
36 | form do |f|
37 | f.semantic_errors
38 |
39 | f.inputs 'Post' do
40 | f.input :id, as: :hidden unless f.object.new_record? # Required
41 | f.input :author_id, as: :select, collection: Author.all
42 | f.input :title
43 | f.input :description
44 | f.input :category
45 | f.input :published
46 | f.input :dt
47 | f.input :position
48 | end
49 |
50 | f.actions
51 | end
52 | end
53 |
--------------------------------------------------------------------------------
/examples/rails6-admin/app/admin/tags.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ActiveAdmin.register Tag do
4 | filter :name_cont
5 | end
6 |
--------------------------------------------------------------------------------
/examples/rails6-admin/app/models/application_record.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationRecord < ActiveResource::Base
4 | self.site = 'http://localhost:4000'
5 | end
6 |
--------------------------------------------------------------------------------
/examples/rails6-admin/app/models/author.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Author < ApplicationRecord
4 | self.schema = {
5 | id: :integer,
6 | name: :string,
7 | age: :integer,
8 | email: :string,
9 | created_at: :datetime,
10 | updated_at: :datetime
11 | }
12 |
13 | has_many :posts
14 |
15 | has_one :profile
16 |
17 | def to_s
18 | "#{name} (#{age})"
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/examples/rails6-admin/app/models/post.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Post < ApplicationRecord
4 | self.schema = {
5 | id: :integer,
6 | title: :string,
7 | description: :text,
8 | author_id: :integer,
9 | category: :string,
10 | dt: :datetime,
11 | position: :float,
12 | published: :boolean,
13 | created_at: :datetime,
14 | updated_at: :datetime
15 | }
16 |
17 | belongs_to :author
18 |
19 | has_many :tags
20 | end
21 |
--------------------------------------------------------------------------------
/examples/rails6-admin/app/models/post_tag.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class PostTag < ApplicationRecord
4 | belongs_to :post, inverse_of: :post_tags
5 | belongs_to :tag, inverse_of: :post_tags
6 |
7 | validates :post, presence: true
8 | validates :tag, presence: true
9 | end
10 |
--------------------------------------------------------------------------------
/examples/rails6-admin/app/models/profile.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Profile < ApplicationRecord
4 | belongs_to :author, inverse_of: :profile, touch: true
5 |
6 | def to_s
7 | description
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/examples/rails6-admin/app/models/tag.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Tag < ApplicationRecord
4 | self.schema = {
5 | id: :integer,
6 | name: :string
7 | }
8 |
9 | has_many :posts
10 | end
11 |
--------------------------------------------------------------------------------
/examples/rails6-api/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationController < ActionController::API
4 | end
5 |
--------------------------------------------------------------------------------
/examples/rails6-api/app/controllers/authors_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AuthorsController < ApplicationController
4 | before_action :load_record, only: %w[show update destroy]
5 |
6 | def index
7 | @authors = Author.limit(10)
8 |
9 | render json: @authors
10 | end
11 |
12 | def show
13 | render json: @author
14 | end
15 |
16 | def create
17 | @author = Author.new(params[:author].permit!)
18 | success = @author.save
19 | result = success ? { success: true } : { success: false, errors: @author.errors.messages }
20 |
21 | render json: result, status: success ? :ok : :unprocessable_entity
22 | end
23 |
24 | def update
25 | success = @author.update(params[:author].permit!)
26 | result = success ? { success: true } : { success: false, errors: @author.errors.messages }
27 |
28 | render json: result, status: success ? :ok : :unprocessable_entity
29 | end
30 |
31 | def destroy
32 | success = @author.destroy
33 | result = success ? { success: true } : { success: false, errors: @author.errors.messages }
34 |
35 | render json: result, status: success ? :ok : :unprocessable_entity
36 | end
37 |
38 | private
39 |
40 | def load_record
41 | @author = Author.find(params[:id])
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/examples/rails6-api/app/controllers/posts_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class PostsController < ApplicationController
4 | before_action :load_record, only: %w[show update destroy]
5 |
6 | def index
7 | @posts = Post.limit(10)
8 |
9 | render json: @posts
10 | end
11 |
12 | def show
13 | render json: @post
14 | end
15 |
16 | def create
17 | @post = Post.new(params[:post].permit!)
18 | success = @post.save
19 | result = success ? { success: true } : { success: false, errors: @post.errors.messages }
20 |
21 | render json: result, status: success ? :ok : :unprocessable_entity
22 | end
23 |
24 | def update
25 | success = @post.update(params[:post].permit!)
26 | result = success ? { success: true } : { success: false, errors: @post.errors.messages }
27 |
28 | render json: result, status: success ? :ok : :unprocessable_entity
29 | end
30 |
31 | def destroy
32 | success = @post.destroy
33 | result = success ? { success: true } : { success: false, errors: @post.errors.messages }
34 |
35 | render json: result, status: success ? :ok : :unprocessable_entity
36 | end
37 |
38 | private
39 |
40 | def load_record
41 | @post = Post.find(params[:id])
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/examples/rails6-api/app/controllers/tags_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class TagsController < ApplicationController
4 | after_action :set_pagination, only: [:index]
5 |
6 | def index
7 | # filters using Ransack, pagination using Kaminari
8 | per_page = params[:per_page].to_i
9 | per_page = 15 if per_page < 1
10 | @tags = Tag.ransack(params[:q]).result.order(params[:order]).page(params[:page].to_i).per(per_page)
11 |
12 | render json: @tags
13 | end
14 |
15 | def show
16 | @tag = Tag.find(params[:id])
17 |
18 | render json: @tag
19 | end
20 |
21 | private
22 |
23 | def set_pagination
24 | headers['Pagination-Limit'] = @tags.limit_value.to_s
25 | headers['Pagination-Offset'] = @tags.offset_value.to_s
26 | headers['Pagination-TotalCount'] = @tags.total_count.to_s
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/examples/rails6-api/app/models/application_record.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationRecord < ActiveRecord::Base
4 | self.abstract_class = true
5 |
6 | scope :published, -> {}
7 | end
8 |
--------------------------------------------------------------------------------
/examples/rails6-api/app/models/author.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Author < ApplicationRecord
4 | has_many :posts
5 | has_many :published_posts, -> { published }, class_name: 'Post'
6 | has_many :recent_posts, -> { recents }, class_name: 'Post'
7 |
8 | has_many :tags, through: :posts
9 |
10 | has_one :profile, inverse_of: :author, dependent: :destroy
11 |
12 | has_one_attached :avatar
13 |
14 | accepts_nested_attributes_for :profile, allow_destroy: true
15 |
16 | validates :email, format: { with: /\A[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\z/i, message: 'Invalid email' }
17 |
18 | validate -> {
19 | errors.add( :base, 'Invalid age' ) if !age || age.to_i % 3 == 1
20 | }
21 |
22 | def to_s
23 | "#{name} (#{age})"
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/examples/rails6-api/app/models/post.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Post < ApplicationRecord
4 | enum state: %i[available unavailable arriving]
5 |
6 | belongs_to :author, inverse_of: :posts, autosave: true, required: true
7 |
8 | has_one :author_profile, through: :author, source: :profile
9 |
10 | has_many :post_tags, inverse_of: :post, dependent: :destroy
11 | has_many :tags, through: :post_tags
12 |
13 | accepts_nested_attributes_for :post_tags, allow_destroy: true
14 |
15 | validates :title, allow_blank: false, presence: true, length: { minimum: 2 }
16 |
17 | scope :published, -> { where(published: true) }
18 | scope :recents, -> { where('created_at > ?', Date.today - 8.month) }
19 |
20 | def short_title
21 | title.truncate 10
22 | end
23 |
24 | def upper_title
25 | title.upcase
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/examples/rails6-api/app/models/post_tag.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class PostTag < ApplicationRecord
4 | belongs_to :post, inverse_of: :post_tags
5 | belongs_to :tag, inverse_of: :post_tags
6 |
7 | validates :post, presence: true
8 | validates :tag, presence: true
9 |
10 | accepts_nested_attributes_for :tag
11 | end
12 |
--------------------------------------------------------------------------------
/examples/rails6-api/app/models/profile.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Profile < ApplicationRecord
4 | belongs_to :author, inverse_of: :profile, touch: true
5 |
6 | def to_s
7 | description
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/examples/rails6-api/app/models/tag.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Tag < ApplicationRecord
4 | has_many :post_tags, inverse_of: :tag, dependent: :destroy
5 | has_many :posts, through: :post_tags
6 | end
7 |
--------------------------------------------------------------------------------
/examples/rails6-api/config/routes.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | Rails.application.routes.draw do
4 | resources :authors
5 | resources :posts
6 | resources :tags, only: %w[index show]
7 | end
8 |
--------------------------------------------------------------------------------
/examples/rails6-api/db/migrate/20180607053251_create_authors.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateAuthors < ActiveRecord::Migration[6.0]
4 | def change
5 | create_table :authors do |t|
6 | t.string :name
7 | t.integer :age
8 | t.string :email
9 |
10 | t.timestamps
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/examples/rails6-api/db/migrate/20180607053254_create_profiles.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateProfiles < ActiveRecord::Migration[6.0]
4 | def change
5 | create_table :profiles do |t|
6 | t.text :description
7 | t.belongs_to :author, foreign_key: true
8 |
9 | t.timestamps
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/examples/rails6-api/db/migrate/20180607053255_create_tags.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateTags < ActiveRecord::Migration[6.0]
4 | def change
5 | create_table :tags do |t|
6 | t.string :name
7 |
8 | t.timestamps
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/examples/rails6-api/db/migrate/20180607053257_create_post_tags.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreatePostTags < ActiveRecord::Migration[6.0]
4 | def change
5 | create_table :post_tags do |t|
6 | t.belongs_to :post, foreign_key: true
7 | t.belongs_to :tag, foreign_key: true
8 |
9 | t.timestamps
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/examples/rails6-api/db/migrate/20180607053739_create_posts.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreatePosts < ActiveRecord::Migration[6.0]
4 | def change
5 | create_table :posts do |t|
6 | t.string :title
7 | t.text :description
8 | t.belongs_to :author, foreign_key: true
9 | t.string :category
10 | t.datetime :dt
11 | t.float :position
12 | t.boolean :published
13 |
14 | t.timestamps
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/examples/roda-api/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source 'https://rubygems.org'
4 | git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5 |
6 | gem 'pry'
7 |
8 | gem 'roda'
9 | gem 'sequel'
10 | gem 'sqlite3'
11 |
--------------------------------------------------------------------------------
/examples/roda-api/Procfile:
--------------------------------------------------------------------------------
1 | api: rackup -p 4000
2 |
--------------------------------------------------------------------------------
/examples/roda-api/README.md:
--------------------------------------------------------------------------------
1 | # Roda API
2 |
3 | ### Migrations
4 |
5 | ```sh
6 | bin/setup
7 | ```
8 |
--------------------------------------------------------------------------------
/examples/roda-api/app/conf.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'sqlite3'
4 |
5 | db_path = File.expand_path("#{__dir__}/../db/test.db")
6 | DB = Sequel.connect("sqlite://#{db_path}")
7 |
8 | DB.extension(:pagination)
9 | Sequel.default_timezone = :utc
10 | Sequel::Model.plugin(:timestamps)
11 |
--------------------------------------------------------------------------------
/examples/roda-api/app/main.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'json'
4 | require 'roda'
5 | require 'sequel'
6 |
7 | require_relative 'conf'
8 | Dir[File.expand_path("./models/*.rb", __dir__)].sort.each { |f| require f }
9 |
10 | # Main app class
11 | class App < Roda
12 | plugin :all_verbs
13 | plugin :halt
14 | plugin :json
15 | plugin :json_parser
16 | plugin :type_routing
17 |
18 | route do |r|
19 | # r.root do; end
20 |
21 | # --- authors ---
22 | r.is 'authors' do
23 | r.get do
24 | action_index(Models::Author, r.params)
25 | end
26 |
27 | r.post do
28 | author = Models::Author.new
29 | action_save(author, r.params) ? { author: author.values } : { errors: author.errors }
30 | end
31 | end
32 |
33 | r.is 'authors', Integer do |id|
34 | @author = Models::Author[id]
35 | r.halt(404) unless @author
36 |
37 | r.get do
38 | { author: @author.values }
39 | end
40 |
41 | r.put do
42 | action_save(@author, r.params) ? { tag: @author.values } : { errors: @author.errors }
43 | end
44 |
45 | r.delete do
46 | @author.destroy
47 | r.halt 204
48 | end
49 | end
50 |
51 | # --- posts ---
52 | r.is 'posts' do
53 | r.get do
54 | action_index(Models::Post, r.params)
55 | end
56 |
57 | r.post do
58 | post = Models::Post.new
59 | action_save(post, r.params) ? { post: post.values } : { errors: post.errors }
60 | end
61 | end
62 |
63 | r.is 'posts', Integer do |id|
64 | @post = Models::Post[id]
65 | r.halt(404) unless @post
66 |
67 | r.get do
68 | { post: @post.values }
69 | end
70 |
71 | r.put do
72 | action_save(@post, r.params) ? { tag: @post.values } : { errors: @post.errors }
73 | end
74 |
75 | r.delete do
76 | @post.destroy
77 | r.halt 204
78 | end
79 | end
80 |
81 | # --- tags ---
82 | r.is 'tags' do
83 | r.get do
84 | action_index(Models::Tag, r.params)
85 | end
86 |
87 | r.post do
88 | tag = Models::Tag.new
89 | action_save(tag, r.params) ? { tag: tag.values } : { errors: tag.errors }
90 | end
91 | end
92 |
93 | r.is 'tags', Integer do |id|
94 | @tag = Models::Tag[id]
95 | r.halt(404) unless @tag
96 |
97 | r.get do
98 | { tag: @tag.values }
99 | end
100 |
101 | r.put do
102 | action_save(@tag, r.params) ? { tag: @tag.values } : { errors: @tag.errors }
103 | end
104 |
105 | r.delete do
106 | @tag.destroy
107 | r.halt 204
108 | end
109 | end
110 | end
111 |
112 | # ----------------------------------------------------------------------------
113 |
114 | def action_index(model, params)
115 | ds = model.raw_dataset.paginate((params['page'] || 1).to_i, (params['per_page'] || 10).to_i)
116 | response.headers['Pagination-TotalCount'] = ds.pagination_record_count.to_s
117 | ds.to_a
118 | end
119 |
120 | def action_save(item, params)
121 | item.update(adjust_params(params)) # TODO: permit valid params only
122 | true
123 | rescue Sequel::ValidationFailed
124 | response.status = 422
125 | false
126 | end
127 |
128 | def adjust_params(params)
129 | item_params = params.dup
130 | item_params.delete_if { |k, _| k =~ /\Aid|\w+\(\d+i\)\Z/ } # TODO: handle date times fields
131 | end
132 | end
133 |
--------------------------------------------------------------------------------
/examples/roda-api/app/models/author.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module Models
4 | class Author < Sequel::Model(DB)
5 | class << self
6 | def raw_dataset
7 | DB[Models::Author.table_name]
8 | end
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/examples/roda-api/app/models/post.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module Models
4 | class Post < Sequel::Model(DB)
5 | class << self
6 | def raw_dataset
7 | DB[Models::Post.table_name]
8 | end
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/examples/roda-api/app/models/tag.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module Models
4 | class Tag < Sequel::Model(DB)
5 | def validate
6 | super
7 | errors.add(:name, 'cannot be empty') if !name || name.empty?
8 | end
9 |
10 | class << self
11 | def raw_dataset
12 | DB[Models::Tag.table_name]
13 | end
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/examples/roda-api/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | require 'sequel'
5 |
6 | require File.expand_path('../app/conf.rb', __dir__)
7 | migrations = File.expand_path('../db/migrate/*', __dir__)
8 |
9 | Dir[migrations].sort.each do |migration|
10 | puts "> #{File.basename(migration)}"
11 | require migration
12 | end
13 |
14 | require File.expand_path('../db/seeds.rb', __dir__)
15 |
--------------------------------------------------------------------------------
/examples/roda-api/config.ru:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative 'app/main'
4 |
5 | run App.freeze.app
6 |
--------------------------------------------------------------------------------
/examples/roda-api/db/migrate/001_create_authors.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | DB.create_table(:authors) do
4 | primary_key :id
5 |
6 | String :name
7 | String :email
8 | Fixnum :age
9 | DateTime :created_at
10 | DateTime :updated_at
11 | end
12 |
--------------------------------------------------------------------------------
/examples/roda-api/db/migrate/002_create_tags.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | DB.create_table(:tags) do
4 | primary_key :id
5 |
6 | String :name
7 | DateTime :created_at
8 | DateTime :updated_at
9 | end
10 |
--------------------------------------------------------------------------------
/examples/roda-api/db/migrate/003_create_posts.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | DB.create_table(:posts) do
4 | primary_key :id
5 | foreign_key :author_id, :authors
6 |
7 | String :title
8 | String :description, text: true
9 | String :category
10 | DateTime :dt
11 | Float :position
12 | TrueClass :published
13 |
14 | DateTime :created_at
15 | DateTime :updated_at
16 | end
17 |
--------------------------------------------------------------------------------
/examples/roda-api/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | Dir[File.expand_path("../app/**/*.rb", __dir__)].sort.each { |f| require f }
4 |
5 | puts 'Authors...'
6 | (11..20).each do |i|
7 | age = 21 + 3 * (i - 10)
8 | attrs = { name: "Author #{i}", age: age, email: "some@email#{i}.com" }
9 | # attrs[:profile] = Profile.new(description: "Profile description for Author #{i}") if (i % 3).zero?
10 | Models::Author.create(attrs)
11 | end
12 |
13 | puts 'Tags...'
14 | (11..15).each do |i|
15 | attrs = { name: "Tag #{i}" }
16 | Models::Tag.create(attrs)
17 | end
18 |
19 | puts 'Posts...'
20 | (11..40).each do |i|
21 | attrs = { title: "Post #{i}" }
22 | Models::Post.create(attrs)
23 | end
24 |
--------------------------------------------------------------------------------
/extra/.env:
--------------------------------------------------------------------------------
1 | COMPOSE_PROJECT_NAME=activeadmin_active_resource
2 |
--------------------------------------------------------------------------------
/extra/Dockerfile_26:
--------------------------------------------------------------------------------
1 | FROM ruby:2.6-alpine
2 |
3 | RUN apk add --no-cache --update build-base dpkg gcompat sqlite sqlite-dev tzdata
4 | RUN gem install bundler
5 |
6 | # App setup
7 | WORKDIR /usr/src/app
8 | COPY .. .
9 |
--------------------------------------------------------------------------------
/extra/Dockerfile_27:
--------------------------------------------------------------------------------
1 | FROM ruby:2.7-alpine
2 |
3 | RUN apk add --no-cache --update build-base dpkg gcompat sqlite sqlite-dev tzdata
4 |
5 | # App setup
6 | WORKDIR /usr/src/app
7 | COPY .. .
8 |
--------------------------------------------------------------------------------
/extra/Dockerfile_30:
--------------------------------------------------------------------------------
1 | FROM ruby:3.0-alpine
2 |
3 | RUN apk add --no-cache --update build-base dpkg gcompat sqlite sqlite-dev tzdata
4 |
5 | # App setup
6 | WORKDIR /usr/src/app
7 | COPY .. .
8 |
--------------------------------------------------------------------------------
/extra/README.md:
--------------------------------------------------------------------------------
1 | # Development
2 |
3 | ## Releases
4 |
5 | ```sh
6 | # Update lib/activeadmin/active_resource/version.rb with the new version
7 | # Update the gemfiles:
8 | bin/appraisal
9 | ```
10 |
11 | ## Testing
12 |
13 | ```sh
14 | # Running specs using a specific configuration:
15 | bin/appraisal rails60-activeadmin22-activeresource51 rspec
16 | # Using latest activeadmin/activeresource versions:
17 | bin/appraisal rails60-activeadmin-activeresource rspec
18 | # See gemfiles for more configurations
19 | ```
20 |
--------------------------------------------------------------------------------
/extra/docker-compose.yml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "3.3"
3 |
4 | x-defaults:
5 | test_app: &test_app
6 | command:
7 | - |
8 | bundle install --gemfile=gemfiles/rails$${RAILS}_activeadmin_activeresource.gemfile
9 | bin/appraisal rails$${RAILS}-activeadmin-activeresource rspec
10 | entrypoint: ["/bin/sh", "-c"]
11 | volumes:
12 | - ..:/usr/src/app:delegated
13 |
14 | services:
15 | tests_26:
16 | <<: *test_app
17 | build:
18 | context: ..
19 | dockerfile: extra/Dockerfile_26
20 | environment:
21 | RAILS: 61
22 |
23 | tests_27:
24 | <<: *test_app
25 | build:
26 | context: ..
27 | dockerfile: extra/Dockerfile_27
28 | environment:
29 | RAILS: 61
30 |
31 | tests_30:
32 | <<: *test_app
33 | build:
34 | context: ..
35 | dockerfile: extra/Dockerfile_30
36 | environment:
37 | RAILS: 61
38 |
--------------------------------------------------------------------------------
/gemfiles/rails60_activeadmin_activeresource.gemfile:
--------------------------------------------------------------------------------
1 | # This file was generated by Appraisal
2 |
3 | source "https://rubygems.org"
4 |
5 | gem "activeadmin"
6 | gem "activeresource"
7 | gem "psych", "~> 3.0"
8 | gem "rails", "~> 6.0.0"
9 | gem "selenium-webdriver", require: false
10 | gem "sprockets-rails"
11 |
12 | group :development, :test do
13 | gem "puma"
14 | gem "sassc"
15 | gem "sqlite3"
16 | gem "capybara"
17 | gem "cuprite"
18 | gem "rspec_junit_formatter"
19 | gem "rspec-rails"
20 | gem "vcr"
21 | gem "webmock"
22 | gem "fasterer"
23 | gem "rubocop"
24 | gem "rubocop-packaging"
25 | gem "rubocop-performance"
26 | gem "rubocop-rails"
27 | gem "rubocop-rspec"
28 | gem "pry-rails"
29 | end
30 |
31 | gemspec path: "../"
32 |
--------------------------------------------------------------------------------
/gemfiles/rails60_activeadmin_activeresource.gemfile.lock:
--------------------------------------------------------------------------------
1 | PATH
2 | remote: ..
3 | specs:
4 | activeadmin_active_resource (0.3.0)
5 | activeadmin (>= 2.0, < 4)
6 | activeresource (>= 5.1)
7 |
8 | GEM
9 | remote: https://rubygems.org/
10 | specs:
11 | actioncable (6.0.4.6)
12 | actionpack (= 6.0.4.6)
13 | nio4r (~> 2.0)
14 | websocket-driver (>= 0.6.1)
15 | actionmailbox (6.0.4.6)
16 | actionpack (= 6.0.4.6)
17 | activejob (= 6.0.4.6)
18 | activerecord (= 6.0.4.6)
19 | activestorage (= 6.0.4.6)
20 | activesupport (= 6.0.4.6)
21 | mail (>= 2.7.1)
22 | actionmailer (6.0.4.6)
23 | actionpack (= 6.0.4.6)
24 | actionview (= 6.0.4.6)
25 | activejob (= 6.0.4.6)
26 | mail (~> 2.5, >= 2.5.4)
27 | rails-dom-testing (~> 2.0)
28 | actionpack (6.0.4.6)
29 | actionview (= 6.0.4.6)
30 | activesupport (= 6.0.4.6)
31 | rack (~> 2.0, >= 2.0.8)
32 | rack-test (>= 0.6.3)
33 | rails-dom-testing (~> 2.0)
34 | rails-html-sanitizer (~> 1.0, >= 1.2.0)
35 | actiontext (6.0.4.6)
36 | actionpack (= 6.0.4.6)
37 | activerecord (= 6.0.4.6)
38 | activestorage (= 6.0.4.6)
39 | activesupport (= 6.0.4.6)
40 | nokogiri (>= 1.8.5)
41 | actionview (6.0.4.6)
42 | activesupport (= 6.0.4.6)
43 | builder (~> 3.1)
44 | erubi (~> 1.4)
45 | rails-dom-testing (~> 2.0)
46 | rails-html-sanitizer (~> 1.1, >= 1.2.0)
47 | activeadmin (2.10.1)
48 | arbre (~> 1.2, >= 1.2.1)
49 | formtastic (>= 3.1, < 5.0)
50 | formtastic_i18n (~> 0.4)
51 | inherited_resources (~> 1.7)
52 | jquery-rails (~> 4.2)
53 | kaminari (~> 1.0, >= 1.2.1)
54 | railties (>= 6.0, < 6.2)
55 | ransack (~> 2.1, >= 2.1.1)
56 | activejob (6.0.4.6)
57 | activesupport (= 6.0.4.6)
58 | globalid (>= 0.3.6)
59 | activemodel (6.0.4.6)
60 | activesupport (= 6.0.4.6)
61 | activemodel-serializers-xml (1.0.2)
62 | activemodel (> 5.x)
63 | activesupport (> 5.x)
64 | builder (~> 3.1)
65 | activerecord (6.0.4.6)
66 | activemodel (= 6.0.4.6)
67 | activesupport (= 6.0.4.6)
68 | activeresource (6.0.0)
69 | activemodel (>= 6.0)
70 | activemodel-serializers-xml (~> 1.0)
71 | activesupport (>= 6.0)
72 | activestorage (6.0.4.6)
73 | actionpack (= 6.0.4.6)
74 | activejob (= 6.0.4.6)
75 | activerecord (= 6.0.4.6)
76 | marcel (~> 1.0.0)
77 | activesupport (6.0.4.6)
78 | concurrent-ruby (~> 1.0, >= 1.0.2)
79 | i18n (>= 0.7, < 2)
80 | minitest (~> 5.1)
81 | tzinfo (~> 1.1)
82 | zeitwerk (~> 2.2, >= 2.2.2)
83 | addressable (2.8.0)
84 | public_suffix (>= 2.0.2, < 5.0)
85 | appraisal (2.4.1)
86 | bundler
87 | rake
88 | thor (>= 0.14.0)
89 | arbre (1.5.0)
90 | activesupport (>= 3.0.0, < 7.1)
91 | ruby2_keywords (>= 0.0.2, < 1.0)
92 | ast (2.4.2)
93 | builder (3.2.4)
94 | capybara (3.36.0)
95 | addressable
96 | matrix
97 | mini_mime (>= 0.1.3)
98 | nokogiri (~> 1.8)
99 | rack (>= 1.6.0)
100 | rack-test (>= 0.6.3)
101 | regexp_parser (>= 1.5, < 3.0)
102 | xpath (~> 3.2)
103 | childprocess (4.1.0)
104 | cliver (0.3.2)
105 | coderay (1.1.3)
106 | colorize (0.8.1)
107 | concurrent-ruby (1.1.9)
108 | crack (0.4.5)
109 | rexml
110 | crass (1.0.6)
111 | cuprite (0.13)
112 | capybara (>= 2.1, < 4)
113 | ferrum (~> 0.11.0)
114 | diff-lcs (1.5.0)
115 | erubi (1.10.0)
116 | fasterer (0.9.0)
117 | colorize (~> 0.7)
118 | ruby_parser (>= 3.14.1)
119 | ferrum (0.11)
120 | addressable (~> 2.5)
121 | cliver (~> 0.3)
122 | concurrent-ruby (~> 1.1)
123 | websocket-driver (>= 0.6, < 0.8)
124 | ffi (1.15.5)
125 | formtastic (4.0.0)
126 | actionpack (>= 5.2.0)
127 | formtastic_i18n (0.7.0)
128 | globalid (1.0.0)
129 | activesupport (>= 5.0)
130 | has_scope (0.8.0)
131 | actionpack (>= 5.2)
132 | activesupport (>= 5.2)
133 | hashdiff (1.0.1)
134 | i18n (1.10.0)
135 | concurrent-ruby (~> 1.0)
136 | inherited_resources (1.13.1)
137 | actionpack (>= 5.2, < 7.1)
138 | has_scope (~> 0.6)
139 | railties (>= 5.2, < 7.1)
140 | responders (>= 2, < 4)
141 | jquery-rails (4.4.0)
142 | rails-dom-testing (>= 1, < 3)
143 | railties (>= 4.2.0)
144 | thor (>= 0.14, < 2.0)
145 | kaminari (1.2.2)
146 | activesupport (>= 4.1.0)
147 | kaminari-actionview (= 1.2.2)
148 | kaminari-activerecord (= 1.2.2)
149 | kaminari-core (= 1.2.2)
150 | kaminari-actionview (1.2.2)
151 | actionview
152 | kaminari-core (= 1.2.2)
153 | kaminari-activerecord (1.2.2)
154 | activerecord
155 | kaminari-core (= 1.2.2)
156 | kaminari-core (1.2.2)
157 | loofah (2.14.0)
158 | crass (~> 1.0.2)
159 | nokogiri (>= 1.5.9)
160 | mail (2.7.1)
161 | mini_mime (>= 0.1.1)
162 | marcel (1.0.2)
163 | matrix (0.4.2)
164 | method_source (1.0.0)
165 | mini_mime (1.1.2)
166 | mini_portile2 (2.8.4)
167 | minitest (5.15.0)
168 | nio4r (2.5.8)
169 | nokogiri (1.13.3)
170 | mini_portile2 (~> 2.8.0)
171 | racc (~> 1.4)
172 | parallel (1.21.0)
173 | parser (3.1.1.0)
174 | ast (~> 2.4.1)
175 | pry (0.14.1)
176 | coderay (~> 1.1)
177 | method_source (~> 1.0)
178 | pry-rails (0.3.9)
179 | pry (>= 0.10.4)
180 | psych (3.3.4)
181 | public_suffix (4.0.6)
182 | puma (5.6.2)
183 | nio4r (~> 2.0)
184 | racc (1.6.0)
185 | rack (2.2.3)
186 | rack-test (1.1.0)
187 | rack (>= 1.0, < 3)
188 | rails (6.0.4.6)
189 | actioncable (= 6.0.4.6)
190 | actionmailbox (= 6.0.4.6)
191 | actionmailer (= 6.0.4.6)
192 | actionpack (= 6.0.4.6)
193 | actiontext (= 6.0.4.6)
194 | actionview (= 6.0.4.6)
195 | activejob (= 6.0.4.6)
196 | activemodel (= 6.0.4.6)
197 | activerecord (= 6.0.4.6)
198 | activestorage (= 6.0.4.6)
199 | activesupport (= 6.0.4.6)
200 | bundler (>= 1.3.0)
201 | railties (= 6.0.4.6)
202 | sprockets-rails (>= 2.0.0)
203 | rails-dom-testing (2.0.3)
204 | activesupport (>= 4.2.0)
205 | nokogiri (>= 1.6)
206 | rails-html-sanitizer (1.4.2)
207 | loofah (~> 2.3)
208 | railties (6.0.4.6)
209 | actionpack (= 6.0.4.6)
210 | activesupport (= 6.0.4.6)
211 | method_source
212 | rake (>= 0.8.7)
213 | thor (>= 0.20.3, < 2.0)
214 | rainbow (3.1.1)
215 | rake (13.0.6)
216 | ransack (2.5.0)
217 | activerecord (>= 5.2.4)
218 | activesupport (>= 5.2.4)
219 | i18n
220 | regexp_parser (2.2.1)
221 | responders (3.0.1)
222 | actionpack (>= 5.0)
223 | railties (>= 5.0)
224 | rexml (3.2.5)
225 | rspec-core (3.11.0)
226 | rspec-support (~> 3.11.0)
227 | rspec-expectations (3.11.0)
228 | diff-lcs (>= 1.2.0, < 2.0)
229 | rspec-support (~> 3.11.0)
230 | rspec-mocks (3.11.0)
231 | diff-lcs (>= 1.2.0, < 2.0)
232 | rspec-support (~> 3.11.0)
233 | rspec-rails (5.1.0)
234 | actionpack (>= 5.2)
235 | activesupport (>= 5.2)
236 | railties (>= 5.2)
237 | rspec-core (~> 3.10)
238 | rspec-expectations (~> 3.10)
239 | rspec-mocks (~> 3.10)
240 | rspec-support (~> 3.10)
241 | rspec-support (3.11.0)
242 | rspec_junit_formatter (0.5.1)
243 | rspec-core (>= 2, < 4, != 2.12.0)
244 | rubocop (1.25.1)
245 | parallel (~> 1.10)
246 | parser (>= 3.1.0.0)
247 | rainbow (>= 2.2.2, < 4.0)
248 | regexp_parser (>= 1.8, < 3.0)
249 | rexml
250 | rubocop-ast (>= 1.15.1, < 2.0)
251 | ruby-progressbar (~> 1.7)
252 | unicode-display_width (>= 1.4.0, < 3.0)
253 | rubocop-ast (1.16.0)
254 | parser (>= 3.1.1.0)
255 | rubocop-packaging (0.5.1)
256 | rubocop (>= 0.89, < 2.0)
257 | rubocop-performance (1.13.3)
258 | rubocop (>= 1.7.0, < 2.0)
259 | rubocop-ast (>= 0.4.0)
260 | rubocop-rails (2.13.2)
261 | activesupport (>= 4.2.0)
262 | rack (>= 1.1)
263 | rubocop (>= 1.7.0, < 2.0)
264 | rubocop-rspec (2.9.0)
265 | rubocop (~> 1.19)
266 | ruby-progressbar (1.11.0)
267 | ruby2_keywords (0.0.5)
268 | ruby_parser (3.18.1)
269 | sexp_processor (~> 4.16)
270 | rubyzip (2.3.2)
271 | sassc (2.4.0)
272 | ffi (~> 1.9)
273 | selenium-webdriver (4.1.0)
274 | childprocess (>= 0.5, < 5.0)
275 | rexml (~> 3.2, >= 3.2.5)
276 | rubyzip (>= 1.2.2)
277 | sexp_processor (4.16.0)
278 | sprockets (4.0.3)
279 | concurrent-ruby (~> 1.0)
280 | rack (> 1, < 3)
281 | sprockets-rails (3.4.2)
282 | actionpack (>= 5.2)
283 | activesupport (>= 5.2)
284 | sprockets (>= 3.0.0)
285 | sqlite3 (1.4.2)
286 | thor (1.2.1)
287 | thread_safe (0.3.6)
288 | tzinfo (1.2.9)
289 | thread_safe (~> 0.1)
290 | unicode-display_width (2.1.0)
291 | vcr (6.0.0)
292 | webmock (3.14.0)
293 | addressable (>= 2.8.0)
294 | crack (>= 0.3.2)
295 | hashdiff (>= 0.4.0, < 2.0.0)
296 | websocket-driver (0.7.5)
297 | websocket-extensions (>= 0.1.0)
298 | websocket-extensions (0.1.5)
299 | xpath (3.2.0)
300 | nokogiri (~> 1.8)
301 | zeitwerk (2.5.4)
302 |
303 | PLATFORMS
304 | arm64-darwin-22
305 | x86_64-darwin-21
306 | x86_64-linux
307 |
308 | DEPENDENCIES
309 | activeadmin
310 | activeadmin_active_resource!
311 | activeresource
312 | appraisal (~> 2.4)
313 | capybara
314 | cuprite
315 | fasterer
316 | pry-rails
317 | psych (~> 3.0)
318 | puma
319 | rails (~> 6.0.0)
320 | rspec-rails
321 | rspec_junit_formatter
322 | rubocop
323 | rubocop-packaging
324 | rubocop-performance
325 | rubocop-rails
326 | rubocop-rspec
327 | sassc
328 | selenium-webdriver
329 | sprockets-rails
330 | sqlite3
331 | vcr
332 | webmock
333 |
334 | BUNDLED WITH
335 | 2.3.8
336 |
--------------------------------------------------------------------------------
/gemfiles/rails61_activeadmin29_activeresource51.gemfile:
--------------------------------------------------------------------------------
1 | # This file was generated by Appraisal
2 |
3 | source "https://rubygems.org"
4 |
5 | gem "activeadmin", "~> 2.9.0"
6 | gem "activeresource", "~> 5.1.0"
7 | gem "rails", "~> 6.1.0"
8 | gem "sprockets-rails"
9 |
10 | group :development, :test do
11 | gem "puma"
12 | gem "sassc"
13 | gem "sqlite3"
14 | gem "capybara"
15 | gem "cuprite"
16 | gem "rspec_junit_formatter"
17 | gem "rspec-rails"
18 | gem "vcr"
19 | gem "webmock"
20 | gem "fasterer"
21 | gem "rubocop"
22 | gem "rubocop-packaging"
23 | gem "rubocop-performance"
24 | gem "rubocop-rails"
25 | gem "rubocop-rspec"
26 | gem "pry-rails"
27 | end
28 |
29 | gemspec path: "../"
30 |
--------------------------------------------------------------------------------
/gemfiles/rails61_activeadmin29_activeresource51.gemfile.lock:
--------------------------------------------------------------------------------
1 | PATH
2 | remote: ..
3 | specs:
4 | activeadmin_active_resource (0.3.0)
5 | activeadmin (>= 2.0, < 4)
6 | activeresource (>= 5.1)
7 |
8 | GEM
9 | remote: https://rubygems.org/
10 | specs:
11 | actioncable (6.1.4.6)
12 | actionpack (= 6.1.4.6)
13 | activesupport (= 6.1.4.6)
14 | nio4r (~> 2.0)
15 | websocket-driver (>= 0.6.1)
16 | actionmailbox (6.1.4.6)
17 | actionpack (= 6.1.4.6)
18 | activejob (= 6.1.4.6)
19 | activerecord (= 6.1.4.6)
20 | activestorage (= 6.1.4.6)
21 | activesupport (= 6.1.4.6)
22 | mail (>= 2.7.1)
23 | actionmailer (6.1.4.6)
24 | actionpack (= 6.1.4.6)
25 | actionview (= 6.1.4.6)
26 | activejob (= 6.1.4.6)
27 | activesupport (= 6.1.4.6)
28 | mail (~> 2.5, >= 2.5.4)
29 | rails-dom-testing (~> 2.0)
30 | actionpack (6.1.4.6)
31 | actionview (= 6.1.4.6)
32 | activesupport (= 6.1.4.6)
33 | rack (~> 2.0, >= 2.0.9)
34 | rack-test (>= 0.6.3)
35 | rails-dom-testing (~> 2.0)
36 | rails-html-sanitizer (~> 1.0, >= 1.2.0)
37 | actiontext (6.1.4.6)
38 | actionpack (= 6.1.4.6)
39 | activerecord (= 6.1.4.6)
40 | activestorage (= 6.1.4.6)
41 | activesupport (= 6.1.4.6)
42 | nokogiri (>= 1.8.5)
43 | actionview (6.1.4.6)
44 | activesupport (= 6.1.4.6)
45 | builder (~> 3.1)
46 | erubi (~> 1.4)
47 | rails-dom-testing (~> 2.0)
48 | rails-html-sanitizer (~> 1.1, >= 1.2.0)
49 | activeadmin (2.9.0)
50 | arbre (~> 1.2, >= 1.2.1)
51 | formtastic (>= 3.1, < 5.0)
52 | formtastic_i18n (~> 0.4)
53 | inherited_resources (~> 1.7)
54 | jquery-rails (~> 4.2)
55 | kaminari (~> 1.0, >= 1.2.1)
56 | railties (>= 5.2, < 6.2)
57 | ransack (~> 2.1, >= 2.1.1)
58 | activejob (6.1.4.6)
59 | activesupport (= 6.1.4.6)
60 | globalid (>= 0.3.6)
61 | activemodel (6.1.4.6)
62 | activesupport (= 6.1.4.6)
63 | activemodel-serializers-xml (1.0.2)
64 | activemodel (> 5.x)
65 | activesupport (> 5.x)
66 | builder (~> 3.1)
67 | activerecord (6.1.4.6)
68 | activemodel (= 6.1.4.6)
69 | activesupport (= 6.1.4.6)
70 | activeresource (5.1.1)
71 | activemodel (>= 5.0, < 7)
72 | activemodel-serializers-xml (~> 1.0)
73 | activesupport (>= 5.0, < 7)
74 | activestorage (6.1.4.6)
75 | actionpack (= 6.1.4.6)
76 | activejob (= 6.1.4.6)
77 | activerecord (= 6.1.4.6)
78 | activesupport (= 6.1.4.6)
79 | marcel (~> 1.0.0)
80 | mini_mime (>= 1.1.0)
81 | activesupport (6.1.4.6)
82 | concurrent-ruby (~> 1.0, >= 1.0.2)
83 | i18n (>= 1.6, < 2)
84 | minitest (>= 5.1)
85 | tzinfo (~> 2.0)
86 | zeitwerk (~> 2.3)
87 | addressable (2.8.0)
88 | public_suffix (>= 2.0.2, < 5.0)
89 | appraisal (2.4.1)
90 | bundler
91 | rake
92 | thor (>= 0.14.0)
93 | arbre (1.5.0)
94 | activesupport (>= 3.0.0, < 7.1)
95 | ruby2_keywords (>= 0.0.2, < 1.0)
96 | ast (2.4.2)
97 | builder (3.2.4)
98 | capybara (3.36.0)
99 | addressable
100 | matrix
101 | mini_mime (>= 0.1.3)
102 | nokogiri (~> 1.8)
103 | rack (>= 1.6.0)
104 | rack-test (>= 0.6.3)
105 | regexp_parser (>= 1.5, < 3.0)
106 | xpath (~> 3.2)
107 | cliver (0.3.2)
108 | coderay (1.1.3)
109 | colorize (0.8.1)
110 | concurrent-ruby (1.1.9)
111 | crack (0.4.5)
112 | rexml
113 | crass (1.0.6)
114 | cuprite (0.13)
115 | capybara (>= 2.1, < 4)
116 | ferrum (~> 0.11.0)
117 | diff-lcs (1.5.0)
118 | erubi (1.10.0)
119 | fasterer (0.9.0)
120 | colorize (~> 0.7)
121 | ruby_parser (>= 3.14.1)
122 | ferrum (0.11)
123 | addressable (~> 2.5)
124 | cliver (~> 0.3)
125 | concurrent-ruby (~> 1.1)
126 | websocket-driver (>= 0.6, < 0.8)
127 | ffi (1.15.5)
128 | formtastic (4.0.0)
129 | actionpack (>= 5.2.0)
130 | formtastic_i18n (0.7.0)
131 | globalid (1.0.0)
132 | activesupport (>= 5.0)
133 | has_scope (0.8.0)
134 | actionpack (>= 5.2)
135 | activesupport (>= 5.2)
136 | hashdiff (1.0.1)
137 | i18n (1.10.0)
138 | concurrent-ruby (~> 1.0)
139 | inherited_resources (1.13.1)
140 | actionpack (>= 5.2, < 7.1)
141 | has_scope (~> 0.6)
142 | railties (>= 5.2, < 7.1)
143 | responders (>= 2, < 4)
144 | jquery-rails (4.4.0)
145 | rails-dom-testing (>= 1, < 3)
146 | railties (>= 4.2.0)
147 | thor (>= 0.14, < 2.0)
148 | kaminari (1.2.2)
149 | activesupport (>= 4.1.0)
150 | kaminari-actionview (= 1.2.2)
151 | kaminari-activerecord (= 1.2.2)
152 | kaminari-core (= 1.2.2)
153 | kaminari-actionview (1.2.2)
154 | actionview
155 | kaminari-core (= 1.2.2)
156 | kaminari-activerecord (1.2.2)
157 | activerecord
158 | kaminari-core (= 1.2.2)
159 | kaminari-core (1.2.2)
160 | loofah (2.14.0)
161 | crass (~> 1.0.2)
162 | nokogiri (>= 1.5.9)
163 | mail (2.7.1)
164 | mini_mime (>= 0.1.1)
165 | marcel (1.0.2)
166 | matrix (0.4.2)
167 | method_source (1.0.0)
168 | mini_mime (1.1.2)
169 | mini_portile2 (2.8.4)
170 | minitest (5.15.0)
171 | nio4r (2.5.8)
172 | nokogiri (1.13.3)
173 | mini_portile2 (~> 2.8.0)
174 | racc (~> 1.4)
175 | parallel (1.21.0)
176 | parser (3.1.1.0)
177 | ast (~> 2.4.1)
178 | pry (0.14.1)
179 | coderay (~> 1.1)
180 | method_source (~> 1.0)
181 | pry-rails (0.3.9)
182 | pry (>= 0.10.4)
183 | public_suffix (4.0.6)
184 | puma (5.6.2)
185 | nio4r (~> 2.0)
186 | racc (1.6.0)
187 | rack (2.2.3)
188 | rack-test (1.1.0)
189 | rack (>= 1.0, < 3)
190 | rails (6.1.4.6)
191 | actioncable (= 6.1.4.6)
192 | actionmailbox (= 6.1.4.6)
193 | actionmailer (= 6.1.4.6)
194 | actionpack (= 6.1.4.6)
195 | actiontext (= 6.1.4.6)
196 | actionview (= 6.1.4.6)
197 | activejob (= 6.1.4.6)
198 | activemodel (= 6.1.4.6)
199 | activerecord (= 6.1.4.6)
200 | activestorage (= 6.1.4.6)
201 | activesupport (= 6.1.4.6)
202 | bundler (>= 1.15.0)
203 | railties (= 6.1.4.6)
204 | sprockets-rails (>= 2.0.0)
205 | rails-dom-testing (2.0.3)
206 | activesupport (>= 4.2.0)
207 | nokogiri (>= 1.6)
208 | rails-html-sanitizer (1.4.2)
209 | loofah (~> 2.3)
210 | railties (6.1.4.6)
211 | actionpack (= 6.1.4.6)
212 | activesupport (= 6.1.4.6)
213 | method_source
214 | rake (>= 0.13)
215 | thor (~> 1.0)
216 | rainbow (3.1.1)
217 | rake (13.0.6)
218 | ransack (2.5.0)
219 | activerecord (>= 5.2.4)
220 | activesupport (>= 5.2.4)
221 | i18n
222 | regexp_parser (2.2.1)
223 | responders (3.0.1)
224 | actionpack (>= 5.0)
225 | railties (>= 5.0)
226 | rexml (3.2.5)
227 | rspec-core (3.11.0)
228 | rspec-support (~> 3.11.0)
229 | rspec-expectations (3.11.0)
230 | diff-lcs (>= 1.2.0, < 2.0)
231 | rspec-support (~> 3.11.0)
232 | rspec-mocks (3.11.0)
233 | diff-lcs (>= 1.2.0, < 2.0)
234 | rspec-support (~> 3.11.0)
235 | rspec-rails (5.1.0)
236 | actionpack (>= 5.2)
237 | activesupport (>= 5.2)
238 | railties (>= 5.2)
239 | rspec-core (~> 3.10)
240 | rspec-expectations (~> 3.10)
241 | rspec-mocks (~> 3.10)
242 | rspec-support (~> 3.10)
243 | rspec-support (3.11.0)
244 | rspec_junit_formatter (0.5.1)
245 | rspec-core (>= 2, < 4, != 2.12.0)
246 | rubocop (1.25.1)
247 | parallel (~> 1.10)
248 | parser (>= 3.1.0.0)
249 | rainbow (>= 2.2.2, < 4.0)
250 | regexp_parser (>= 1.8, < 3.0)
251 | rexml
252 | rubocop-ast (>= 1.15.1, < 2.0)
253 | ruby-progressbar (~> 1.7)
254 | unicode-display_width (>= 1.4.0, < 3.0)
255 | rubocop-ast (1.16.0)
256 | parser (>= 3.1.1.0)
257 | rubocop-packaging (0.5.1)
258 | rubocop (>= 0.89, < 2.0)
259 | rubocop-performance (1.13.3)
260 | rubocop (>= 1.7.0, < 2.0)
261 | rubocop-ast (>= 0.4.0)
262 | rubocop-rails (2.13.2)
263 | activesupport (>= 4.2.0)
264 | rack (>= 1.1)
265 | rubocop (>= 1.7.0, < 2.0)
266 | rubocop-rspec (2.9.0)
267 | rubocop (~> 1.19)
268 | ruby-progressbar (1.11.0)
269 | ruby2_keywords (0.0.5)
270 | ruby_parser (3.18.1)
271 | sexp_processor (~> 4.16)
272 | sassc (2.4.0)
273 | ffi (~> 1.9)
274 | sexp_processor (4.16.0)
275 | sprockets (4.0.3)
276 | concurrent-ruby (~> 1.0)
277 | rack (> 1, < 3)
278 | sprockets-rails (3.4.2)
279 | actionpack (>= 5.2)
280 | activesupport (>= 5.2)
281 | sprockets (>= 3.0.0)
282 | sqlite3 (1.4.2)
283 | thor (1.2.1)
284 | tzinfo (2.0.4)
285 | concurrent-ruby (~> 1.0)
286 | unicode-display_width (2.1.0)
287 | vcr (6.0.0)
288 | webmock (3.14.0)
289 | addressable (>= 2.8.0)
290 | crack (>= 0.3.2)
291 | hashdiff (>= 0.4.0, < 2.0.0)
292 | websocket-driver (0.7.5)
293 | websocket-extensions (>= 0.1.0)
294 | websocket-extensions (0.1.5)
295 | xpath (3.2.0)
296 | nokogiri (~> 1.8)
297 | zeitwerk (2.5.4)
298 |
299 | PLATFORMS
300 | arm64-darwin-22
301 | x86_64-darwin-21
302 | x86_64-linux
303 |
304 | DEPENDENCIES
305 | activeadmin (~> 2.9.0)
306 | activeadmin_active_resource!
307 | activeresource (~> 5.1.0)
308 | appraisal (~> 2.4)
309 | capybara
310 | cuprite
311 | fasterer
312 | pry-rails
313 | puma
314 | rails (~> 6.1.0)
315 | rspec-rails
316 | rspec_junit_formatter
317 | rubocop
318 | rubocop-packaging
319 | rubocop-performance
320 | rubocop-rails
321 | rubocop-rspec
322 | sassc
323 | sprockets-rails
324 | sqlite3
325 | vcr
326 | webmock
327 |
328 | BUNDLED WITH
329 | 2.3.8
330 |
--------------------------------------------------------------------------------
/gemfiles/rails61_activeadmin_activeresource.gemfile:
--------------------------------------------------------------------------------
1 | # This file was generated by Appraisal
2 |
3 | source "https://rubygems.org"
4 |
5 | gem "activeadmin"
6 | gem "activeresource"
7 | gem "rails", "~> 6.1.0"
8 | gem "sprockets-rails"
9 |
10 | group :development, :test do
11 | gem "puma"
12 | gem "sassc"
13 | gem "sqlite3"
14 | gem "capybara"
15 | gem "cuprite"
16 | gem "rspec_junit_formatter"
17 | gem "rspec-rails"
18 | gem "vcr"
19 | gem "webmock"
20 | gem "fasterer"
21 | gem "rubocop"
22 | gem "rubocop-packaging"
23 | gem "rubocop-performance"
24 | gem "rubocop-rails"
25 | gem "rubocop-rspec"
26 | gem "pry-rails"
27 | end
28 |
29 | gemspec path: "../"
30 |
--------------------------------------------------------------------------------
/gemfiles/rails61_activeadmin_activeresource.gemfile.lock:
--------------------------------------------------------------------------------
1 | PATH
2 | remote: ..
3 | specs:
4 | activeadmin_active_resource (0.3.0)
5 | activeadmin (>= 2.0, < 4)
6 | activeresource (>= 5.1)
7 |
8 | GEM
9 | remote: https://rubygems.org/
10 | specs:
11 | actioncable (6.1.4.6)
12 | actionpack (= 6.1.4.6)
13 | activesupport (= 6.1.4.6)
14 | nio4r (~> 2.0)
15 | websocket-driver (>= 0.6.1)
16 | actionmailbox (6.1.4.6)
17 | actionpack (= 6.1.4.6)
18 | activejob (= 6.1.4.6)
19 | activerecord (= 6.1.4.6)
20 | activestorage (= 6.1.4.6)
21 | activesupport (= 6.1.4.6)
22 | mail (>= 2.7.1)
23 | actionmailer (6.1.4.6)
24 | actionpack (= 6.1.4.6)
25 | actionview (= 6.1.4.6)
26 | activejob (= 6.1.4.6)
27 | activesupport (= 6.1.4.6)
28 | mail (~> 2.5, >= 2.5.4)
29 | rails-dom-testing (~> 2.0)
30 | actionpack (6.1.4.6)
31 | actionview (= 6.1.4.6)
32 | activesupport (= 6.1.4.6)
33 | rack (~> 2.0, >= 2.0.9)
34 | rack-test (>= 0.6.3)
35 | rails-dom-testing (~> 2.0)
36 | rails-html-sanitizer (~> 1.0, >= 1.2.0)
37 | actiontext (6.1.4.6)
38 | actionpack (= 6.1.4.6)
39 | activerecord (= 6.1.4.6)
40 | activestorage (= 6.1.4.6)
41 | activesupport (= 6.1.4.6)
42 | nokogiri (>= 1.8.5)
43 | actionview (6.1.4.6)
44 | activesupport (= 6.1.4.6)
45 | builder (~> 3.1)
46 | erubi (~> 1.4)
47 | rails-dom-testing (~> 2.0)
48 | rails-html-sanitizer (~> 1.1, >= 1.2.0)
49 | activeadmin (2.10.1)
50 | arbre (~> 1.2, >= 1.2.1)
51 | formtastic (>= 3.1, < 5.0)
52 | formtastic_i18n (~> 0.4)
53 | inherited_resources (~> 1.7)
54 | jquery-rails (~> 4.2)
55 | kaminari (~> 1.0, >= 1.2.1)
56 | railties (>= 6.0, < 6.2)
57 | ransack (~> 2.1, >= 2.1.1)
58 | activejob (6.1.4.6)
59 | activesupport (= 6.1.4.6)
60 | globalid (>= 0.3.6)
61 | activemodel (6.1.4.6)
62 | activesupport (= 6.1.4.6)
63 | activemodel-serializers-xml (1.0.2)
64 | activemodel (> 5.x)
65 | activesupport (> 5.x)
66 | builder (~> 3.1)
67 | activerecord (6.1.4.6)
68 | activemodel (= 6.1.4.6)
69 | activesupport (= 6.1.4.6)
70 | activeresource (6.0.0)
71 | activemodel (>= 6.0)
72 | activemodel-serializers-xml (~> 1.0)
73 | activesupport (>= 6.0)
74 | activestorage (6.1.4.6)
75 | actionpack (= 6.1.4.6)
76 | activejob (= 6.1.4.6)
77 | activerecord (= 6.1.4.6)
78 | activesupport (= 6.1.4.6)
79 | marcel (~> 1.0.0)
80 | mini_mime (>= 1.1.0)
81 | activesupport (6.1.4.6)
82 | concurrent-ruby (~> 1.0, >= 1.0.2)
83 | i18n (>= 1.6, < 2)
84 | minitest (>= 5.1)
85 | tzinfo (~> 2.0)
86 | zeitwerk (~> 2.3)
87 | addressable (2.8.0)
88 | public_suffix (>= 2.0.2, < 5.0)
89 | appraisal (2.4.1)
90 | bundler
91 | rake
92 | thor (>= 0.14.0)
93 | arbre (1.5.0)
94 | activesupport (>= 3.0.0, < 7.1)
95 | ruby2_keywords (>= 0.0.2, < 1.0)
96 | ast (2.4.2)
97 | builder (3.2.4)
98 | capybara (3.36.0)
99 | addressable
100 | matrix
101 | mini_mime (>= 0.1.3)
102 | nokogiri (~> 1.8)
103 | rack (>= 1.6.0)
104 | rack-test (>= 0.6.3)
105 | regexp_parser (>= 1.5, < 3.0)
106 | xpath (~> 3.2)
107 | cliver (0.3.2)
108 | coderay (1.1.3)
109 | colorize (0.8.1)
110 | concurrent-ruby (1.1.9)
111 | crack (0.4.5)
112 | rexml
113 | crass (1.0.6)
114 | cuprite (0.13)
115 | capybara (>= 2.1, < 4)
116 | ferrum (~> 0.11.0)
117 | diff-lcs (1.5.0)
118 | erubi (1.10.0)
119 | fasterer (0.9.0)
120 | colorize (~> 0.7)
121 | ruby_parser (>= 3.14.1)
122 | ferrum (0.11)
123 | addressable (~> 2.5)
124 | cliver (~> 0.3)
125 | concurrent-ruby (~> 1.1)
126 | websocket-driver (>= 0.6, < 0.8)
127 | ffi (1.15.5)
128 | formtastic (4.0.0)
129 | actionpack (>= 5.2.0)
130 | formtastic_i18n (0.7.0)
131 | globalid (1.0.0)
132 | activesupport (>= 5.0)
133 | has_scope (0.8.0)
134 | actionpack (>= 5.2)
135 | activesupport (>= 5.2)
136 | hashdiff (1.0.1)
137 | i18n (1.10.0)
138 | concurrent-ruby (~> 1.0)
139 | inherited_resources (1.13.1)
140 | actionpack (>= 5.2, < 7.1)
141 | has_scope (~> 0.6)
142 | railties (>= 5.2, < 7.1)
143 | responders (>= 2, < 4)
144 | jquery-rails (4.4.0)
145 | rails-dom-testing (>= 1, < 3)
146 | railties (>= 4.2.0)
147 | thor (>= 0.14, < 2.0)
148 | kaminari (1.2.2)
149 | activesupport (>= 4.1.0)
150 | kaminari-actionview (= 1.2.2)
151 | kaminari-activerecord (= 1.2.2)
152 | kaminari-core (= 1.2.2)
153 | kaminari-actionview (1.2.2)
154 | actionview
155 | kaminari-core (= 1.2.2)
156 | kaminari-activerecord (1.2.2)
157 | activerecord
158 | kaminari-core (= 1.2.2)
159 | kaminari-core (1.2.2)
160 | loofah (2.14.0)
161 | crass (~> 1.0.2)
162 | nokogiri (>= 1.5.9)
163 | mail (2.7.1)
164 | mini_mime (>= 0.1.1)
165 | marcel (1.0.2)
166 | matrix (0.4.2)
167 | method_source (1.0.0)
168 | mini_mime (1.1.2)
169 | mini_portile2 (2.8.0)
170 | minitest (5.15.0)
171 | nio4r (2.5.8)
172 | nokogiri (1.13.3)
173 | mini_portile2 (~> 2.8.0)
174 | racc (~> 1.4)
175 | nokogiri (1.13.3-aarch64-linux)
176 | racc (~> 1.4)
177 | nokogiri (1.13.3-x86_64-darwin)
178 | racc (~> 1.4)
179 | nokogiri (1.13.3-x86_64-linux)
180 | racc (~> 1.4)
181 | parallel (1.21.0)
182 | parser (3.1.1.0)
183 | ast (~> 2.4.1)
184 | pry (0.14.1)
185 | coderay (~> 1.1)
186 | method_source (~> 1.0)
187 | pry-rails (0.3.9)
188 | pry (>= 0.10.4)
189 | public_suffix (4.0.6)
190 | puma (5.6.2)
191 | nio4r (~> 2.0)
192 | racc (1.6.0)
193 | rack (2.2.3)
194 | rack-test (1.1.0)
195 | rack (>= 1.0, < 3)
196 | rails (6.1.4.6)
197 | actioncable (= 6.1.4.6)
198 | actionmailbox (= 6.1.4.6)
199 | actionmailer (= 6.1.4.6)
200 | actionpack (= 6.1.4.6)
201 | actiontext (= 6.1.4.6)
202 | actionview (= 6.1.4.6)
203 | activejob (= 6.1.4.6)
204 | activemodel (= 6.1.4.6)
205 | activerecord (= 6.1.4.6)
206 | activestorage (= 6.1.4.6)
207 | activesupport (= 6.1.4.6)
208 | bundler (>= 1.15.0)
209 | railties (= 6.1.4.6)
210 | sprockets-rails (>= 2.0.0)
211 | rails-dom-testing (2.0.3)
212 | activesupport (>= 4.2.0)
213 | nokogiri (>= 1.6)
214 | rails-html-sanitizer (1.4.2)
215 | loofah (~> 2.3)
216 | railties (6.1.4.6)
217 | actionpack (= 6.1.4.6)
218 | activesupport (= 6.1.4.6)
219 | method_source
220 | rake (>= 0.13)
221 | thor (~> 1.0)
222 | rainbow (3.1.1)
223 | rake (13.0.6)
224 | ransack (2.5.0)
225 | activerecord (>= 5.2.4)
226 | activesupport (>= 5.2.4)
227 | i18n
228 | regexp_parser (2.2.1)
229 | responders (3.0.1)
230 | actionpack (>= 5.0)
231 | railties (>= 5.0)
232 | rexml (3.2.5)
233 | rspec-core (3.11.0)
234 | rspec-support (~> 3.11.0)
235 | rspec-expectations (3.11.0)
236 | diff-lcs (>= 1.2.0, < 2.0)
237 | rspec-support (~> 3.11.0)
238 | rspec-mocks (3.11.0)
239 | diff-lcs (>= 1.2.0, < 2.0)
240 | rspec-support (~> 3.11.0)
241 | rspec-rails (5.1.0)
242 | actionpack (>= 5.2)
243 | activesupport (>= 5.2)
244 | railties (>= 5.2)
245 | rspec-core (~> 3.10)
246 | rspec-expectations (~> 3.10)
247 | rspec-mocks (~> 3.10)
248 | rspec-support (~> 3.10)
249 | rspec-support (3.11.0)
250 | rspec_junit_formatter (0.5.1)
251 | rspec-core (>= 2, < 4, != 2.12.0)
252 | rubocop (1.25.1)
253 | parallel (~> 1.10)
254 | parser (>= 3.1.0.0)
255 | rainbow (>= 2.2.2, < 4.0)
256 | regexp_parser (>= 1.8, < 3.0)
257 | rexml
258 | rubocop-ast (>= 1.15.1, < 2.0)
259 | ruby-progressbar (~> 1.7)
260 | unicode-display_width (>= 1.4.0, < 3.0)
261 | rubocop-ast (1.16.0)
262 | parser (>= 3.1.1.0)
263 | rubocop-packaging (0.5.1)
264 | rubocop (>= 0.89, < 2.0)
265 | rubocop-performance (1.13.3)
266 | rubocop (>= 1.7.0, < 2.0)
267 | rubocop-ast (>= 0.4.0)
268 | rubocop-rails (2.13.2)
269 | activesupport (>= 4.2.0)
270 | rack (>= 1.1)
271 | rubocop (>= 1.7.0, < 2.0)
272 | rubocop-rspec (2.9.0)
273 | rubocop (~> 1.19)
274 | ruby-progressbar (1.11.0)
275 | ruby2_keywords (0.0.5)
276 | ruby_parser (3.18.1)
277 | sexp_processor (~> 4.16)
278 | sassc (2.4.0)
279 | ffi (~> 1.9)
280 | sexp_processor (4.16.0)
281 | sprockets (4.0.3)
282 | concurrent-ruby (~> 1.0)
283 | rack (> 1, < 3)
284 | sprockets-rails (3.4.2)
285 | actionpack (>= 5.2)
286 | activesupport (>= 5.2)
287 | sprockets (>= 3.0.0)
288 | sqlite3 (1.4.2)
289 | thor (1.2.1)
290 | tzinfo (2.0.4)
291 | concurrent-ruby (~> 1.0)
292 | unicode-display_width (2.1.0)
293 | vcr (6.0.0)
294 | webmock (3.14.0)
295 | addressable (>= 2.8.0)
296 | crack (>= 0.3.2)
297 | hashdiff (>= 0.4.0, < 2.0.0)
298 | websocket-driver (0.7.5)
299 | websocket-extensions (>= 0.1.0)
300 | websocket-extensions (0.1.5)
301 | xpath (3.2.0)
302 | nokogiri (~> 1.8)
303 | zeitwerk (2.5.4)
304 |
305 | PLATFORMS
306 | aarch64-linux
307 | ruby
308 | x86_64-darwin-21
309 | x86_64-linux
310 |
311 | DEPENDENCIES
312 | activeadmin
313 | activeadmin_active_resource!
314 | activeresource
315 | appraisal (~> 2.4)
316 | capybara
317 | cuprite
318 | fasterer
319 | pry-rails
320 | puma
321 | rails (~> 6.1.0)
322 | rspec-rails
323 | rspec_junit_formatter
324 | rubocop
325 | rubocop-packaging
326 | rubocop-performance
327 | rubocop-rails
328 | rubocop-rspec
329 | sassc
330 | sprockets-rails
331 | sqlite3
332 | vcr
333 | webmock
334 |
335 | BUNDLED WITH
336 | 2.3.8
337 |
--------------------------------------------------------------------------------
/gemfiles/rails70_activeadmin_activeresource.gemfile:
--------------------------------------------------------------------------------
1 | # This file was generated by Appraisal
2 |
3 | source "https://rubygems.org"
4 |
5 | gem "activeadmin"
6 | gem "activeresource"
7 | gem "rails", "~> 7.0.0"
8 | gem "sprockets-rails"
9 |
10 | group :development, :test do
11 | gem "puma"
12 | gem "sassc"
13 | gem "sqlite3"
14 | gem "capybara"
15 | gem "cuprite"
16 | gem "rspec_junit_formatter"
17 | gem "rspec-rails"
18 | gem "vcr"
19 | gem "webmock"
20 | gem "fasterer"
21 | gem "rubocop"
22 | gem "rubocop-packaging"
23 | gem "rubocop-performance"
24 | gem "rubocop-rails"
25 | gem "rubocop-rspec"
26 | gem "pry-rails"
27 | end
28 |
29 | gemspec path: "../"
30 |
--------------------------------------------------------------------------------
/lib/activeadmin/active_resource.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'activeadmin/active_resource/engine'
4 |
5 | module ActiveAdmin
6 | module ActiveResource; end
7 | end
8 |
--------------------------------------------------------------------------------
/lib/activeadmin/active_resource/base.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ActiveAdmin
4 | module ActiveResource
5 | module Base
6 | attr_writer :inheritance_column
7 |
8 | # ref: https://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/ClassMethods.html#method-i-column_for_attribute
9 | def column_for_attribute(name)
10 | # => ActiveRecord::ConnectionAdapters::Column
11 | col_name = name.to_s
12 | send(:class).columns.find { |col| col.name == col_name }
13 | end
14 |
15 | module ClassMethods
16 | prepend(FindExt = Module.new do
17 | def find(*arguments)
18 | # First argument an array -> batch action
19 | if arguments.count > 0 && arguments[0].is_a?(Array)
20 | ret = []
21 | arguments[0].each do |id|
22 | ret << find(id)
23 | end
24 | ret.compact
25 | else
26 | super
27 | end
28 | end
29 | end)
30 |
31 | def _ransackers
32 | {}
33 | end
34 |
35 | # ref: https://api.rubyonrails.org/classes/ActiveRecord/ModelSchema/ClassMethods.html#method-i-content_columns
36 | def content_columns
37 | @content_columns ||= columns.reject do |c|
38 | # c.name == primary_key || # required to update enities
39 | c.name == inheritance_column ||
40 | c.name.end_with?("_id") ||
41 | c.name.end_with?("_count")
42 | end
43 | end
44 |
45 | # ref: http://api.rubyonrails.org/classes/ActiveRecord/ModelSchema/ClassMethods.html#method-i-column_names
46 | def column_names
47 | @column_names ||= columns.map(&:name)
48 | end
49 |
50 | # ref: http://api.rubyonrails.org/classes/ActiveRecord/ModelSchema/ClassMethods.html#method-i-columns
51 | def columns
52 | # => array of ActiveRecord::ConnectionAdapters::Column
53 | @columns ||=
54 | schema.map do |name, type|
55 | col_name = name.to_s
56 | col_type = type.to_sym
57 | col_type = :hidden if col_name == 'id'
58 | OpenStruct.new(name: col_name, type: col_type)
59 | end
60 | end
61 |
62 | def find_all(options = {})
63 | prefix_options, query_options = split_options(options[:params])
64 | query_options[:limit] = query_options[:per_page]
65 | path = collection_path(prefix_options, query_options)
66 | @connection_response = connection.get(path, headers)
67 | instantiate_collection((format.decode( @connection_response.body ) || []), query_options, prefix_options)
68 | end
69 |
70 | # -> http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-find_by
71 | def find_by(arg, *_args)
72 | arg && arg['id'] ? find(arg['id']) : find(:first, arg)
73 | end
74 |
75 | # -> http://api.rubyonrails.org/classes/ActiveRecord/ModelSchema/ClassMethods.html#method-i-inheritance_column
76 | def inheritance_column
77 | (@inheritance_column ||= nil) || 'type'
78 | end
79 |
80 | # -> http://api.rubyonrails.org/classes/ActiveRecord/ModelSchema/ClassMethods.html#method-i-quoted_table_name
81 | def quoted_table_name
82 | @quoted_table_name ||= "\"#{to_s.tableize}\""
83 | end
84 |
85 | def page(page)
86 | @page = page.to_i
87 | @page = 1 if @page < 1
88 | self
89 | end
90 |
91 | def per(page_count)
92 | @per_page = page_count.to_i
93 | results
94 | end
95 |
96 | def ransack(params = {}, _options = {})
97 | @ransack_params = params.blank? ? {} : params.permit!.to_h
98 | OpenStruct.new(conditions: {}, object: OpenStruct.new(klass: self), result: self)
99 | end
100 |
101 | # -> http://api.rubyonrails.org/classes/ActiveRecord/Reflection/ClassMethods.html#method-i-reflect_on_all_associations
102 | def reflect_on_all_associations(_macro = nil)
103 | []
104 | end
105 |
106 | # -> http://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-reorder
107 | def reorder(sql)
108 | @order = sql
109 | self
110 | end
111 |
112 | def results
113 | results = find_all params: { page: @page, per_page: @per_page, order: @order, q: @ransack_params }
114 | decorate_with_pagination_data(results)
115 | end
116 |
117 | def decorate_with_pagination_data(results)
118 | results.current_page = @page
119 | results.limit_value = (@connection_response['pagination-limit'] || @per_page).to_i
120 | results.total_count = (@connection_response['pagination-totalcount'] || results.count).to_i
121 | results.total_pages = results.limit_value > 0 ? (results.total_count.to_f / results.limit_value).ceil : 1
122 | results
123 | end
124 | end
125 |
126 | def self.prepended(base)
127 | base.collection_parser = ActiveAdmin::ActiveResource::Results
128 |
129 | class << base
130 | prepend ClassMethods
131 | end
132 | end
133 | end
134 | end
135 | end
136 |
--------------------------------------------------------------------------------
/lib/activeadmin/active_resource/connection.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ActiveAdmin
4 | module ActiveResource
5 | module Connection
6 | # ref: https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Quoting.html#method-i-quote_column_name
7 | def quote_column_name(column_name)
8 | column_name.to_s
9 | end
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/lib/activeadmin/active_resource/engine.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'active_admin'
4 | require 'active_resource'
5 |
6 | require_relative 'base'
7 | require_relative 'connection'
8 | require_relative 'results'
9 |
10 | module ActiveAdmin
11 | module ActiveResource
12 | class Engine < ::Rails::Engine
13 | engine_name 'activeadmin_active_resource'
14 | end
15 | end
16 | end
17 |
18 | ::ActiveResource::Base.class_eval do
19 | prepend ActiveAdmin::ActiveResource::Base
20 | end
21 |
22 | ::ActiveResource::Connection.class_eval do
23 | prepend ActiveAdmin::ActiveResource::Connection
24 | end
25 |
--------------------------------------------------------------------------------
/lib/activeadmin/active_resource/results.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ActiveAdmin
4 | module ActiveResource
5 | class Results < ::ActiveResource::Collection
6 | attr_accessor :current_page, :limit_value, :total_count, :total_pages
7 |
8 | def initialize(elements = [])
9 | super elements
10 | @limit_value = ActiveAdmin.application.default_per_page
11 | @total_count = 0
12 | @total_pages = 1
13 | @current_page = 1
14 | end
15 |
16 | def except(*_params)
17 | self
18 | end
19 |
20 | def group_values
21 | nil
22 | end
23 | end
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/lib/activeadmin/active_resource/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ActiveAdmin
4 | module ActiveResource
5 | VERSION = '0.3.0'
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/lib/activeadmin_active_resource.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'activeadmin/active_resource'
4 |
--------------------------------------------------------------------------------
/spec/dummy/Rakefile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Add your own tasks in files placed in lib/tasks ending in .rake,
4 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5 |
6 | require_relative "config/application"
7 |
8 | Rails.application.load_tasks
9 |
--------------------------------------------------------------------------------
/spec/dummy/app/admin/authors.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ActiveAdmin.register Author do
4 | controller do
5 | def permitted_params
6 | params.permit!
7 | end
8 | end
9 |
10 | form do |f|
11 | f.semantic_errors
12 |
13 | f.inputs do
14 | f.input :id, as: :hidden unless f.object.new_record? # Required
15 | f.input :name
16 | f.input :age
17 | f.input :email
18 | end
19 |
20 | f.actions
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/spec/dummy/app/admin/dashboard.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ActiveAdmin.register_page "Dashboard" do
4 | menu priority: 1, label: proc { I18n.t("active_admin.dashboard") }
5 |
6 | content title: proc { I18n.t("active_admin.dashboard") } do
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/spec/dummy/app/admin/posts.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ActiveAdmin.register Post do
4 | controller do
5 | def permitted_params
6 | params.permit!
7 | end
8 | end
9 |
10 | index do
11 | selectable_column
12 | id_column
13 | column :title
14 | column :author
15 | column :published
16 | column :created_at
17 | actions
18 | end
19 |
20 | show do
21 | attributes_table do
22 | row :author
23 | row :title
24 | row :description
25 | row :category
26 | row :dt
27 | row :position
28 | row :published
29 | row :tags
30 | row :created_at
31 | row :updated_at
32 | end
33 | # active_admin_comments # NOTE: comments not working
34 | end
35 |
36 | form do |f|
37 | f.semantic_errors
38 |
39 | f.inputs 'Post' do
40 | f.input :id, as: :hidden unless f.object.new_record? # Required
41 | f.input :author_id, as: :select, collection: Author.all
42 | f.input :title
43 | f.input :description
44 | f.input :category
45 | f.input :published
46 | f.input :dt
47 | f.input :position
48 | end
49 |
50 | f.actions
51 | end
52 | end
53 |
--------------------------------------------------------------------------------
/spec/dummy/app/admin/tags.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ActiveAdmin.register Tag do
4 | filter :name_cont
5 |
6 | controller do
7 | def permitted_params
8 | params.permit!
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/spec/dummy/app/assets/config/manifest.js:
--------------------------------------------------------------------------------
1 | //= link_tree ../images
2 | //= link_directory ../stylesheets .css
3 |
--------------------------------------------------------------------------------
/spec/dummy/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blocknotes/activeadmin_active_resource/328f7ed17126afec4e15aa26e8f5b7c3ffd4787d/spec/dummy/app/assets/images/.keep
--------------------------------------------------------------------------------
/spec/dummy/app/assets/javascripts/active_admin.js:
--------------------------------------------------------------------------------
1 | //= require active_admin/base
2 |
--------------------------------------------------------------------------------
/spec/dummy/app/assets/stylesheets/active_admin.scss:
--------------------------------------------------------------------------------
1 | @import 'active_admin/mixins';
2 | @import 'active_admin/base';
3 |
--------------------------------------------------------------------------------
/spec/dummy/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10 | * files in this directory. Styles in this file should be added after the last require_* statement.
11 | * It is generally better to create a new file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | */
16 |
--------------------------------------------------------------------------------
/spec/dummy/app/channels/application_cable/channel.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Channel < ActionCable::Channel::Base
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/spec/dummy/app/channels/application_cable/connection.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Connection < ActionCable::Connection::Base
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/spec/dummy/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | end
3 |
--------------------------------------------------------------------------------
/spec/dummy/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blocknotes/activeadmin_active_resource/328f7ed17126afec4e15aa26e8f5b7c3ffd4787d/spec/dummy/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/spec/dummy/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/spec/dummy/app/javascript/packs/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files
2 | // listed below.
3 | //
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6 | //
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 | // compiled file. JavaScript code in this file should be added after the last require_* statement.
9 | //
10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require rails-ujs
14 | //= require activestorage
15 | //= require_tree .
16 |
--------------------------------------------------------------------------------
/spec/dummy/app/jobs/application_job.rb:
--------------------------------------------------------------------------------
1 | class ApplicationJob < ActiveJob::Base
2 | # Automatically retry jobs that encountered a deadlock
3 | # retry_on ActiveRecord::Deadlocked
4 |
5 | # Most jobs are safe to ignore if the underlying records are no longer available
6 | # discard_on ActiveJob::DeserializationError
7 | end
8 |
--------------------------------------------------------------------------------
/spec/dummy/app/mailers/application_mailer.rb:
--------------------------------------------------------------------------------
1 | class ApplicationMailer < ActionMailer::Base
2 | default from: 'from@example.com'
3 | layout 'mailer'
4 | end
5 |
--------------------------------------------------------------------------------
/spec/dummy/app/models/application_record.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationRecord < ActiveResource::Base
4 | self.site = 'http://localhost:4000'
5 | end
6 |
--------------------------------------------------------------------------------
/spec/dummy/app/models/author.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Author < ApplicationRecord
4 | self.schema = {
5 | id: :integer,
6 | name: :string,
7 | age: :integer,
8 | email: :string,
9 | created_at: :datetime,
10 | updated_at: :datetime
11 | }
12 |
13 | has_many :posts
14 |
15 | has_one :profile
16 |
17 | def to_s
18 | "#{name} (#{age})"
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/spec/dummy/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blocknotes/activeadmin_active_resource/328f7ed17126afec4e15aa26e8f5b7c3ffd4787d/spec/dummy/app/models/concerns/.keep
--------------------------------------------------------------------------------
/spec/dummy/app/models/post.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Post < ApplicationRecord
4 | self.schema = {
5 | id: :integer,
6 | title: :string,
7 | description: :text,
8 | author_id: :integer,
9 | category: :string,
10 | dt: :datetime,
11 | position: :float,
12 | published: :boolean,
13 | created_at: :datetime,
14 | updated_at: :datetime
15 | }
16 |
17 | belongs_to :author
18 |
19 | has_many :tags
20 | end
21 |
--------------------------------------------------------------------------------
/spec/dummy/app/models/post_tag.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class PostTag < ApplicationRecord
4 | belongs_to :post, inverse_of: :post_tags
5 | belongs_to :tag, inverse_of: :post_tags
6 |
7 | validates :post, presence: true
8 | validates :tag, presence: true
9 | end
10 |
--------------------------------------------------------------------------------
/spec/dummy/app/models/profile.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Profile < ApplicationRecord
4 | belongs_to :author, inverse_of: :profile, touch: true
5 |
6 | def to_s
7 | description
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/spec/dummy/app/models/tag.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Tag < ApplicationRecord
4 | self.schema = {
5 | id: :integer,
6 | name: :string
7 | }
8 |
9 | has_many :posts
10 | end
11 |
--------------------------------------------------------------------------------
/spec/dummy/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Dummy
5 |
6 | <%= csrf_meta_tags %>
7 | <%= csp_meta_tag %>
8 |
9 | <%= stylesheet_link_tag 'application', media: 'all' %>
10 |
11 |
12 |
13 | <%= yield %>
14 |
15 |
16 |
--------------------------------------------------------------------------------
/spec/dummy/app/views/layouts/mailer.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/spec/dummy/app/views/layouts/mailer.text.erb:
--------------------------------------------------------------------------------
1 | <%= yield %>
2 |
--------------------------------------------------------------------------------
/spec/dummy/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | APP_PATH = File.expand_path('../config/application', __dir__)
5 | require_relative "../config/boot"
6 | require "rails/commands"
7 |
--------------------------------------------------------------------------------
/spec/dummy/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | require_relative "../config/boot"
5 | require "rake"
6 | Rake.application.run
7 |
--------------------------------------------------------------------------------
/spec/dummy/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | require "fileutils"
5 |
6 | # path to your application root.
7 | APP_ROOT = File.expand_path('..', __dir__)
8 |
9 | def system!(*args)
10 | system(*args) || abort("\n== Command #{args} failed ==")
11 | end
12 |
13 | FileUtils.chdir APP_ROOT do
14 | # This script is a way to set up or update your development environment automatically.
15 | # This script is idempotent, so that you can run it at any time and get an expectable outcome.
16 | # Add necessary setup steps to this file.
17 |
18 | puts '== Installing dependencies =='
19 | system! 'gem install bundler --conservative'
20 | system('bundle check') || system!('bundle install')
21 |
22 | # puts "\n== Copying sample files =="
23 | # unless File.exist?('config/database.yml')
24 | # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
25 | # end
26 |
27 | puts "\n== Preparing database =="
28 | system! 'bin/rails db:prepare'
29 |
30 | puts "\n== Removing old logs and tempfiles =="
31 | system! 'bin/rails log:clear tmp:clear'
32 |
33 | puts "\n== Restarting application server =="
34 | system! 'bin/rails restart'
35 | end
36 |
--------------------------------------------------------------------------------
/spec/dummy/config.ru:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # This file is used by Rack-based servers to start the application.
4 |
5 | require_relative "config/environment"
6 |
7 | run Rails.application
8 | Rails.application.load_server
9 |
--------------------------------------------------------------------------------
/spec/dummy/config/application.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "boot"
4 |
5 | require "rails"
6 | # Pick the frameworks you want:
7 | require "active_model/railtie"
8 | require "active_job/railtie"
9 | require "active_record/railtie"
10 | require "active_storage/engine"
11 | require "action_controller/railtie"
12 | # require "action_mailer/railtie"
13 | # require "action_mailbox/engine"
14 | # require "action_text/engine"
15 | require "action_view/railtie"
16 | # require "action_cable/engine"
17 | # require "sprockets/railtie"
18 | # require "rails/test_unit/railtie"
19 |
20 | # Require the gems listed in Gemfile, including any gems
21 | # you've limited to :test, :development, or :production.
22 | Bundler.require(*Rails.groups)
23 | require "activeadmin_active_resource"
24 |
25 | module Dummy
26 | class Application < Rails::Application
27 | config.load_defaults Rails::VERSION::STRING.to_f
28 |
29 | # Configuration for the application, engines, and railties goes here.
30 | #
31 | # These settings can be overridden in specific environments using the files
32 | # in config/environments, which are processed later.
33 | #
34 | # config.time_zone = "Central Time (US & Canada)"
35 | # config.eager_load_paths << Rails.root.join("extras")
36 | end
37 | end
38 |
--------------------------------------------------------------------------------
/spec/dummy/config/boot.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Set up gems listed in the Gemfile.
4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
5 |
6 | require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
7 | $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
8 |
--------------------------------------------------------------------------------
/spec/dummy/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: async
3 |
4 | test:
5 | adapter: test
6 |
7 | production:
8 | adapter: redis
9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10 | channel_prefix: dummy_production
11 |
--------------------------------------------------------------------------------
/spec/dummy/config/database.yml:
--------------------------------------------------------------------------------
1 | default: &default
2 | adapter: sqlite3
3 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
4 | timeout: 5000
5 |
6 | test:
7 | <<: *default
8 | database: db/test.sqlite3
9 |
--------------------------------------------------------------------------------
/spec/dummy/config/environment.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Load the Rails application.
4 | require_relative "application"
5 |
6 | # Initialize the Rails application.
7 | Rails.application.initialize!
8 |
--------------------------------------------------------------------------------
/spec/dummy/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "active_support/core_ext/integer/time"
4 |
5 | # The test environment is used exclusively to run your application's
6 | # test suite. You never need to work with it otherwise. Remember that
7 | # your test database is "scratch space" for the test suite and is wiped
8 | # and recreated between test runs. Don't rely on the data there!
9 |
10 | Rails.application.configure do
11 | # Settings specified here will take precedence over those in config/application.rb.
12 |
13 | config.cache_classes = true
14 |
15 | # Do not eager load code on boot. This avoids loading your whole application
16 | # just for the purpose of running a single test. If you are using a tool that
17 | # preloads Rails for running tests, you may have to set it to true.
18 | config.eager_load = false
19 |
20 | # Configure public file server for tests with Cache-Control for performance.
21 | config.public_file_server.enabled = true
22 | config.public_file_server.headers = {
23 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
24 | }
25 |
26 | # Show full error reports and disable caching.
27 | config.consider_all_requests_local = true
28 | config.action_controller.perform_caching = false
29 | config.cache_store = :null_store
30 |
31 | # Raise exceptions instead of rendering exception templates.
32 | config.action_dispatch.show_exceptions = false
33 |
34 | # Disable request forgery protection in test environment.
35 | config.action_controller.allow_forgery_protection = false
36 |
37 | # Store uploaded files on the local file system in a temporary directory.
38 | config.active_storage.service = :test
39 |
40 | # Print deprecation notices to the stderr.
41 | config.active_support.deprecation = :stderr
42 |
43 | # Raise exceptions for disallowed deprecations.
44 | config.active_support.disallowed_deprecation = :raise
45 |
46 | # Tell Active Support which deprecation messages to disallow.
47 | config.active_support.disallowed_deprecation_warnings = []
48 |
49 | # Raises error for missing translations.
50 | # config.i18n.raise_on_missing_translations = true
51 |
52 | # Annotate rendered view with file names.
53 | # config.action_view.annotate_rendered_view_with_filenames = true
54 | end
55 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # ActiveSupport::Reloader.to_prepare do
4 | # ApplicationController.renderer.defaults.merge!(
5 | # http_host: 'example.org',
6 | # https: false
7 | # )
8 | # end
9 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | # Rails.application.config.assets.version = '1.0'
5 |
6 | # Add additional assets to the asset load path.
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 |
9 | # Precompile additional assets.
10 | # application.js, application.css, and all non-JS/CSS in the app/assets
11 | # folder are already added.
12 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
13 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
6 | # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
7 |
8 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
9 | # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
10 | Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
11 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/content_security_policy.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Define an application-wide content security policy
4 | # For further information see the following documentation
5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6 |
7 | # Rails.application.config.content_security_policy do |policy|
8 | # policy.default_src :self, :https
9 | # policy.font_src :self, :https, :data
10 | # policy.img_src :self, :https, :data
11 | # policy.object_src :none
12 | # policy.script_src :self, :https
13 | # policy.style_src :self, :https
14 |
15 | # # Specify URI for violation reports
16 | # # policy.report_uri "/csp-violation-report-endpoint"
17 | # end
18 |
19 | # If you are using UJS then enable automatic nonce generation
20 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
21 |
22 | # Set the nonce only to specific directives
23 | # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
24 |
25 | # Report CSP violations to a specified URI
26 | # For further information see the following documentation:
27 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
28 | # Rails.application.config.content_security_policy_report_only = true
29 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Specify a serializer for the signed and encrypted cookie jars.
4 | # Valid options are :json, :marshal, and :hybrid.
5 | Rails.application.config.action_dispatch.cookies_serializer = :json
6 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Configure sensitive parameters which will be filtered from the log file.
6 | Rails.application.config.filter_parameters += [
7 | :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
8 | ]
9 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/permissions_policy.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Define an application-wide HTTP permissions policy. For further
4 | # information see https://developers.google.com/web/updates/2018/06/feature-policy
5 | #
6 | # Rails.application.config.permissions_policy do |f|
7 | # f.camera :none
8 | # f.gyroscope :none
9 | # f.microphone :none
10 | # f.usb :none
11 | # f.fullscreen :self
12 | # f.payment :self, "https://secure.example.com"
13 | # end
14 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters format: [:json]
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/spec/dummy/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # The following keys must be escaped otherwise they will not be retrieved by
20 | # the default I18n backend:
21 | #
22 | # true, false, on, off, yes, no
23 | #
24 | # Instead, surround them with single quotes.
25 | #
26 | # en:
27 | # 'true': 'foo'
28 | #
29 | # To learn more, please read the Rails Internationalization guide
30 | # available at https://guides.rubyonrails.org/i18n.html.
31 |
32 | en:
33 | hello: "Hello world"
34 |
--------------------------------------------------------------------------------
/spec/dummy/config/puma.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Puma can serve each request in a thread from an internal thread pool.
4 | # The `threads` method setting takes two numbers: a minimum and maximum.
5 | # Any libraries that use thread pools should be configured to match
6 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
7 | # and maximum; this matches the default thread size of Active Record.
8 | #
9 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
10 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
11 | threads min_threads_count, max_threads_count
12 |
13 | # Specifies the `worker_timeout` threshold that Puma will use to wait before
14 | # terminating a worker in development environments.
15 | #
16 | worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
17 |
18 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
19 | #
20 | port ENV.fetch("PORT") { 3000 }
21 |
22 | # Specifies the `environment` that Puma will run in.
23 | #
24 | environment ENV.fetch("RAILS_ENV") { "development" }
25 |
26 | # Specifies the `pidfile` that Puma will use.
27 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
28 |
29 | # Specifies the number of `workers` to boot in clustered mode.
30 | # Workers are forked web server processes. If using threads and workers together
31 | # the concurrency of the application would be max `threads` * `workers`.
32 | # Workers do not work on JRuby or Windows (both of which do not support
33 | # processes).
34 | #
35 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
36 |
37 | # Use the `preload_app!` method when specifying a `workers` number.
38 | # This directive tells Puma to first boot the application and load code
39 | # before forking the application. This takes advantage of Copy On Write
40 | # process behavior so workers use less memory.
41 | #
42 | # preload_app!
43 |
44 | # Allow puma to be restarted by `rails restart` command.
45 | plugin :tmp_restart
46 |
--------------------------------------------------------------------------------
/spec/dummy/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | ActiveAdmin.routes(self)
3 |
4 | root to: redirect('/admin')
5 | end
6 |
--------------------------------------------------------------------------------
/spec/dummy/config/storage.yml:
--------------------------------------------------------------------------------
1 | test:
2 | service: Disk
3 | root: <%= Rails.root.join("tmp/storage") %>
4 |
5 | local:
6 | service: Disk
7 | root: <%= Rails.root.join("storage") %>
8 |
--------------------------------------------------------------------------------
/spec/dummy/db/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blocknotes/activeadmin_active_resource/328f7ed17126afec4e15aa26e8f5b7c3ffd4787d/spec/dummy/db/.keep
--------------------------------------------------------------------------------
/spec/dummy/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blocknotes/activeadmin_active_resource/328f7ed17126afec4e15aa26e8f5b7c3ffd4787d/spec/dummy/lib/assets/.keep
--------------------------------------------------------------------------------
/spec/dummy/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/spec/dummy/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/spec/dummy/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/spec/dummy/public/apple-touch-icon-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blocknotes/activeadmin_active_resource/328f7ed17126afec4e15aa26e8f5b7c3ffd4787d/spec/dummy/public/apple-touch-icon-precomposed.png
--------------------------------------------------------------------------------
/spec/dummy/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blocknotes/activeadmin_active_resource/328f7ed17126afec4e15aa26e8f5b7c3ffd4787d/spec/dummy/public/apple-touch-icon.png
--------------------------------------------------------------------------------
/spec/dummy/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blocknotes/activeadmin_active_resource/328f7ed17126afec4e15aa26e8f5b7c3ffd4787d/spec/dummy/public/favicon.ico
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Authors/creates_an_author.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: post
5 | uri: http://localhost:4000/authors.json
6 | body:
7 | encoding: UTF-8
8 | string: '{"name":"Some name","age":"30","email":"some_email@example.com"}'
9 | headers:
10 | Content-Type:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | Accept:
15 | - "*/*"
16 | User-Agent:
17 | - Ruby
18 | response:
19 | status:
20 | code: 200
21 | message: OK
22 | headers:
23 | X-Frame-Options:
24 | - SAMEORIGIN
25 | X-Xss-Protection:
26 | - 1; mode=block
27 | X-Content-Type-Options:
28 | - nosniff
29 | X-Download-Options:
30 | - noopen
31 | X-Permitted-Cross-Domain-Policies:
32 | - none
33 | Referrer-Policy:
34 | - strict-origin-when-cross-origin
35 | Content-Type:
36 | - application/json; charset=utf-8
37 | Etag:
38 | - W/"c955e57777ec0d73639dca6748560d00"
39 | Cache-Control:
40 | - max-age=0, private, must-revalidate
41 | X-Request-Id:
42 | - fa2dec0d-b6b3-4521-b581-8dbd72886657
43 | X-Runtime:
44 | - '0.005388'
45 | Transfer-Encoding:
46 | - chunked
47 | body:
48 | encoding: UTF-8
49 | string: '{"success":true}'
50 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
51 | - request:
52 | method: get
53 | uri: http://localhost:4000/authors.json?limit=5&order=%22authors%22.id%20desc&page=1&per_page=5
54 | body:
55 | encoding: US-ASCII
56 | string: ''
57 | headers:
58 | Accept:
59 | - application/json
60 | Accept-Encoding:
61 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
62 | User-Agent:
63 | - Ruby
64 | response:
65 | status:
66 | code: 200
67 | message: OK
68 | headers:
69 | X-Frame-Options:
70 | - SAMEORIGIN
71 | X-Xss-Protection:
72 | - 1; mode=block
73 | X-Content-Type-Options:
74 | - nosniff
75 | X-Download-Options:
76 | - noopen
77 | X-Permitted-Cross-Domain-Policies:
78 | - none
79 | Referrer-Policy:
80 | - strict-origin-when-cross-origin
81 | Content-Type:
82 | - application/json; charset=utf-8
83 | Etag:
84 | - W/"d89d1238c4c66945cdf42839fa518547"
85 | Cache-Control:
86 | - max-age=0, private, must-revalidate
87 | X-Request-Id:
88 | - cb649122-bf8c-4852-948e-65a08eed2171
89 | X-Runtime:
90 | - '0.003400'
91 | Transfer-Encoding:
92 | - chunked
93 | body:
94 | encoding: UTF-8
95 | string: '[{"id":1,"name":"Mat","age":42,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-13T19:23:03.330Z"},{"id":5,"name":"John
96 | Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"},{"id":7,"name":"Last
97 | one","age":30,"email":"aaa@bbb.ccc","created_at":"2020-10-14T06:04:37.612Z","updated_at":"2020-10-14T06:04:37.612Z"},{"id":8,"name":"Some
98 | name","age":30,"email":"some_email@example.com","created_at":"2020-10-14T06:10:02.259Z","updated_at":"2020-10-14T06:10:02.259Z"}]'
99 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
100 | recorded_with: VCR 6.0.0
101 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Authors/fails_to_create_an_author.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: post
5 | uri: http://localhost:4000/authors.json
6 | body:
7 | encoding: UTF-8
8 | string: '{"name":"Boh","age":"24","email":"Some invalid e-mail address"}'
9 | headers:
10 | Content-Type:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | Accept:
15 | - "*/*"
16 | User-Agent:
17 | - Ruby
18 | response:
19 | status:
20 | code: 422
21 | message: Unprocessable Entity
22 | headers:
23 | X-Frame-Options:
24 | - SAMEORIGIN
25 | X-Xss-Protection:
26 | - 1; mode=block
27 | X-Content-Type-Options:
28 | - nosniff
29 | X-Download-Options:
30 | - noopen
31 | X-Permitted-Cross-Domain-Policies:
32 | - none
33 | Referrer-Policy:
34 | - strict-origin-when-cross-origin
35 | Content-Type:
36 | - application/json; charset=utf-8
37 | Cache-Control:
38 | - no-cache
39 | X-Request-Id:
40 | - 253782fa-57ae-47f6-96be-219e3b5faa93
41 | X-Runtime:
42 | - '0.032520'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '{"success":false,"errors":{"email":["Invalid email"]}}'
48 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
49 | recorded_with: VCR 6.0.0
50 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Authors/with_some_authors/destroys_an_author.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/authors.json?limit=5&order=%22authors%22.id%20desc&page=1&per_page=5
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"38d29fe3b675f3fdf14e5ed7d061003f"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - 9a9ec80e-b96a-48aa-952e-941ec9394c67
41 | X-Runtime:
42 | - '0.006545'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '[{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"},{"id":5,"name":"John
48 | Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"},{"id":7,"name":"Last
49 | one","age":30,"email":"aaa@bbb.ccc","created_at":"2020-10-14T06:04:37.612Z","updated_at":"2020-10-14T06:04:37.612Z"},{"id":8,"name":"Some
50 | name","age":30,"email":"some_email@example.com","created_at":"2020-10-14T06:10:02.259Z","updated_at":"2020-10-14T06:10:02.259Z"}]'
51 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
52 | - request:
53 | method: get
54 | uri: http://localhost:4000/authors/8.json
55 | body:
56 | encoding: US-ASCII
57 | string: ''
58 | headers:
59 | Accept:
60 | - application/json
61 | Accept-Encoding:
62 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
63 | User-Agent:
64 | - Ruby
65 | response:
66 | status:
67 | code: 200
68 | message: OK
69 | headers:
70 | X-Frame-Options:
71 | - SAMEORIGIN
72 | X-Xss-Protection:
73 | - 1; mode=block
74 | X-Content-Type-Options:
75 | - nosniff
76 | X-Download-Options:
77 | - noopen
78 | X-Permitted-Cross-Domain-Policies:
79 | - none
80 | Referrer-Policy:
81 | - strict-origin-when-cross-origin
82 | Content-Type:
83 | - application/json; charset=utf-8
84 | Etag:
85 | - W/"159a29dd23310c468f988992a7b1eab8"
86 | Cache-Control:
87 | - max-age=0, private, must-revalidate
88 | X-Request-Id:
89 | - c1cd4cc1-7837-48ab-a2cd-929428443375
90 | X-Runtime:
91 | - '0.002394'
92 | Transfer-Encoding:
93 | - chunked
94 | body:
95 | encoding: UTF-8
96 | string: '{"id":8,"name":"Some name","age":30,"email":"some_email@example.com","created_at":"2020-10-14T06:10:02.259Z","updated_at":"2020-10-14T06:10:02.259Z"}'
97 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
98 | - request:
99 | method: delete
100 | uri: http://localhost:4000/authors/8.json
101 | body:
102 | encoding: US-ASCII
103 | string: ''
104 | headers:
105 | Accept:
106 | - application/json
107 | Accept-Encoding:
108 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
109 | User-Agent:
110 | - Ruby
111 | response:
112 | status:
113 | code: 200
114 | message: OK
115 | headers:
116 | X-Frame-Options:
117 | - SAMEORIGIN
118 | X-Xss-Protection:
119 | - 1; mode=block
120 | X-Content-Type-Options:
121 | - nosniff
122 | X-Download-Options:
123 | - noopen
124 | X-Permitted-Cross-Domain-Policies:
125 | - none
126 | Referrer-Policy:
127 | - strict-origin-when-cross-origin
128 | Content-Type:
129 | - application/json; charset=utf-8
130 | Etag:
131 | - W/"c955e57777ec0d73639dca6748560d00"
132 | Cache-Control:
133 | - max-age=0, private, must-revalidate
134 | X-Request-Id:
135 | - 406252d1-36bf-4cb1-ae0f-8faaa4bbaa48
136 | X-Runtime:
137 | - '0.008906'
138 | Transfer-Encoding:
139 | - chunked
140 | body:
141 | encoding: UTF-8
142 | string: '{"success":true}'
143 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
144 | - request:
145 | method: get
146 | uri: http://localhost:4000/authors.json?limit=5&order=%22authors%22.id%20desc&page=1&per_page=5
147 | body:
148 | encoding: US-ASCII
149 | string: ''
150 | headers:
151 | Accept:
152 | - application/json
153 | Accept-Encoding:
154 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
155 | User-Agent:
156 | - Ruby
157 | response:
158 | status:
159 | code: 200
160 | message: OK
161 | headers:
162 | X-Frame-Options:
163 | - SAMEORIGIN
164 | X-Xss-Protection:
165 | - 1; mode=block
166 | X-Content-Type-Options:
167 | - nosniff
168 | X-Download-Options:
169 | - noopen
170 | X-Permitted-Cross-Domain-Policies:
171 | - none
172 | Referrer-Policy:
173 | - strict-origin-when-cross-origin
174 | Content-Type:
175 | - application/json; charset=utf-8
176 | Etag:
177 | - W/"7a2170a22701cefc09ae884af815347e"
178 | Cache-Control:
179 | - max-age=0, private, must-revalidate
180 | X-Request-Id:
181 | - ba04af31-7dad-4190-a204-a76c412f8aa6
182 | X-Runtime:
183 | - '0.002672'
184 | Transfer-Encoding:
185 | - chunked
186 | body:
187 | encoding: UTF-8
188 | string: '[{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"},{"id":5,"name":"John
189 | Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"},{"id":7,"name":"Last
190 | one","age":30,"email":"aaa@bbb.ccc","created_at":"2020-10-14T06:04:37.612Z","updated_at":"2020-10-14T06:04:37.612Z"}]'
191 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
192 | recorded_with: VCR 6.0.0
193 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Authors/with_some_authors/fails_to_update_an_author.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/authors/1.json
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"d7135947b02d9f1704b4779341c74195"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - 7e6291bf-2568-45a2-b4cc-ccc34344e455
41 | X-Runtime:
42 | - '0.002889'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '{"id":1,"name":"Mat","age":42,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-13T19:23:03.330Z"}'
48 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
49 | - request:
50 | method: get
51 | uri: http://localhost:4000/authors/1.json
52 | body:
53 | encoding: US-ASCII
54 | string: ''
55 | headers:
56 | Accept:
57 | - application/json
58 | Accept-Encoding:
59 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
60 | User-Agent:
61 | - Ruby
62 | response:
63 | status:
64 | code: 200
65 | message: OK
66 | headers:
67 | X-Frame-Options:
68 | - SAMEORIGIN
69 | X-Xss-Protection:
70 | - 1; mode=block
71 | X-Content-Type-Options:
72 | - nosniff
73 | X-Download-Options:
74 | - noopen
75 | X-Permitted-Cross-Domain-Policies:
76 | - none
77 | Referrer-Policy:
78 | - strict-origin-when-cross-origin
79 | Content-Type:
80 | - application/json; charset=utf-8
81 | Etag:
82 | - W/"d7135947b02d9f1704b4779341c74195"
83 | Cache-Control:
84 | - max-age=0, private, must-revalidate
85 | X-Request-Id:
86 | - f0b48b35-fe60-433e-87c6-b70b2eead4b2
87 | X-Runtime:
88 | - '0.002350'
89 | Transfer-Encoding:
90 | - chunked
91 | body:
92 | encoding: UTF-8
93 | string: '{"id":1,"name":"Mat","age":42,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-13T19:23:03.330Z"}'
94 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
95 | - request:
96 | method: get
97 | uri: http://localhost:4000/authors/1.json
98 | body:
99 | encoding: US-ASCII
100 | string: ''
101 | headers:
102 | Accept:
103 | - application/json
104 | Accept-Encoding:
105 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
106 | User-Agent:
107 | - Ruby
108 | response:
109 | status:
110 | code: 200
111 | message: OK
112 | headers:
113 | X-Frame-Options:
114 | - SAMEORIGIN
115 | X-Xss-Protection:
116 | - 1; mode=block
117 | X-Content-Type-Options:
118 | - nosniff
119 | X-Download-Options:
120 | - noopen
121 | X-Permitted-Cross-Domain-Policies:
122 | - none
123 | Referrer-Policy:
124 | - strict-origin-when-cross-origin
125 | Content-Type:
126 | - application/json; charset=utf-8
127 | Etag:
128 | - W/"d7135947b02d9f1704b4779341c74195"
129 | Cache-Control:
130 | - max-age=0, private, must-revalidate
131 | X-Request-Id:
132 | - 28bf85e8-fe98-4a19-a0c8-7402de5215d9
133 | X-Runtime:
134 | - '0.004909'
135 | Transfer-Encoding:
136 | - chunked
137 | body:
138 | encoding: UTF-8
139 | string: '{"id":1,"name":"Mat","age":42,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-13T19:23:03.330Z"}'
140 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
141 | - request:
142 | method: put
143 | uri: http://localhost:4000/authors/1.json
144 | body:
145 | encoding: UTF-8
146 | string: '{"id":"1","name":"","age":"42","email":"aaa@bbb.ccc"}'
147 | headers:
148 | Content-Type:
149 | - application/json
150 | Accept-Encoding:
151 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
152 | Accept:
153 | - "*/*"
154 | User-Agent:
155 | - Ruby
156 | response:
157 | status:
158 | code: 422
159 | message: Unprocessable Entity
160 | headers:
161 | X-Frame-Options:
162 | - SAMEORIGIN
163 | X-Xss-Protection:
164 | - 1; mode=block
165 | X-Content-Type-Options:
166 | - nosniff
167 | X-Download-Options:
168 | - noopen
169 | X-Permitted-Cross-Domain-Policies:
170 | - none
171 | Referrer-Policy:
172 | - strict-origin-when-cross-origin
173 | Content-Type:
174 | - application/json; charset=utf-8
175 | Cache-Control:
176 | - no-cache
177 | X-Request-Id:
178 | - 3361ce81-4ade-43c1-997e-0b71efef14d2
179 | X-Runtime:
180 | - '0.003416'
181 | Transfer-Encoding:
182 | - chunked
183 | body:
184 | encoding: UTF-8
185 | string: '{"success":false,"errors":{"name":["can''t be blank","is too short
186 | (minimum is 2 characters)"]}}'
187 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
188 | recorded_with: VCR 6.0.0
189 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Authors/with_some_authors/loads_an_author.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/authors/1.json
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"281311c4ac3a4c358c1afedd134e76be"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - a22f3f92-2160-405d-a8f2-e7afc1c29bdd
41 | X-Runtime:
42 | - '0.002320'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"}'
48 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
49 | recorded_with: VCR 6.0.0
50 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Authors/with_some_authors/loads_the_authors_list.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/authors.json?limit=5&order=%22authors%22.id%20desc&page=1&per_page=5
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"38d29fe3b675f3fdf14e5ed7d061003f"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - efa17da1-0df4-4ebd-8e4b-91f22f485d4a
41 | X-Runtime:
42 | - '0.003179'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '[{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"},{"id":5,"name":"John
48 | Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"},{"id":7,"name":"Last
49 | one","age":30,"email":"aaa@bbb.ccc","created_at":"2020-10-14T06:04:37.612Z","updated_at":"2020-10-14T06:04:37.612Z"},{"id":8,"name":"Some
50 | name","age":30,"email":"some_email@example.com","created_at":"2020-10-14T06:10:02.259Z","updated_at":"2020-10-14T06:10:02.259Z"}]'
51 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
52 | recorded_with: VCR 6.0.0
53 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Authors/with_some_authors/updates_an_author.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/authors/1.json
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"d7135947b02d9f1704b4779341c74195"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - 01041d76-28cd-49be-9819-f551c8bec477
41 | X-Runtime:
42 | - '0.003625'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '{"id":1,"name":"Mat","age":42,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-13T19:23:03.330Z"}'
48 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
49 | - request:
50 | method: get
51 | uri: http://localhost:4000/authors/1.json
52 | body:
53 | encoding: US-ASCII
54 | string: ''
55 | headers:
56 | Accept:
57 | - application/json
58 | Accept-Encoding:
59 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
60 | User-Agent:
61 | - Ruby
62 | response:
63 | status:
64 | code: 200
65 | message: OK
66 | headers:
67 | X-Frame-Options:
68 | - SAMEORIGIN
69 | X-Xss-Protection:
70 | - 1; mode=block
71 | X-Content-Type-Options:
72 | - nosniff
73 | X-Download-Options:
74 | - noopen
75 | X-Permitted-Cross-Domain-Policies:
76 | - none
77 | Referrer-Policy:
78 | - strict-origin-when-cross-origin
79 | Content-Type:
80 | - application/json; charset=utf-8
81 | Etag:
82 | - W/"d7135947b02d9f1704b4779341c74195"
83 | Cache-Control:
84 | - max-age=0, private, must-revalidate
85 | X-Request-Id:
86 | - 417eb9df-e471-4eeb-9251-9c6b4227df68
87 | X-Runtime:
88 | - '0.002388'
89 | Transfer-Encoding:
90 | - chunked
91 | body:
92 | encoding: UTF-8
93 | string: '{"id":1,"name":"Mat","age":42,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-13T19:23:03.330Z"}'
94 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
95 | - request:
96 | method: get
97 | uri: http://localhost:4000/authors/1.json
98 | body:
99 | encoding: US-ASCII
100 | string: ''
101 | headers:
102 | Accept:
103 | - application/json
104 | Accept-Encoding:
105 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
106 | User-Agent:
107 | - Ruby
108 | response:
109 | status:
110 | code: 200
111 | message: OK
112 | headers:
113 | X-Frame-Options:
114 | - SAMEORIGIN
115 | X-Xss-Protection:
116 | - 1; mode=block
117 | X-Content-Type-Options:
118 | - nosniff
119 | X-Download-Options:
120 | - noopen
121 | X-Permitted-Cross-Domain-Policies:
122 | - none
123 | Referrer-Policy:
124 | - strict-origin-when-cross-origin
125 | Content-Type:
126 | - application/json; charset=utf-8
127 | Etag:
128 | - W/"d7135947b02d9f1704b4779341c74195"
129 | Cache-Control:
130 | - max-age=0, private, must-revalidate
131 | X-Request-Id:
132 | - 7525f761-0c5d-4148-b92e-418a36c91a7c
133 | X-Runtime:
134 | - '0.002497'
135 | Transfer-Encoding:
136 | - chunked
137 | body:
138 | encoding: UTF-8
139 | string: '{"id":1,"name":"Mat","age":42,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-13T19:23:03.330Z"}'
140 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
141 | - request:
142 | method: put
143 | uri: http://localhost:4000/authors/1.json
144 | body:
145 | encoding: UTF-8
146 | string: '{"id":"1","name":"Mat","age":"30","email":"aaa@bbb.ccc"}'
147 | headers:
148 | Content-Type:
149 | - application/json
150 | Accept-Encoding:
151 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
152 | Accept:
153 | - "*/*"
154 | User-Agent:
155 | - Ruby
156 | response:
157 | status:
158 | code: 200
159 | message: OK
160 | headers:
161 | X-Frame-Options:
162 | - SAMEORIGIN
163 | X-Xss-Protection:
164 | - 1; mode=block
165 | X-Content-Type-Options:
166 | - nosniff
167 | X-Download-Options:
168 | - noopen
169 | X-Permitted-Cross-Domain-Policies:
170 | - none
171 | Referrer-Policy:
172 | - strict-origin-when-cross-origin
173 | Content-Type:
174 | - application/json; charset=utf-8
175 | Etag:
176 | - W/"c955e57777ec0d73639dca6748560d00"
177 | Cache-Control:
178 | - max-age=0, private, must-revalidate
179 | X-Request-Id:
180 | - 1cb92d76-ac71-404f-a6b9-20127353a69e
181 | X-Runtime:
182 | - '0.008154'
183 | Transfer-Encoding:
184 | - chunked
185 | body:
186 | encoding: UTF-8
187 | string: '{"success":true}'
188 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
189 | - request:
190 | method: get
191 | uri: http://localhost:4000/authors/1.json
192 | body:
193 | encoding: US-ASCII
194 | string: ''
195 | headers:
196 | Accept:
197 | - application/json
198 | Accept-Encoding:
199 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
200 | User-Agent:
201 | - Ruby
202 | response:
203 | status:
204 | code: 200
205 | message: OK
206 | headers:
207 | X-Frame-Options:
208 | - SAMEORIGIN
209 | X-Xss-Protection:
210 | - 1; mode=block
211 | X-Content-Type-Options:
212 | - nosniff
213 | X-Download-Options:
214 | - noopen
215 | X-Permitted-Cross-Domain-Policies:
216 | - none
217 | Referrer-Policy:
218 | - strict-origin-when-cross-origin
219 | Content-Type:
220 | - application/json; charset=utf-8
221 | Etag:
222 | - W/"281311c4ac3a4c358c1afedd134e76be"
223 | Cache-Control:
224 | - max-age=0, private, must-revalidate
225 | X-Request-Id:
226 | - a81d0fb2-3a25-43f3-840e-20e58d90e615
227 | X-Runtime:
228 | - '0.002372'
229 | Transfer-Encoding:
230 | - chunked
231 | body:
232 | encoding: UTF-8
233 | string: '{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"}'
234 | recorded_at: Wed, 14 Oct 2020 06:10:02 GMT
235 | recorded_with: VCR 6.0.0
236 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Posts/fails_to_create_a_post.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/authors.json
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"7a2170a22701cefc09ae884af815347e"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - c443f49a-33e6-4d40-b4ab-633cea055cfb
41 | X-Runtime:
42 | - '0.003567'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '[{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"},{"id":5,"name":"John
48 | Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"},{"id":7,"name":"Last
49 | one","age":30,"email":"aaa@bbb.ccc","created_at":"2020-10-14T06:04:37.612Z","updated_at":"2020-10-14T06:04:37.612Z"}]'
50 | recorded_at: Wed, 14 Oct 2020 06:12:21 GMT
51 | - request:
52 | method: post
53 | uri: http://localhost:4000/posts.json
54 | body:
55 | encoding: UTF-8
56 | string: '{"author_id":"","title":"","description":"","category":"","published":"0","dt(1i)":"","dt(2i)":"","dt(3i)":"","dt(4i)":"","dt(5i)":"","position":""}'
57 | headers:
58 | Content-Type:
59 | - application/json
60 | Accept-Encoding:
61 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
62 | Accept:
63 | - "*/*"
64 | User-Agent:
65 | - Ruby
66 | response:
67 | status:
68 | code: 422
69 | message: Unprocessable Entity
70 | headers:
71 | X-Frame-Options:
72 | - SAMEORIGIN
73 | X-Xss-Protection:
74 | - 1; mode=block
75 | X-Content-Type-Options:
76 | - nosniff
77 | X-Download-Options:
78 | - noopen
79 | X-Permitted-Cross-Domain-Policies:
80 | - none
81 | Referrer-Policy:
82 | - strict-origin-when-cross-origin
83 | Content-Type:
84 | - application/json; charset=utf-8
85 | Cache-Control:
86 | - no-cache
87 | X-Request-Id:
88 | - ce3eb5e0-a213-4d87-90ef-b79967b7d2c3
89 | X-Runtime:
90 | - '0.003228'
91 | Transfer-Encoding:
92 | - chunked
93 | body:
94 | encoding: UTF-8
95 | string: '{"success":false,"errors":{"author":["must exist"],"title":["can''t
96 | be blank","is too short (minimum is 2 characters)"]}}'
97 | recorded_at: Wed, 14 Oct 2020 06:12:21 GMT
98 | - request:
99 | method: get
100 | uri: http://localhost:4000/authors.json
101 | body:
102 | encoding: US-ASCII
103 | string: ''
104 | headers:
105 | Accept:
106 | - application/json
107 | Accept-Encoding:
108 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
109 | User-Agent:
110 | - Ruby
111 | response:
112 | status:
113 | code: 200
114 | message: OK
115 | headers:
116 | X-Frame-Options:
117 | - SAMEORIGIN
118 | X-Xss-Protection:
119 | - 1; mode=block
120 | X-Content-Type-Options:
121 | - nosniff
122 | X-Download-Options:
123 | - noopen
124 | X-Permitted-Cross-Domain-Policies:
125 | - none
126 | Referrer-Policy:
127 | - strict-origin-when-cross-origin
128 | Content-Type:
129 | - application/json; charset=utf-8
130 | Etag:
131 | - W/"7a2170a22701cefc09ae884af815347e"
132 | Cache-Control:
133 | - max-age=0, private, must-revalidate
134 | X-Request-Id:
135 | - 9cedf2ec-530d-4337-93c6-4e60c83f421a
136 | X-Runtime:
137 | - '0.002736'
138 | Transfer-Encoding:
139 | - chunked
140 | body:
141 | encoding: UTF-8
142 | string: '[{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"},{"id":5,"name":"John
143 | Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"},{"id":7,"name":"Last
144 | one","age":30,"email":"aaa@bbb.ccc","created_at":"2020-10-14T06:04:37.612Z","updated_at":"2020-10-14T06:04:37.612Z"}]'
145 | recorded_at: Wed, 14 Oct 2020 06:12:21 GMT
146 | recorded_with: VCR 6.0.0
147 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Posts/with_some_authors/creates_a_post.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/authors.json
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"7a2170a22701cefc09ae884af815347e"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - 356ce501-82df-40bf-8276-8739a164833c
41 | X-Runtime:
42 | - '0.003008'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '[{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"},{"id":5,"name":"John
48 | Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"},{"id":7,"name":"Last
49 | one","age":30,"email":"aaa@bbb.ccc","created_at":"2020-10-14T06:04:37.612Z","updated_at":"2020-10-14T06:04:37.612Z"}]'
50 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
51 | - request:
52 | method: post
53 | uri: http://localhost:4000/posts.json
54 | body:
55 | encoding: UTF-8
56 | string: '{"author_id":"1","title":"Some title","description":"","category":"","published":"0","dt(1i)":"","dt(2i)":"","dt(3i)":"","dt(4i)":"","dt(5i)":"","position":""}'
57 | headers:
58 | Content-Type:
59 | - application/json
60 | Accept-Encoding:
61 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
62 | Accept:
63 | - "*/*"
64 | User-Agent:
65 | - Ruby
66 | response:
67 | status:
68 | code: 200
69 | message: OK
70 | headers:
71 | X-Frame-Options:
72 | - SAMEORIGIN
73 | X-Xss-Protection:
74 | - 1; mode=block
75 | X-Content-Type-Options:
76 | - nosniff
77 | X-Download-Options:
78 | - noopen
79 | X-Permitted-Cross-Domain-Policies:
80 | - none
81 | Referrer-Policy:
82 | - strict-origin-when-cross-origin
83 | Content-Type:
84 | - application/json; charset=utf-8
85 | Etag:
86 | - W/"c955e57777ec0d73639dca6748560d00"
87 | Cache-Control:
88 | - max-age=0, private, must-revalidate
89 | X-Request-Id:
90 | - 5447144f-98d8-43dd-948e-3ea5c1916fb3
91 | X-Runtime:
92 | - '0.009794'
93 | Transfer-Encoding:
94 | - chunked
95 | body:
96 | encoding: UTF-8
97 | string: '{"success":true}'
98 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
99 | - request:
100 | method: get
101 | uri: http://localhost:4000/posts.json?limit=5&order=%22posts%22.id%20desc&page=1&per_page=5
102 | body:
103 | encoding: US-ASCII
104 | string: ''
105 | headers:
106 | Accept:
107 | - application/json
108 | Accept-Encoding:
109 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
110 | User-Agent:
111 | - Ruby
112 | response:
113 | status:
114 | code: 200
115 | message: OK
116 | headers:
117 | X-Frame-Options:
118 | - SAMEORIGIN
119 | X-Xss-Protection:
120 | - 1; mode=block
121 | X-Content-Type-Options:
122 | - nosniff
123 | X-Download-Options:
124 | - noopen
125 | X-Permitted-Cross-Domain-Policies:
126 | - none
127 | Referrer-Policy:
128 | - strict-origin-when-cross-origin
129 | Content-Type:
130 | - application/json; charset=utf-8
131 | Etag:
132 | - W/"1e1d80c26f99424e5e734b2090bb3444"
133 | Cache-Control:
134 | - max-age=0, private, must-revalidate
135 | X-Request-Id:
136 | - 2a10a317-4635-4ffe-a479-186ff6968c1a
137 | X-Runtime:
138 | - '0.003937'
139 | Transfer-Encoding:
140 | - chunked
141 | body:
142 | encoding: UTF-8
143 | string: '[{"id":1,"title":"possst","description":"Some desc","author_id":5,"category":"","dt":null,"position":null,"published":false,"created_at":"2020-08-28T13:25:53.057Z","updated_at":"2020-10-14T06:12:22.163Z"},{"id":6,"title":"Some
144 | title","description":"","author_id":1,"category":"","dt":null,"position":null,"published":false,"created_at":"2020-10-14T06:12:22.480Z","updated_at":"2020-10-14T06:12:22.480Z"}]'
145 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
146 | - request:
147 | method: get
148 | uri: http://localhost:4000/authors/5.json
149 | body:
150 | encoding: US-ASCII
151 | string: ''
152 | headers:
153 | Accept:
154 | - application/json
155 | Accept-Encoding:
156 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
157 | User-Agent:
158 | - Ruby
159 | response:
160 | status:
161 | code: 200
162 | message: OK
163 | headers:
164 | X-Frame-Options:
165 | - SAMEORIGIN
166 | X-Xss-Protection:
167 | - 1; mode=block
168 | X-Content-Type-Options:
169 | - nosniff
170 | X-Download-Options:
171 | - noopen
172 | X-Permitted-Cross-Domain-Policies:
173 | - none
174 | Referrer-Policy:
175 | - strict-origin-when-cross-origin
176 | Content-Type:
177 | - application/json; charset=utf-8
178 | Etag:
179 | - W/"f2974d23178429e8a0ae8a00d6b46fbf"
180 | Cache-Control:
181 | - max-age=0, private, must-revalidate
182 | X-Request-Id:
183 | - f094fdb0-813c-4a43-95a6-7a4828bb3eac
184 | X-Runtime:
185 | - '0.014654'
186 | Transfer-Encoding:
187 | - chunked
188 | body:
189 | encoding: UTF-8
190 | string: '{"id":5,"name":"John Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"}'
191 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
192 | - request:
193 | method: get
194 | uri: http://localhost:4000/authors/1.json
195 | body:
196 | encoding: US-ASCII
197 | string: ''
198 | headers:
199 | Accept:
200 | - application/json
201 | Accept-Encoding:
202 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
203 | User-Agent:
204 | - Ruby
205 | response:
206 | status:
207 | code: 200
208 | message: OK
209 | headers:
210 | X-Frame-Options:
211 | - SAMEORIGIN
212 | X-Xss-Protection:
213 | - 1; mode=block
214 | X-Content-Type-Options:
215 | - nosniff
216 | X-Download-Options:
217 | - noopen
218 | X-Permitted-Cross-Domain-Policies:
219 | - none
220 | Referrer-Policy:
221 | - strict-origin-when-cross-origin
222 | Content-Type:
223 | - application/json; charset=utf-8
224 | Etag:
225 | - W/"281311c4ac3a4c358c1afedd134e76be"
226 | Cache-Control:
227 | - max-age=0, private, must-revalidate
228 | X-Request-Id:
229 | - 848bc1bc-ac42-400c-a93b-bde06d4aadab
230 | X-Runtime:
231 | - '0.004143'
232 | Transfer-Encoding:
233 | - chunked
234 | body:
235 | encoding: UTF-8
236 | string: '{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"}'
237 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
238 | recorded_with: VCR 6.0.0
239 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Posts/with_some_posts/destroys_a_post.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/posts.json?limit=5&order=%22posts%22.id%20desc&page=1&per_page=5
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"59182e622c7666f7abd80def905c790a"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - 50039b7d-b8cb-4cf5-9e02-b5d061d0526b
41 | X-Runtime:
42 | - '0.003120'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '[{"id":1,"title":"possst","description":"Some desc","author_id":5,"category":"","dt":null,"position":null,"published":false,"created_at":"2020-08-28T13:25:53.057Z","updated_at":"2020-10-14T06:12:22.163Z"},{"id":5,"title":"New
48 | post!","description":"...","author_id":1,"category":"","dt":null,"position":null,"published":true,"created_at":"2020-10-14T06:11:40.473Z","updated_at":"2020-10-14T06:11:40.473Z"}]'
49 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
50 | - request:
51 | method: get
52 | uri: http://localhost:4000/authors/5.json
53 | body:
54 | encoding: US-ASCII
55 | string: ''
56 | headers:
57 | Accept:
58 | - application/json
59 | Accept-Encoding:
60 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
61 | User-Agent:
62 | - Ruby
63 | response:
64 | status:
65 | code: 200
66 | message: OK
67 | headers:
68 | X-Frame-Options:
69 | - SAMEORIGIN
70 | X-Xss-Protection:
71 | - 1; mode=block
72 | X-Content-Type-Options:
73 | - nosniff
74 | X-Download-Options:
75 | - noopen
76 | X-Permitted-Cross-Domain-Policies:
77 | - none
78 | Referrer-Policy:
79 | - strict-origin-when-cross-origin
80 | Content-Type:
81 | - application/json; charset=utf-8
82 | Etag:
83 | - W/"f2974d23178429e8a0ae8a00d6b46fbf"
84 | Cache-Control:
85 | - max-age=0, private, must-revalidate
86 | X-Request-Id:
87 | - ff91d5c0-c9b1-41de-aaba-be6a1db60c98
88 | X-Runtime:
89 | - '0.003203'
90 | Transfer-Encoding:
91 | - chunked
92 | body:
93 | encoding: UTF-8
94 | string: '{"id":5,"name":"John Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"}'
95 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
96 | - request:
97 | method: get
98 | uri: http://localhost:4000/authors/1.json
99 | body:
100 | encoding: US-ASCII
101 | string: ''
102 | headers:
103 | Accept:
104 | - application/json
105 | Accept-Encoding:
106 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
107 | User-Agent:
108 | - Ruby
109 | response:
110 | status:
111 | code: 200
112 | message: OK
113 | headers:
114 | X-Frame-Options:
115 | - SAMEORIGIN
116 | X-Xss-Protection:
117 | - 1; mode=block
118 | X-Content-Type-Options:
119 | - nosniff
120 | X-Download-Options:
121 | - noopen
122 | X-Permitted-Cross-Domain-Policies:
123 | - none
124 | Referrer-Policy:
125 | - strict-origin-when-cross-origin
126 | Content-Type:
127 | - application/json; charset=utf-8
128 | Etag:
129 | - W/"281311c4ac3a4c358c1afedd134e76be"
130 | Cache-Control:
131 | - max-age=0, private, must-revalidate
132 | X-Request-Id:
133 | - c410f21d-6e08-4fc6-91ec-677b2e6fb346
134 | X-Runtime:
135 | - '0.002916'
136 | Transfer-Encoding:
137 | - chunked
138 | body:
139 | encoding: UTF-8
140 | string: '{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"}'
141 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
142 | - request:
143 | method: get
144 | uri: http://localhost:4000/posts/5.json
145 | body:
146 | encoding: US-ASCII
147 | string: ''
148 | headers:
149 | Accept:
150 | - application/json
151 | Accept-Encoding:
152 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
153 | User-Agent:
154 | - Ruby
155 | response:
156 | status:
157 | code: 200
158 | message: OK
159 | headers:
160 | X-Frame-Options:
161 | - SAMEORIGIN
162 | X-Xss-Protection:
163 | - 1; mode=block
164 | X-Content-Type-Options:
165 | - nosniff
166 | X-Download-Options:
167 | - noopen
168 | X-Permitted-Cross-Domain-Policies:
169 | - none
170 | Referrer-Policy:
171 | - strict-origin-when-cross-origin
172 | Content-Type:
173 | - application/json; charset=utf-8
174 | Etag:
175 | - W/"3a89b33f74307837d532aa029f58257d"
176 | Cache-Control:
177 | - max-age=0, private, must-revalidate
178 | X-Request-Id:
179 | - 3e69b6fd-02bb-4ed8-8593-b21f59b43d1a
180 | X-Runtime:
181 | - '0.002343'
182 | Transfer-Encoding:
183 | - chunked
184 | body:
185 | encoding: UTF-8
186 | string: '{"id":5,"title":"New post!","description":"...","author_id":1,"category":"","dt":null,"position":null,"published":true,"created_at":"2020-10-14T06:11:40.473Z","updated_at":"2020-10-14T06:11:40.473Z"}'
187 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
188 | - request:
189 | method: delete
190 | uri: http://localhost:4000/posts/5.json
191 | body:
192 | encoding: US-ASCII
193 | string: ''
194 | headers:
195 | Accept:
196 | - application/json
197 | Accept-Encoding:
198 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
199 | User-Agent:
200 | - Ruby
201 | response:
202 | status:
203 | code: 200
204 | message: OK
205 | headers:
206 | X-Frame-Options:
207 | - SAMEORIGIN
208 | X-Xss-Protection:
209 | - 1; mode=block
210 | X-Content-Type-Options:
211 | - nosniff
212 | X-Download-Options:
213 | - noopen
214 | X-Permitted-Cross-Domain-Policies:
215 | - none
216 | Referrer-Policy:
217 | - strict-origin-when-cross-origin
218 | Content-Type:
219 | - application/json; charset=utf-8
220 | Etag:
221 | - W/"c955e57777ec0d73639dca6748560d00"
222 | Cache-Control:
223 | - max-age=0, private, must-revalidate
224 | X-Request-Id:
225 | - e24d8faf-e0d3-4055-a397-5c86267bffe4
226 | X-Runtime:
227 | - '0.009129'
228 | Transfer-Encoding:
229 | - chunked
230 | body:
231 | encoding: UTF-8
232 | string: '{"success":true}'
233 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
234 | - request:
235 | method: get
236 | uri: http://localhost:4000/posts.json?limit=5&order=%22posts%22.id%20desc&page=1&per_page=5
237 | body:
238 | encoding: US-ASCII
239 | string: ''
240 | headers:
241 | Accept:
242 | - application/json
243 | Accept-Encoding:
244 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
245 | User-Agent:
246 | - Ruby
247 | response:
248 | status:
249 | code: 200
250 | message: OK
251 | headers:
252 | X-Frame-Options:
253 | - SAMEORIGIN
254 | X-Xss-Protection:
255 | - 1; mode=block
256 | X-Content-Type-Options:
257 | - nosniff
258 | X-Download-Options:
259 | - noopen
260 | X-Permitted-Cross-Domain-Policies:
261 | - none
262 | Referrer-Policy:
263 | - strict-origin-when-cross-origin
264 | Content-Type:
265 | - application/json; charset=utf-8
266 | Etag:
267 | - W/"b023a57ac996044fc40c59e9b027dab2"
268 | Cache-Control:
269 | - max-age=0, private, must-revalidate
270 | X-Request-Id:
271 | - 1520ed20-f0d2-44e9-a824-2a53eece7d60
272 | X-Runtime:
273 | - '0.002579'
274 | Transfer-Encoding:
275 | - chunked
276 | body:
277 | encoding: UTF-8
278 | string: '[{"id":1,"title":"possst","description":"Some desc","author_id":5,"category":"","dt":null,"position":null,"published":false,"created_at":"2020-08-28T13:25:53.057Z","updated_at":"2020-10-14T06:12:22.163Z"}]'
279 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
280 | - request:
281 | method: get
282 | uri: http://localhost:4000/authors/5.json
283 | body:
284 | encoding: US-ASCII
285 | string: ''
286 | headers:
287 | Accept:
288 | - application/json
289 | Accept-Encoding:
290 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
291 | User-Agent:
292 | - Ruby
293 | response:
294 | status:
295 | code: 200
296 | message: OK
297 | headers:
298 | X-Frame-Options:
299 | - SAMEORIGIN
300 | X-Xss-Protection:
301 | - 1; mode=block
302 | X-Content-Type-Options:
303 | - nosniff
304 | X-Download-Options:
305 | - noopen
306 | X-Permitted-Cross-Domain-Policies:
307 | - none
308 | Referrer-Policy:
309 | - strict-origin-when-cross-origin
310 | Content-Type:
311 | - application/json; charset=utf-8
312 | Etag:
313 | - W/"f2974d23178429e8a0ae8a00d6b46fbf"
314 | Cache-Control:
315 | - max-age=0, private, must-revalidate
316 | X-Request-Id:
317 | - 362180cc-b95f-463f-aa6b-ac2b7a1b3026
318 | X-Runtime:
319 | - '0.003132'
320 | Transfer-Encoding:
321 | - chunked
322 | body:
323 | encoding: UTF-8
324 | string: '{"id":5,"name":"John Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"}'
325 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
326 | recorded_with: VCR 6.0.0
327 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Posts/with_some_posts/fails_to_update_a_post.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/posts/1.json
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"5f757e3d7d17e6f0d31d178732496a2e"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - 3c0d2be9-c097-4198-966f-aa32c78bc41a
41 | X-Runtime:
42 | - '0.003541'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '{"id":1,"title":"possst","description":"Some desc...","author_id":5,"category":"","dt":null,"position":null,"published":false,"created_at":"2020-08-28T13:25:53.057Z","updated_at":"2020-10-13T17:42:49.618Z"}'
48 | recorded_at: Wed, 14 Oct 2020 06:12:21 GMT
49 | - request:
50 | method: get
51 | uri: http://localhost:4000/posts/1.json
52 | body:
53 | encoding: US-ASCII
54 | string: ''
55 | headers:
56 | Accept:
57 | - application/json
58 | Accept-Encoding:
59 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
60 | User-Agent:
61 | - Ruby
62 | response:
63 | status:
64 | code: 200
65 | message: OK
66 | headers:
67 | X-Frame-Options:
68 | - SAMEORIGIN
69 | X-Xss-Protection:
70 | - 1; mode=block
71 | X-Content-Type-Options:
72 | - nosniff
73 | X-Download-Options:
74 | - noopen
75 | X-Permitted-Cross-Domain-Policies:
76 | - none
77 | Referrer-Policy:
78 | - strict-origin-when-cross-origin
79 | Content-Type:
80 | - application/json; charset=utf-8
81 | Etag:
82 | - W/"5f757e3d7d17e6f0d31d178732496a2e"
83 | Cache-Control:
84 | - max-age=0, private, must-revalidate
85 | X-Request-Id:
86 | - b770b099-d9da-476e-9cea-e8b18dd87f86
87 | X-Runtime:
88 | - '0.004325'
89 | Transfer-Encoding:
90 | - chunked
91 | body:
92 | encoding: UTF-8
93 | string: '{"id":1,"title":"possst","description":"Some desc...","author_id":5,"category":"","dt":null,"position":null,"published":false,"created_at":"2020-08-28T13:25:53.057Z","updated_at":"2020-10-13T17:42:49.618Z"}'
94 | recorded_at: Wed, 14 Oct 2020 06:12:21 GMT
95 | - request:
96 | method: get
97 | uri: http://localhost:4000/authors.json
98 | body:
99 | encoding: US-ASCII
100 | string: ''
101 | headers:
102 | Accept:
103 | - application/json
104 | Accept-Encoding:
105 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
106 | User-Agent:
107 | - Ruby
108 | response:
109 | status:
110 | code: 200
111 | message: OK
112 | headers:
113 | X-Frame-Options:
114 | - SAMEORIGIN
115 | X-Xss-Protection:
116 | - 1; mode=block
117 | X-Content-Type-Options:
118 | - nosniff
119 | X-Download-Options:
120 | - noopen
121 | X-Permitted-Cross-Domain-Policies:
122 | - none
123 | Referrer-Policy:
124 | - strict-origin-when-cross-origin
125 | Content-Type:
126 | - application/json; charset=utf-8
127 | Etag:
128 | - W/"7a2170a22701cefc09ae884af815347e"
129 | Cache-Control:
130 | - max-age=0, private, must-revalidate
131 | X-Request-Id:
132 | - f23b2f64-bc0f-4601-ad19-d107f6edb3e7
133 | X-Runtime:
134 | - '0.003944'
135 | Transfer-Encoding:
136 | - chunked
137 | body:
138 | encoding: UTF-8
139 | string: '[{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"},{"id":5,"name":"John
140 | Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"},{"id":7,"name":"Last
141 | one","age":30,"email":"aaa@bbb.ccc","created_at":"2020-10-14T06:04:37.612Z","updated_at":"2020-10-14T06:04:37.612Z"}]'
142 | recorded_at: Wed, 14 Oct 2020 06:12:21 GMT
143 | - request:
144 | method: get
145 | uri: http://localhost:4000/posts/1.json
146 | body:
147 | encoding: US-ASCII
148 | string: ''
149 | headers:
150 | Accept:
151 | - application/json
152 | Accept-Encoding:
153 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
154 | User-Agent:
155 | - Ruby
156 | response:
157 | status:
158 | code: 200
159 | message: OK
160 | headers:
161 | X-Frame-Options:
162 | - SAMEORIGIN
163 | X-Xss-Protection:
164 | - 1; mode=block
165 | X-Content-Type-Options:
166 | - nosniff
167 | X-Download-Options:
168 | - noopen
169 | X-Permitted-Cross-Domain-Policies:
170 | - none
171 | Referrer-Policy:
172 | - strict-origin-when-cross-origin
173 | Content-Type:
174 | - application/json; charset=utf-8
175 | Etag:
176 | - W/"5f757e3d7d17e6f0d31d178732496a2e"
177 | Cache-Control:
178 | - max-age=0, private, must-revalidate
179 | X-Request-Id:
180 | - ffe969d7-b13e-4341-8448-5758f1ce7119
181 | X-Runtime:
182 | - '0.002387'
183 | Transfer-Encoding:
184 | - chunked
185 | body:
186 | encoding: UTF-8
187 | string: '{"id":1,"title":"possst","description":"Some desc...","author_id":5,"category":"","dt":null,"position":null,"published":false,"created_at":"2020-08-28T13:25:53.057Z","updated_at":"2020-10-13T17:42:49.618Z"}'
188 | recorded_at: Wed, 14 Oct 2020 06:12:21 GMT
189 | - request:
190 | method: put
191 | uri: http://localhost:4000/posts/1.json
192 | body:
193 | encoding: UTF-8
194 | string: '{"id":"1","author_id":"5","title":"","description":"Some desc...","category":"","published":"0","dt(1i)":"","dt(2i)":"","dt(3i)":"","dt(4i)":"","dt(5i)":"","position":""}'
195 | headers:
196 | Content-Type:
197 | - application/json
198 | Accept-Encoding:
199 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
200 | Accept:
201 | - "*/*"
202 | User-Agent:
203 | - Ruby
204 | response:
205 | status:
206 | code: 422
207 | message: Unprocessable Entity
208 | headers:
209 | X-Frame-Options:
210 | - SAMEORIGIN
211 | X-Xss-Protection:
212 | - 1; mode=block
213 | X-Content-Type-Options:
214 | - nosniff
215 | X-Download-Options:
216 | - noopen
217 | X-Permitted-Cross-Domain-Policies:
218 | - none
219 | Referrer-Policy:
220 | - strict-origin-when-cross-origin
221 | Content-Type:
222 | - application/json; charset=utf-8
223 | Cache-Control:
224 | - no-cache
225 | X-Request-Id:
226 | - 5b97798e-2c6a-457a-a326-2b2816a7d98e
227 | X-Runtime:
228 | - '0.005724'
229 | Transfer-Encoding:
230 | - chunked
231 | body:
232 | encoding: UTF-8
233 | string: '{"success":false,"errors":{"title":["can''t be blank","is too short
234 | (minimum is 2 characters)"]}}'
235 | recorded_at: Wed, 14 Oct 2020 06:12:21 GMT
236 | - request:
237 | method: get
238 | uri: http://localhost:4000/authors.json
239 | body:
240 | encoding: US-ASCII
241 | string: ''
242 | headers:
243 | Accept:
244 | - application/json
245 | Accept-Encoding:
246 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
247 | User-Agent:
248 | - Ruby
249 | response:
250 | status:
251 | code: 200
252 | message: OK
253 | headers:
254 | X-Frame-Options:
255 | - SAMEORIGIN
256 | X-Xss-Protection:
257 | - 1; mode=block
258 | X-Content-Type-Options:
259 | - nosniff
260 | X-Download-Options:
261 | - noopen
262 | X-Permitted-Cross-Domain-Policies:
263 | - none
264 | Referrer-Policy:
265 | - strict-origin-when-cross-origin
266 | Content-Type:
267 | - application/json; charset=utf-8
268 | Etag:
269 | - W/"7a2170a22701cefc09ae884af815347e"
270 | Cache-Control:
271 | - max-age=0, private, must-revalidate
272 | X-Request-Id:
273 | - 2dbccd2a-ee94-43fc-89f4-7c8c82511390
274 | X-Runtime:
275 | - '0.002511'
276 | Transfer-Encoding:
277 | - chunked
278 | body:
279 | encoding: UTF-8
280 | string: '[{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"},{"id":5,"name":"John
281 | Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"},{"id":7,"name":"Last
282 | one","age":30,"email":"aaa@bbb.ccc","created_at":"2020-10-14T06:04:37.612Z","updated_at":"2020-10-14T06:04:37.612Z"}]'
283 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
284 | recorded_with: VCR 6.0.0
285 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Posts/with_some_posts/loads_a_post.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/posts/1.json
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"5f757e3d7d17e6f0d31d178732496a2e"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - acdcb086-43f2-401f-a668-1b5e72e18628
41 | X-Runtime:
42 | - '0.002515'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '{"id":1,"title":"possst","description":"Some desc...","author_id":5,"category":"","dt":null,"position":null,"published":false,"created_at":"2020-08-28T13:25:53.057Z","updated_at":"2020-10-13T17:42:49.618Z"}'
48 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
49 | - request:
50 | method: get
51 | uri: http://localhost:4000/authors/5.json
52 | body:
53 | encoding: US-ASCII
54 | string: ''
55 | headers:
56 | Accept:
57 | - application/json
58 | Accept-Encoding:
59 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
60 | User-Agent:
61 | - Ruby
62 | response:
63 | status:
64 | code: 200
65 | message: OK
66 | headers:
67 | X-Frame-Options:
68 | - SAMEORIGIN
69 | X-Xss-Protection:
70 | - 1; mode=block
71 | X-Content-Type-Options:
72 | - nosniff
73 | X-Download-Options:
74 | - noopen
75 | X-Permitted-Cross-Domain-Policies:
76 | - none
77 | Referrer-Policy:
78 | - strict-origin-when-cross-origin
79 | Content-Type:
80 | - application/json; charset=utf-8
81 | Etag:
82 | - W/"f2974d23178429e8a0ae8a00d6b46fbf"
83 | Cache-Control:
84 | - max-age=0, private, must-revalidate
85 | X-Request-Id:
86 | - d07d3f27-3fa1-4c14-af1f-76c6d24c11fd
87 | X-Runtime:
88 | - '0.003074'
89 | Transfer-Encoding:
90 | - chunked
91 | body:
92 | encoding: UTF-8
93 | string: '{"id":5,"name":"John Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"}'
94 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
95 | - request:
96 | method: get
97 | uri: http://localhost:4000/tags.json?post_id=1
98 | body:
99 | encoding: US-ASCII
100 | string: ''
101 | headers:
102 | Accept:
103 | - application/json
104 | Accept-Encoding:
105 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
106 | User-Agent:
107 | - Ruby
108 | response:
109 | status:
110 | code: 200
111 | message: OK
112 | headers:
113 | X-Frame-Options:
114 | - SAMEORIGIN
115 | X-Xss-Protection:
116 | - 1; mode=block
117 | X-Content-Type-Options:
118 | - nosniff
119 | X-Download-Options:
120 | - noopen
121 | X-Permitted-Cross-Domain-Policies:
122 | - none
123 | Referrer-Policy:
124 | - strict-origin-when-cross-origin
125 | Content-Type:
126 | - application/json; charset=utf-8
127 | Pagination-Limit:
128 | - '15'
129 | Pagination-Offset:
130 | - '0'
131 | Pagination-Totalcount:
132 | - '12'
133 | Etag:
134 | - W/"576ccdcd7fcd03824d5c14bdde068db9"
135 | Cache-Control:
136 | - max-age=0, private, must-revalidate
137 | X-Request-Id:
138 | - ca8d0b6e-716b-4858-8d66-a400b902553b
139 | X-Runtime:
140 | - '0.006034'
141 | Transfer-Encoding:
142 | - chunked
143 | body:
144 | encoding: UTF-8
145 | string: '[{"id":1,"name":"Some tag","created_at":"2020-10-11T12:12:55.979Z","updated_at":"2020-10-11T12:12:55.979Z"},{"id":2,"name":"Attag!","created_at":"2020-10-11T12:13:03.091Z","updated_at":"2020-10-11T12:13:03.091Z"},{"id":4,"name":"Tag
146 | 10","created_at":"2020-10-13T19:34:40.950Z","updated_at":"2020-10-13T19:34:40.950Z"},{"id":5,"name":"Tag
147 | 11","created_at":"2020-10-13T19:34:40.959Z","updated_at":"2020-10-13T19:34:40.959Z"},{"id":6,"name":"Tag
148 | 12","created_at":"2020-10-13T19:34:40.967Z","updated_at":"2020-10-13T19:34:40.967Z"},{"id":7,"name":"Tag
149 | 13","created_at":"2020-10-13T19:34:40.976Z","updated_at":"2020-10-13T19:34:40.976Z"},{"id":8,"name":"Tag
150 | 14","created_at":"2020-10-13T19:34:40.983Z","updated_at":"2020-10-13T19:34:40.983Z"},{"id":9,"name":"Tag
151 | 15","created_at":"2020-10-13T19:34:40.993Z","updated_at":"2020-10-13T19:34:40.993Z"},{"id":10,"name":"Tag
152 | 16","created_at":"2020-10-13T19:34:41.001Z","updated_at":"2020-10-13T19:34:41.001Z"},{"id":11,"name":"Tag
153 | 17","created_at":"2020-10-13T19:34:41.009Z","updated_at":"2020-10-13T19:34:41.009Z"},{"id":12,"name":"Tag
154 | 18","created_at":"2020-10-13T19:34:41.016Z","updated_at":"2020-10-13T19:34:41.016Z"},{"id":13,"name":"Tag
155 | 19","created_at":"2020-10-13T19:34:41.024Z","updated_at":"2020-10-13T19:34:41.024Z"}]'
156 | recorded_at: Wed, 14 Oct 2020 06:12:22 GMT
157 | recorded_with: VCR 6.0.0
158 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Posts/with_some_posts/loads_the_posts_list.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/posts.json?limit=5&order=%22posts%22.id%20desc&page=1&per_page=5
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"55552bb6d4c8ddfac5402c9749bd8338"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - 948838e1-0c39-4a38-aca9-9a9d9384401e
41 | X-Runtime:
42 | - '0.003379'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '[{"id":1,"title":"possst","description":"Some desc","author_id":5,"category":"","dt":null,"position":null,"published":false,"created_at":"2020-08-28T13:25:53.057Z","updated_at":"2020-10-14T06:12:22.163Z"},{"id":6,"title":"Some
48 | title","description":"","author_id":1,"category":"","dt":null,"position":null,"published":false,"created_at":"2020-10-14T06:12:22.480Z","updated_at":"2020-10-14T06:12:22.480Z"},{"id":7,"title":"New
49 | post!","description":"...","author_id":5,"category":"","dt":null,"position":null,"published":true,"created_at":"2020-10-14T06:15:50.020Z","updated_at":"2020-10-14T06:15:50.020Z"}]'
50 | recorded_at: Wed, 14 Oct 2020 06:15:58 GMT
51 | - request:
52 | method: get
53 | uri: http://localhost:4000/authors/5.json
54 | body:
55 | encoding: US-ASCII
56 | string: ''
57 | headers:
58 | Accept:
59 | - application/json
60 | Accept-Encoding:
61 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
62 | User-Agent:
63 | - Ruby
64 | response:
65 | status:
66 | code: 200
67 | message: OK
68 | headers:
69 | X-Frame-Options:
70 | - SAMEORIGIN
71 | X-Xss-Protection:
72 | - 1; mode=block
73 | X-Content-Type-Options:
74 | - nosniff
75 | X-Download-Options:
76 | - noopen
77 | X-Permitted-Cross-Domain-Policies:
78 | - none
79 | Referrer-Policy:
80 | - strict-origin-when-cross-origin
81 | Content-Type:
82 | - application/json; charset=utf-8
83 | Etag:
84 | - W/"f2974d23178429e8a0ae8a00d6b46fbf"
85 | Cache-Control:
86 | - max-age=0, private, must-revalidate
87 | X-Request-Id:
88 | - 8f796a67-98a9-4266-9f23-36237335358f
89 | X-Runtime:
90 | - '0.007082'
91 | Transfer-Encoding:
92 | - chunked
93 | body:
94 | encoding: UTF-8
95 | string: '{"id":5,"name":"John Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"}'
96 | recorded_at: Wed, 14 Oct 2020 06:15:58 GMT
97 | - request:
98 | method: get
99 | uri: http://localhost:4000/authors/1.json
100 | body:
101 | encoding: US-ASCII
102 | string: ''
103 | headers:
104 | Accept:
105 | - application/json
106 | Accept-Encoding:
107 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
108 | User-Agent:
109 | - Ruby
110 | response:
111 | status:
112 | code: 200
113 | message: OK
114 | headers:
115 | X-Frame-Options:
116 | - SAMEORIGIN
117 | X-Xss-Protection:
118 | - 1; mode=block
119 | X-Content-Type-Options:
120 | - nosniff
121 | X-Download-Options:
122 | - noopen
123 | X-Permitted-Cross-Domain-Policies:
124 | - none
125 | Referrer-Policy:
126 | - strict-origin-when-cross-origin
127 | Content-Type:
128 | - application/json; charset=utf-8
129 | Etag:
130 | - W/"281311c4ac3a4c358c1afedd134e76be"
131 | Cache-Control:
132 | - max-age=0, private, must-revalidate
133 | X-Request-Id:
134 | - 8090d88f-4a81-4481-a39a-aeb9b7500302
135 | X-Runtime:
136 | - '0.003791'
137 | Transfer-Encoding:
138 | - chunked
139 | body:
140 | encoding: UTF-8
141 | string: '{"id":1,"name":"Mat","age":30,"email":"aaa@bbb.ccc","created_at":"2020-08-28T13:25:36.502Z","updated_at":"2020-10-14T06:10:02.523Z"}'
142 | recorded_at: Wed, 14 Oct 2020 06:15:58 GMT
143 | - request:
144 | method: get
145 | uri: http://localhost:4000/authors/5.json
146 | body:
147 | encoding: US-ASCII
148 | string: ''
149 | headers:
150 | Accept:
151 | - application/json
152 | Accept-Encoding:
153 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
154 | User-Agent:
155 | - Ruby
156 | response:
157 | status:
158 | code: 200
159 | message: OK
160 | headers:
161 | X-Frame-Options:
162 | - SAMEORIGIN
163 | X-Xss-Protection:
164 | - 1; mode=block
165 | X-Content-Type-Options:
166 | - nosniff
167 | X-Download-Options:
168 | - noopen
169 | X-Permitted-Cross-Domain-Policies:
170 | - none
171 | Referrer-Policy:
172 | - strict-origin-when-cross-origin
173 | Content-Type:
174 | - application/json; charset=utf-8
175 | Etag:
176 | - W/"f2974d23178429e8a0ae8a00d6b46fbf"
177 | Cache-Control:
178 | - max-age=0, private, must-revalidate
179 | X-Request-Id:
180 | - 133d8e6d-319b-4d57-a7a0-ac522645ea8c
181 | X-Runtime:
182 | - '0.002789'
183 | Transfer-Encoding:
184 | - chunked
185 | body:
186 | encoding: UTF-8
187 | string: '{"id":5,"name":"John Doe","age":24,"email":"aaa@bbb.ccc","created_at":"2020-10-13T05:42:31.193Z","updated_at":"2020-10-13T05:42:31.193Z"}'
188 | recorded_at: Wed, 14 Oct 2020 06:15:58 GMT
189 | recorded_with: VCR 6.0.0
190 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Tags/with_some_tags/filters_the_tags.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/tags.json?limit=5&order=%22tags%22.id%20desc&page=1&per_page=5
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Pagination-Limit:
36 | - '5'
37 | Pagination-Offset:
38 | - '0'
39 | Pagination-Totalcount:
40 | - '12'
41 | Etag:
42 | - W/"c3d1c9c411b9367990485034fa5cd3be"
43 | Cache-Control:
44 | - max-age=0, private, must-revalidate
45 | X-Request-Id:
46 | - d3561efd-05e1-47ad-b613-d8f22644f83d
47 | X-Runtime:
48 | - '0.005203'
49 | Transfer-Encoding:
50 | - chunked
51 | body:
52 | encoding: UTF-8
53 | string: '[{"id":13,"name":"Tag 19","created_at":"2020-10-13T19:34:41.024Z","updated_at":"2020-10-13T19:34:41.024Z"},{"id":12,"name":"Tag
54 | 18","created_at":"2020-10-13T19:34:41.016Z","updated_at":"2020-10-13T19:34:41.016Z"},{"id":11,"name":"Tag
55 | 17","created_at":"2020-10-13T19:34:41.009Z","updated_at":"2020-10-13T19:34:41.009Z"},{"id":10,"name":"Tag
56 | 16","created_at":"2020-10-13T19:34:41.001Z","updated_at":"2020-10-13T19:34:41.001Z"},{"id":9,"name":"Tag
57 | 15","created_at":"2020-10-13T19:34:40.993Z","updated_at":"2020-10-13T19:34:40.993Z"}]'
58 | recorded_at: Wed, 14 Oct 2020 05:52:27 GMT
59 | - request:
60 | method: get
61 | uri: http://localhost:4000/tags.json?limit=5&order=%22tags%22.id%20desc&page=1&per_page=5&q%5Bname_cont%5D=Some%20tag
62 | body:
63 | encoding: US-ASCII
64 | string: ''
65 | headers:
66 | Accept:
67 | - application/json
68 | Accept-Encoding:
69 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
70 | User-Agent:
71 | - Ruby
72 | response:
73 | status:
74 | code: 200
75 | message: OK
76 | headers:
77 | X-Frame-Options:
78 | - SAMEORIGIN
79 | X-Xss-Protection:
80 | - 1; mode=block
81 | X-Content-Type-Options:
82 | - nosniff
83 | X-Download-Options:
84 | - noopen
85 | X-Permitted-Cross-Domain-Policies:
86 | - none
87 | Referrer-Policy:
88 | - strict-origin-when-cross-origin
89 | Content-Type:
90 | - application/json; charset=utf-8
91 | Pagination-Limit:
92 | - '5'
93 | Pagination-Offset:
94 | - '0'
95 | Pagination-Totalcount:
96 | - '1'
97 | Etag:
98 | - W/"ee2464aa1628a00e34ac921d826a5836"
99 | Cache-Control:
100 | - max-age=0, private, must-revalidate
101 | X-Request-Id:
102 | - a5a97d2f-5b05-40da-86bd-d6c78e35789b
103 | X-Runtime:
104 | - '0.003194'
105 | Transfer-Encoding:
106 | - chunked
107 | body:
108 | encoding: UTF-8
109 | string: '[{"id":1,"name":"Some tag","created_at":"2020-10-11T12:12:55.979Z","updated_at":"2020-10-11T12:12:55.979Z"}]'
110 | recorded_at: Wed, 14 Oct 2020 05:52:27 GMT
111 | recorded_with: VCR 6.0.0
112 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Tags/with_some_tags/loads_a_tag.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/tags/1.json
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"3e15bf856c71c2437856a51e790cc7e2"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - 57c1f7ac-bb93-4696-bedf-257fff4f33ce
41 | X-Runtime:
42 | - '0.003424'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '{"id":1,"name":"Some tag","created_at":"2020-10-11T12:12:55.979Z","updated_at":"2020-10-11T12:12:55.979Z"}'
48 | recorded_at: Wed, 14 Oct 2020 05:42:59 GMT
49 | recorded_with: VCR 6.0.0
50 |
--------------------------------------------------------------------------------
/spec/fixtures/vcr_cassettes/Tags/with_some_tags/loads_the_tags_list.yml:
--------------------------------------------------------------------------------
1 | ---
2 | http_interactions:
3 | - request:
4 | method: get
5 | uri: http://localhost:4000/tags.json?limit=30&order=%22tags%22.id%20desc&page=1&per_page=30
6 | body:
7 | encoding: US-ASCII
8 | string: ''
9 | headers:
10 | Accept:
11 | - application/json
12 | Accept-Encoding:
13 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14 | User-Agent:
15 | - Ruby
16 | response:
17 | status:
18 | code: 200
19 | message: OK
20 | headers:
21 | X-Frame-Options:
22 | - SAMEORIGIN
23 | X-Xss-Protection:
24 | - 1; mode=block
25 | X-Content-Type-Options:
26 | - nosniff
27 | X-Download-Options:
28 | - noopen
29 | X-Permitted-Cross-Domain-Policies:
30 | - none
31 | Referrer-Policy:
32 | - strict-origin-when-cross-origin
33 | Content-Type:
34 | - application/json; charset=utf-8
35 | Etag:
36 | - W/"a37946575ecbc6017a8566887d3a605f"
37 | Cache-Control:
38 | - max-age=0, private, must-revalidate
39 | X-Request-Id:
40 | - 6a2916ba-e872-495c-81eb-6d281153f902
41 | X-Runtime:
42 | - '0.003551'
43 | Transfer-Encoding:
44 | - chunked
45 | body:
46 | encoding: UTF-8
47 | string: '[{"id":1,"name":"Some tag","created_at":"2020-10-11T12:12:55.979Z","updated_at":"2020-10-11T12:12:55.979Z"},{"id":2,"name":"Attag!","created_at":"2020-10-11T12:13:03.091Z","updated_at":"2020-10-11T12:13:03.091Z"}]'
48 | recorded_at: Tue, 13 Oct 2020 12:10:25 GMT
49 | - request:
50 | method: get
51 | uri: http://localhost:4000/tags.json?limit=5&order=%22tags%22.id%20desc&page=1&per_page=5
52 | body:
53 | encoding: US-ASCII
54 | string: ''
55 | headers:
56 | Accept:
57 | - application/json
58 | Accept-Encoding:
59 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
60 | User-Agent:
61 | - Ruby
62 | response:
63 | status:
64 | code: 200
65 | message: OK
66 | headers:
67 | X-Frame-Options:
68 | - SAMEORIGIN
69 | X-Xss-Protection:
70 | - 1; mode=block
71 | X-Content-Type-Options:
72 | - nosniff
73 | X-Download-Options:
74 | - noopen
75 | X-Permitted-Cross-Domain-Policies:
76 | - none
77 | Referrer-Policy:
78 | - strict-origin-when-cross-origin
79 | Content-Type:
80 | - application/json; charset=utf-8
81 | Pagination-Limit:
82 | - '5'
83 | Pagination-Offset:
84 | - '0'
85 | Pagination-Totalcount:
86 | - '12'
87 | Etag:
88 | - W/"c3d1c9c411b9367990485034fa5cd3be"
89 | Cache-Control:
90 | - max-age=0, private, must-revalidate
91 | X-Request-Id:
92 | - 9e4f0086-2035-4f8d-9336-a62ea3d78bdf
93 | X-Runtime:
94 | - '0.005067'
95 | Transfer-Encoding:
96 | - chunked
97 | body:
98 | encoding: UTF-8
99 | string: '[{"id":13,"name":"Tag 19","created_at":"2020-10-13T19:34:41.024Z","updated_at":"2020-10-13T19:34:41.024Z"},{"id":12,"name":"Tag
100 | 18","created_at":"2020-10-13T19:34:41.016Z","updated_at":"2020-10-13T19:34:41.016Z"},{"id":11,"name":"Tag
101 | 17","created_at":"2020-10-13T19:34:41.009Z","updated_at":"2020-10-13T19:34:41.009Z"},{"id":10,"name":"Tag
102 | 16","created_at":"2020-10-13T19:34:41.001Z","updated_at":"2020-10-13T19:34:41.001Z"},{"id":9,"name":"Tag
103 | 15","created_at":"2020-10-13T19:34:40.993Z","updated_at":"2020-10-13T19:34:40.993Z"}]'
104 | recorded_at: Wed, 14 Oct 2020 05:48:59 GMT
105 | recorded_with: VCR 6.0.0
106 |
--------------------------------------------------------------------------------
/spec/rails_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'spec_helper'
4 |
5 | ENV['RAILS_ENV'] = 'test'
6 |
7 | require File.expand_path('dummy/config/environment.rb', __dir__)
8 |
9 | abort('The Rails environment is running in production mode!') if Rails.env.production?
10 |
11 | require 'rspec/rails'
12 | require 'capybara/rails'
13 | require 'webmock/rspec'
14 |
15 | Dir[File.expand_path('support/**/*.rb', __dir__)].sort.each { |f| require f }
16 |
17 | # Force deprecations to raise an exception.
18 | # ActiveSupport::Deprecation.behavior = :raise
19 |
20 | # Checks for pending migrations and applies them before tests are run.
21 | # If you are not using ActiveRecord, you can remove these lines.
22 | begin
23 | ActiveRecord::Migration.maintain_test_schema!
24 | rescue ActiveRecord::PendingMigrationError => e
25 | puts e.to_s.strip
26 | exit 1
27 | end
28 |
29 | RSpec.configure do |config|
30 | config.fixture_path = "#{::Rails.root}/spec/fixtures"
31 | config.infer_spec_type_from_file_location!
32 | config.filter_rails_from_backtrace!
33 |
34 | config.use_transactional_fixtures = true
35 | config.use_instantiated_fixtures = false
36 | config.render_views = false
37 |
38 | config.before(:suite) do
39 | intro = ('-' * 80)
40 | intro << "\n"
41 | intro << "- Ruby: #{RUBY_VERSION}\n"
42 | intro << "- Rails: #{Rails.version}\n"
43 | intro << "- ActiveAdmin: #{ActiveAdmin::VERSION}\n"
44 | intro << "- ActiveResource: #{ActiveResource::VERSION::STRING}\n"
45 | intro << ('-' * 80)
46 |
47 | RSpec.configuration.reporter.message(intro)
48 | end
49 | end
50 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | RSpec.configure do |config|
4 | config.disable_monkey_patching!
5 | config.filter_run focus: true
6 | config.filter_run_excluding changes_filesystem: true
7 | config.run_all_when_everything_filtered = true
8 |
9 | config.order = :random
10 | config.example_status_persistence_file_path = '.rspec_failures'
11 | config.shared_context_metadata_behavior = :apply_to_host_groups
12 |
13 | config.expect_with :rspec do |expectations|
14 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
15 | end
16 |
17 | config.mock_with :rspec do |mocks|
18 | mocks.verify_partial_doubles = true
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/spec/support/capybara.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | Capybara.server = :puma
4 | Capybara.default_driver = Capybara.javascript_driver = :cuprite
5 |
6 | RSpec.configure do |config|
7 | # Make sure this hook runs before others
8 | config.prepend_before(:each, type: :system) do
9 | # Use JS driver always
10 | driven_by Capybara.javascript_driver
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/spec/support/capybara_cuprite.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'capybara/cuprite'
4 |
5 | Capybara.register_driver(:cuprite) do |app|
6 | browser_options = {}.tap do |opts|
7 | opts['no-sandbox'] = nil if ENV['CI']
8 | end
9 |
10 | Capybara::Cuprite::Driver.new(
11 | app,
12 | **{
13 | window_size: [1600, 1000],
14 | # See additional options for Dockerized environment in the respective section of this article
15 | browser_options: browser_options,
16 | # Increase Chrome startup wait time (required for stable CI builds)
17 | process_timeout: 10,
18 | # The number of seconds we'll wait for a response when communicating with browser. Default is 5
19 | timeout: 10,
20 | # Enable debugging capabilities
21 | inspector: true,
22 | # Allow running Chrome in a headful mode by setting HEADLESS env var to a falsey value
23 | headless: !ENV['CUPRITE_HEADLESS'].in?(%w[n 0 no false])
24 | }
25 | )
26 | end
27 |
--------------------------------------------------------------------------------
/spec/support/output.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | RSpec.configure do |config|
4 | config.color = true
5 | config.tty = true
6 | end
7 |
--------------------------------------------------------------------------------
/spec/support/vcr.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'vcr'
4 |
5 | VCR.configure do |config|
6 | config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
7 | config.configure_rspec_metadata!
8 | config.default_cassette_options = { record: :new_episodes }
9 | config.hook_into :webmock
10 |
11 | config.ignore_request do |request|
12 | ['/__identify__', '/json/version'].include? URI(request.uri).path
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/spec/system/authors_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | RSpec.describe 'Authors', type: :system do
4 | it 'fails to create an author', :aggregate_failures, :vcr do
5 | visit '/admin/authors/new'
6 |
7 | fill_in('author[name]', with: 'Boh')
8 | fill_in('author[age]', with: '24')
9 | fill_in('author[email]', with: 'Some invalid e-mail address')
10 | find('#author_submit_action [type="submit"]').click
11 |
12 | error = find('#author_email_input .inline-errors').text
13 | expect(error).to include 'Invalid email'
14 | end
15 |
16 | it 'creates an author', :aggregate_failures, :vcr do
17 | visit '/admin/authors/new'
18 |
19 | fill_in('author[name]', with: 'Some name')
20 | fill_in('author[age]', with: '30')
21 | fill_in('author[email]', with: 'some_email@example.com')
22 | find('#author_submit_action [type="submit"]').click
23 |
24 | expect(page).to have_http_status(:success)
25 | expect(page).to have_content('Author was successfully created.')
26 | end
27 |
28 | context 'with some authors' do
29 | it 'loads the authors list', :aggregate_failures, :vcr do
30 | visit '/admin/authors'
31 |
32 | expect(page).to have_http_status(:success)
33 | expect(page).to have_css('#index_table_authors td.col-name', count: 4)
34 | end
35 |
36 | it 'loads an author', :aggregate_failures, :vcr do
37 | visit '/admin/authors/1'
38 |
39 | expect(page).to have_http_status(:success)
40 | expect(page).to have_css('#attributes_table_author_1')
41 | end
42 |
43 | it 'fails to update an author', :aggregate_failures, :vcr do
44 | visit '/admin/authors/1/edit'
45 |
46 | fill_in('author[name]', with: '')
47 | find('#author_submit_action [type="submit"]').click
48 |
49 | error = find('#author_name_input .inline-errors').text
50 | expect(error).to include "can't be blank"
51 | expect(error).to include "is too short"
52 | end
53 |
54 | it 'updates an author', :aggregate_failures, :vcr do
55 | visit '/admin/authors/1/edit'
56 |
57 | fill_in('author[age]', with: '30')
58 | find('#author_submit_action [type="submit"]').click
59 |
60 | expect(page).to have_http_status(:success)
61 | expect(page).to have_content('Author was successfully updated.')
62 | end
63 |
64 | it 'destroys an author', :aggregate_failures, :vcr do
65 | visit '/admin/authors'
66 |
67 | find_all('.delete_link.member_link').last.click
68 |
69 | expect(page).to have_http_status(:success)
70 | expect(page).to have_content('Author was successfully destroyed.')
71 | end
72 | end
73 | end
74 |
--------------------------------------------------------------------------------
/spec/system/posts_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | RSpec.describe 'Posts', type: :system do
4 | it 'fails to create a post', :aggregate_failures, :vcr do
5 | visit '/admin/posts/new'
6 |
7 | fill_in('post[title]', with: '')
8 | find('#post_submit_action [type="submit"]').click
9 |
10 | error = find('#post_title_input .inline-errors').text
11 | expect(error).to include "can't be blank"
12 | expect(error).to include "is too short"
13 | end
14 |
15 | context 'with some authors' do
16 | it 'creates a post', :aggregate_failures, :vcr do
17 | visit '/admin/posts/new'
18 |
19 | fill_in('post[title]', with: 'Some title')
20 | select('Mat', from: 'post[author_id]')
21 | find('#post_submit_action [type="submit"]').click
22 |
23 | expect(page).to have_http_status(:success)
24 | expect(page).to have_content('Post was successfully created.')
25 | end
26 | end
27 |
28 | context 'with some posts' do
29 | it 'loads the posts list', :aggregate_failures, :vcr do
30 | visit '/admin/posts'
31 |
32 | expect(page).to have_http_status(:success)
33 | expect(page).to have_css('#index_table_posts td.col-title', count: 3)
34 | end
35 |
36 | it 'loads a post', :aggregate_failures, :vcr do
37 | visit '/admin/posts/1'
38 |
39 | expect(page).to have_http_status(:success)
40 | expect(page).to have_css('#attributes_table_post_1')
41 | end
42 |
43 | it 'fails to update a post', :aggregate_failures, :vcr do
44 | visit '/admin/posts/1/edit'
45 |
46 | fill_in('post[title]', with: '')
47 | find('#post_submit_action [type="submit"]').click
48 |
49 | error = find('#post_title_input .inline-errors').text
50 | expect(error).to include "can't be blank"
51 | expect(error).to include "is too short"
52 | end
53 |
54 | it 'updates a post', :aggregate_failures, :vcr do
55 | visit '/admin/posts/1/edit'
56 |
57 | fill_in('post[description]', with: 'Some desc')
58 | find('#post_submit_action [type="submit"]').click
59 |
60 | expect(page).to have_http_status(:success)
61 | expect(page).to have_content('Post was successfully updated.')
62 | end
63 |
64 | it 'destroys a post', :aggregate_failures, :vcr do
65 | visit '/admin/posts'
66 |
67 | find_all('.delete_link.member_link').last.click
68 |
69 | expect(page).to have_http_status(:success)
70 | expect(page).to have_content('Post was successfully destroyed.')
71 | end
72 | end
73 | end
74 |
--------------------------------------------------------------------------------
/spec/system/tags_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | RSpec.describe 'Tags', type: :system do
4 | context 'with some tags' do
5 | it 'loads the tags list', :aggregate_failures, :vcr do
6 | visit '/admin/tags'
7 |
8 | expect(page).to have_http_status(:success)
9 | expect(page).to have_css('#index_table_tags td.col-name', count: 5)
10 | end
11 |
12 | it 'filters the tags', :aggregate_failures, :vcr do
13 | visit '/admin/tags'
14 |
15 | fill_in('q[name_cont]', with: 'Some tag')
16 | find('[type="submit"][value="Filter"]').click
17 | expect(page).to have_css('#index_table_tags td.col-name', count: 1)
18 | name = find('#index_table_tags td.col-name')
19 | expect(name.text).to eq 'Some tag'
20 | end
21 |
22 | it 'loads a tag', :aggregate_failures, :vcr do
23 | visit '/admin/tags/1'
24 |
25 | expect(page).to have_http_status(:success)
26 | expect(page).to have_css('#attributes_table_tag_1')
27 | end
28 | end
29 | end
30 |
--------------------------------------------------------------------------------