Merge pull request #59 from blocknotes/build/improve-dev-setup

Improve dev and test setup
Этот коммит содержится в:
Mattia Roccoberton
2025-04-13 15:04:13 +02:00
коммит произвёл GitHub
родитель 30b746583e b38ce0713d
Коммит 6946b78e4c
30 изменённых файлов: 214 добавлений и 297 удалений

23
.github/workflows/linters.yml поставляемый
Просмотреть файл

@@ -2,38 +2,35 @@
name: Linters
on:
push:
branches:
- main
pull_request:
branches: [main]
push:
branches: [main]
jobs:
reviewdog:
name: reviewdog
name: Reviewdog
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['3.0']
env:
RUBY_VERSION: ${{ matrix.ruby }}
RAILS_VERSION: 7.0
steps:
- name: Check out code
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
ruby-version: 3.0
bundler-cache: true
- uses: reviewdog/action-setup@v1
- name: Set up Reviewdog
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: Run reviewdog
- name: Run Reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |

20
.github/workflows/specs_rails61.yml поставляемый
Просмотреть файл

@@ -1,24 +1,23 @@
---
name: Specs Rails 6.1
name: Specs Rails 6.1 with ActiveAdmin 2.9
on:
push:
branches:
- main
pull_request:
branches:
- main
branches: [main]
push:
branches: [main]
jobs:
tests:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['3.0', '3.1']
ruby: ['3.0']
env:
RAILS_VERSION: 6.1.0
RAILS_VERSION: 6.0
ACTIVEADMIN_VERSION: 2.9.0
steps:
- name: Checkout repository
@@ -30,6 +29,9 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Database setup
run: bin/rails db:create db:migrate db:test:prepare
- name: Run tests
run: bundle exec rspec --profile

17
.github/workflows/specs_rails70.yml поставляемый
Просмотреть файл

@@ -2,23 +2,21 @@
name: Specs Rails 7.0
on:
push:
branches:
- main
pull_request:
branches:
- main
branches: [main]
push:
branches: [main]
jobs:
tests:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['3.1']
ruby: ['3.0', '3.2']
env:
RAILS_VERSION: 7.0.0
RAILS_VERSION: 7.0
steps:
- name: Checkout repository
@@ -30,6 +28,9 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Database setup
run: bin/rails db:create db:migrate db:test:prepare
- name: Run tests
run: bundle exec rspec --profile

17
.github/workflows/specs_rails71.yml поставляемый
Просмотреть файл

@@ -2,23 +2,21 @@
name: Specs Rails 7.1
on:
push:
branches:
- main
pull_request:
branches:
- main
branches: [main]
push:
branches: [main]
jobs:
tests:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['3.2']
ruby: ['3.2', '3.4']
env:
RAILS_VERSION: 7.1.0
RAILS_VERSION: 7.1
steps:
- name: Checkout repository
@@ -30,6 +28,9 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Database setup
run: bin/rails db:create db:migrate db:test:prepare
- name: Run tests
run: bundle exec rspec --profile

15
.github/workflows/specs_rails72.yml поставляемый
Просмотреть файл

@@ -2,15 +2,13 @@
name: Specs Rails 7.2
on:
push:
branches:
- main
pull_request:
branches:
- main
branches: [main]
push:
branches: [main]
jobs:
tests:
test:
runs-on: ubuntu-latest
strategy:
@@ -18,7 +16,7 @@ jobs:
ruby: ['3.2', '3.4']
env:
RAILS_VERSION: 7.2.0
RAILS_VERSION: 7.2
steps:
- name: Checkout repository
@@ -30,6 +28,9 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Database setup
run: bin/rails db:create db:migrate db:test:prepare
- name: Run tests
run: bundle exec rspec --profile

17
.github/workflows/specs_rails80.yml поставляемый
Просмотреть файл

@@ -2,23 +2,21 @@
name: Specs Rails 8.0
on:
push:
branches:
- main
pull_request:
branches:
- main
branches: [main]
push:
branches: [main]
jobs:
tests:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['3.2', '3.3', '3.4']
ruby: ['3.2', '3.4']
env:
RAILS_VERSION: 8.0.0
RAILS_VERSION: 8.0
steps:
- name: Checkout repository
@@ -30,6 +28,9 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Database setup
run: bin/rails db:create db:migrate db:test:prepare
- name: Run tests
run: bundle exec rspec --profile

1
.gitignore поставляемый
Просмотреть файл

@@ -8,6 +8,7 @@
/_misc/
/coverage/
/spec/dummy/db/*.sqlite3*
/spec/dummy/db/schema-dev.rb
/spec/dummy/log/
/spec/dummy/storage/
/spec/dummy/tmp/

25
Gemfile
Просмотреть файл

@@ -2,6 +2,12 @@
source 'https://rubygems.org'
def eval_version(dependency, version)
return [dependency] if version.empty?
version.count('.') < 2 ? [dependency, "~> #{version}.0"] : [dependency, version]
end
if ENV['DEVEL'] == '1'
gem 'activeadmin_quill_editor', path: './'
else
@@ -9,20 +15,22 @@ else
end
ruby_ver = ENV.fetch('RUBY_VERSION', '')
rails_ver = ENV.fetch('RAILS_VERSION', '')
activeadmin_ver = ENV.fetch('ACTIVEADMIN_VERSION', '')
rails = rails_ver.empty? ? ['rails'] : ['rails', "~> #{rails_ver}"]
rails_ver = ENV.fetch('RAILS_VERSION', '')
rails = eval_version('rails', rails_ver)
gem(*rails)
activeadmin = activeadmin_ver.empty? ? ['activeadmin'] : ['activeadmin', "~> #{activeadmin_ver}"]
gem(*activeadmin)
active_admin_ver = ENV.fetch('ACTIVEADMIN_VERSION', '')
active_admin = eval_version('activeadmin', active_admin_ver)
gem(*active_admin)
ruby32 = Gem::Version.new(ruby_ver) >= Gem::Version.new('3.2')
rails72 = Gem::Version.new(rails_ver) >= Gem::Version.new('7.2')
sqlite3 = ruby32 || rails72 ? ['sqlite3'] : ['sqlite3', '~> 1.4']
ruby32 = ruby_ver.empty? || Gem::Version.new(ruby_ver) >= Gem::Version.new('3.2')
rails72 = rails_ver.empty? || Gem::Version.new(rails_ver) >= Gem::Version.new('7.2')
sqlite3 = ruby32 && rails72 ? ['sqlite3'] : ['sqlite3', '~> 1.4']
gem(*sqlite3)
gem 'zeitwerk', '~> 2.6.18' unless ruby32
# NOTE: to avoid error: uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger
gem 'concurrent-ruby', '1.3.4'
@@ -39,7 +47,6 @@ gem 'capybara'
gem 'cuprite'
gem 'rspec_junit_formatter'
gem 'rspec-rails'
gem 'rspec-retry'
gem 'simplecov', require: false
# Linters

Просмотреть файл

@@ -1,7 +1,14 @@
include extra/.env
help:
@echo "Main targets: build / specs / up / server / specs / shell"
@echo -e "${COMPOSE_PROJECT_NAME} - Main project commands:\n\
make up # starts the dev services (optional env vars: RUBY / RAILS / ACTIVEADMIN)\n\
make specs # run the tests (after up)\n\
make lint # run the linters (after up)\n\
make server # run the server (after up)\n\
make shell # open a shell (after up)\n\
make down # cleanup (after up)\n\
Example: RUBY=3.2 RAILS=7.1 ACTIVEADMIN=3.2.0 make up"
# System commands
@@ -10,7 +17,7 @@ build:
@docker compose -f extra/docker-compose.yml build
db_reset:
@docker compose -f extra/docker-compose.yml run --rm app bin/rails db:reset db:test:prepare
@docker compose -f extra/docker-compose.yml run --rm app bin/rails db:create db:migrate db:test:prepare
up: build db_reset
@docker compose -f extra/docker-compose.yml up
@@ -23,13 +30,16 @@ down:
# App commands
console:
seed:
@docker compose -f extra/docker-compose.yml exec app bin/rails db:seed
console: seed
@docker compose -f extra/docker-compose.yml exec app bin/rails console
lint:
@docker compose -f extra/docker-compose.yml exec app bin/rubocop
server:
server: seed
@docker compose -f extra/docker-compose.yml exec app bin/rails server -b 0.0.0.0 -p ${SERVER_PORT}
specs:

Просмотреть файл

@@ -26,6 +26,6 @@ ENV ACTIVEADMIN_VERSION=$ACTIVEADMIN_VERSION
WORKDIR /app
COPY . /app
RUN bundle install
RUN mkdir -p /app/spec/dummy/db && chown -R app:app /app/spec/dummy/db /usr/local/bundle
RUN chown -R app:app /usr/local/bundle
RUN ln -s /app/extra/.bashrc /home/app/.bashrc

Просмотреть файл

@@ -4,5 +4,3 @@ export DEVEL=1
export RAILS_VERSION=7.2.2.1
export ACTIVEADMIN_VERSION=3.3.0
export RAILS_ENV=development

Просмотреть файл

@@ -1,29 +1,21 @@
## Development
Overcommit can be used to ensure that Conventional commits are good.
### Dev setup
There 2 ways to interact with this project:
There are 2 ways to interact with this project:
1) Using Docker:
```sh
# Run rails server on the dummy app (=> http://localhost:3000 to access to ActiveAdmin):
make up
# Enter in a Rails console (with the dummy app started):
make console
# Enter in a shell (with the dummy app started):
make shell
# Run the linter on the project (with the dummy app started):
make lint
# Run the test suite (with the dummy app started):
make specs
# Remove container and image:
make cleanup
# To try different versions of Ruby/Rails/ActiveAdmin:
RUBY=3.2 RAILS=7.1.0 ACTIVEADMIN=3.2.0 make up
# For more commands please check the Makefile
make up # starts the dev services (optional env vars: RUBY / RAILS / ACTIVEADMIN)
make specs # run the tests (after up)
make lint # run the linters (after up)
make server # run the server (after up)
make shell # open a shell (after up)
make down # cleanup (after up)
# Example using specific versions:
RUBY=3.2 RAILS=7.1 ACTIVEADMIN=3.2.0 make up
```
2) With a local setup:

Просмотреть файл

@@ -4,10 +4,10 @@ services:
context: ..
dockerfile: extra/Dockerfile
args:
ACTIVEADMIN_VERSION: ${ACTIVEADMIN:-}
BUNDLER_VERSION: ${BUNDLER_VERSION}
RAILS_VERSION: ${RAILS:-}
RUBY_IMAGE: ruby:${RUBY:-3.4}-slim
RAILS_VERSION: ${RAILS:-}
ACTIVEADMIN_VERSION: ${ACTIVEADMIN:-}
UID: ${UID}
user: ${UID}:${GID}
ports:

Просмотреть файл

@@ -44,7 +44,7 @@ ActiveAdmin.register Post do
f.input :author
f.input :title
f.input :summary, as: :quill_editor, input_html: { data: { options: { modules: { toolbar: toolbar } } } }
f.input :description, as: :quill_editor, input_html: { data: { options: { modules: { toolbar: toolbar } } } }
f.input :description, as: :quill_editor # using default options
f.input :category
f.input :dt
f.input :position

Просмотреть файл

@@ -1,4 +1,5 @@
# frozen_string_literal: true
ActiveAdmin.register Tag do
permit_params :name
end

Просмотреть файл

@@ -1,8 +1,6 @@
# frozen_string_literal: true
class Post < ApplicationRecord
# enum state: %i[available unavailable arriving]
belongs_to :author, inverse_of: :posts, autosave: true
has_one :author_profile, through: :author, source: :profile
@@ -28,12 +26,12 @@ class Post < ApplicationRecord
end
class << self
def ransackable_attributes(auth_object = nil)
%w[author_id category created_at description dt id position published summary title updated_at]
def ransackable_associations(_auth_object = nil)
%w[author author_profile post_tags tags images_attachments images_blobs]
end
def ransackable_associations(auth_object = nil)
%w[author author_profile images_attachments images_blobs post_tags tags]
def ransackable_attributes(_auth_object = nil)
%w[author_id category created_at description dt id position published title summary updated_at]
end
end
end

Просмотреть файл

@@ -3,14 +3,12 @@
class Profile < ApplicationRecord
belongs_to :author, inverse_of: :profile, touch: true
# has_rich_text :description
# def to_s
# description
# end
def to_s
description
end
class << self
def ransackable_associations(auth_object = nil)
def ransackable_associations(_auth_object = nil)
%w[author]
end

Просмотреть файл

@@ -1,26 +1,23 @@
require_relative 'boot'
require 'rails/all'
require 'sprockets/railtie'
Bundler.require(*Rails.groups)
module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0 if Rails::VERSION::MAJOR == 6
config.load_defaults Rails::VERSION::STRING.to_f
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
config.active_support.deprecation = :raise
###
if Gem::Version.new(Rails.version) < Gem::Version.new('7.1')
config.active_record.legacy_connection_handling = false
end
config.active_record.legacy_connection_handling = false if Gem::Version.new(Rails.version) < Gem::Version.new('7.1')
config.before_configuration do
ActiveSupport::Cache.format_version = 7.0 if Gem::Version.new(Rails.version) > Gem::Version.new('7.0')
if Gem::Version.new(Rails.version) > Gem::Version.new('7.0')
config.before_configuration do
ActiveSupport::Cache.format_version = 7.0
end
end
end
end

Просмотреть файл

@@ -6,7 +6,7 @@ default: &default
development:
<<: *default
database: db/development.sqlite3
schema_dump: schema_development.rb
schema_dump: schema-dev.rb
test:
<<: *default

Просмотреть файл

@@ -1,7 +1,9 @@
ActiveSupport::Reloader.to_prepare do
Rails.application.reloader.to_prepare do
ActiveStorage::Attachment.class_eval do
def self.ransackable_attributes(auth_object = nil)
%w[blob_id created_at id name record_id record_type]
class << self
def ransackable_attributes(auth_object = nil)
%w[blob_id created_at id name record_id record_type]
end
end
end
end

Просмотреть файл

@@ -1,99 +0,0 @@
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rails
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_06_07_053739) do
create_table "active_admin_comments", force: :cascade do |t|
t.string "namespace"
t.text "body"
t.string "resource_type"
t.integer "resource_id"
t.string "author_type"
t.integer "author_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id"
t.index ["namespace"], name: "index_active_admin_comments_on_namespace"
t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id"
end
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
t.integer "record_id", null: false
t.integer "blob_id", null: false
t.datetime "created_at", precision: nil, null: false
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
end
create_table "active_storage_blobs", force: :cascade do |t|
t.string "key", null: false
t.string "filename", null: false
t.string "content_type"
t.text "metadata"
t.bigint "byte_size", null: false
t.string "checksum", null: false
t.datetime "created_at", precision: nil, null: false
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
end
create_table "authors", force: :cascade do |t|
t.string "name"
t.integer "age"
t.string "email"
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
end
create_table "post_tags", force: :cascade do |t|
t.integer "post_id"
t.integer "tag_id"
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["post_id"], name: "index_post_tags_on_post_id"
t.index ["tag_id"], name: "index_post_tags_on_tag_id"
end
create_table "posts", force: :cascade do |t|
t.string "title"
t.text "summary"
t.text "description"
t.integer "author_id"
t.string "category"
t.datetime "dt", precision: nil
t.float "position"
t.boolean "published"
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["author_id"], name: "index_posts_on_author_id"
end
create_table "profiles", force: :cascade do |t|
t.text "description"
t.integer "author_id"
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["author_id"], name: "index_profiles_on_author_id"
end
create_table "tags", force: :cascade do |t|
t.string "name"
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
end
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "post_tags", "posts"
add_foreign_key "post_tags", "tags"
add_foreign_key "posts", "authors"
add_foreign_key "profiles", "authors"
end

Просмотреть файл

@@ -7,7 +7,8 @@ end
(11..20).each do |i|
age = 21 + 3 * (i - 10)
attrs = { name: "Author #{i}", age: age, email: "some@email#{i}.com" }
Author.find_or_create_by!(attrs) do |author|
Author.find_or_create_by!(name: "Author #{i}") do |author|
author.assign_attributes(attrs)
author.profile = Profile.new(description: "Profile description for Author #{i}") if (i % 3).zero?
end
end
@@ -19,6 +20,8 @@ tags = Tag.where.not(name: 'A test tag').pluck(:id)
title: "Post #{i}",
author_id: authors.sample,
position: rand(100),
summary: "<p><em>Summary</em> for post #{i}</p>",
description: "<p><strong>Some bold</strong> <em>Some italic</em> <u>Some underline</u> [#{i}]</p>",
created_at: Time.now - rand(3600).seconds
}
attrs[:category] = 'news' if (i % 4).zero?

Просмотреть файл

@@ -1,7 +1,5 @@
# frozen_string_literal: true
require_relative '../../base_page'
module Admin
module Authors
class EditPage < BasePage

Просмотреть файл

@@ -1,7 +1,5 @@
# frozen_string_literal: true
require_relative '../../base_page'
module Admin
module Posts
class EditPage < BasePage

Просмотреть файл

@@ -12,4 +12,8 @@ class BasePage
def load
visit(path)
end
def lookup_editor(editor_container:)
@editor = Shared::QuillEditor.new(editor_container)
end
end

Просмотреть файл

@@ -1,35 +1,35 @@
# frozen_string_literal: true
require_relative '../base_object'
module Shared
class HtmlEditor < BaseObject
def content_element
raise NotImplementedError
end
class HtmlEditor < BaseObject
def content_element
raise NotImplementedError
end
def clear
select_all
content_element.send_keys(:delete)
self
end
def clear
select_all
content_element.send_keys(:delete)
self
end
# @return [self]
def open_dropdown
raise NotImplementedError
end
# @return [self]
def open_dropdown
raise NotImplementedError
end
def select_all
content_element.send_keys([:control, "a"])
self
end
def select_all
content_element.send_keys([:control, "a"])
self
end
def toolbar_control(control, ...)
send(:"toggle_#{control}", ...)
self
end
def toolbar_control(control, ...)
send(:"toggle_#{control}", ...)
self
end
def <<(content)
content_element.send_keys(content)
self
def <<(content)
content_element.send_keys(content)
self
end
end
end

Просмотреть файл

@@ -1,44 +1,46 @@
# frozen_string_literal: true
class QuillEditor < HtmlEditor
SELECTOR = '.ql-container'
TOOLBAR_SELECTOR = '.ql-toolbar'
module Shared
class QuillEditor < HtmlEditor
SELECTOR = '.ql-container'
TOOLBAR_SELECTOR = '.ql-toolbar'
attr_reader :toolbar, :toolbar_selector
attr_reader :toolbar, :toolbar_selector
def initialize(selector: SELECTOR, toolbar_selector: TOOLBAR_SELECTOR)
super(selector: selector)
@toolbar = find(toolbar_selector)
@toolbar_selector = toolbar_selector
end
def initialize(selector: SELECTOR, toolbar_selector: TOOLBAR_SELECTOR)
super(selector: selector)
@toolbar = find(toolbar_selector)
@toolbar_selector = toolbar_selector
end
def content_element
@content_element ||= find("#{selector} .ql-editor")
end
def content_element
@content_element ||= find("#{selector} .ql-editor")
end
def control_selector(control)
case control&.to_sym
when :bold then "#{toolbar_selector} button.ql-bold"
when :italic then "#{toolbar_selector} button.ql-italic"
when :underline then "#{toolbar_selector} button.ql-underline"
when :link then "#{toolbar_selector} button.ql-link"
else raise "Invalid control #{control}"
def control_selector(control)
case control&.to_sym
when :bold then "#{toolbar_selector} button.ql-bold"
when :italic then "#{toolbar_selector} button.ql-italic"
when :underline then "#{toolbar_selector} button.ql-underline"
when :link then "#{toolbar_selector} button.ql-link"
else raise "Invalid control #{control}"
end
end
def toggle_bold
find(control_selector(:bold)).click
end
def toggle_italic
find(control_selector(:italic)).click
end
def toggle_underline
find(control_selector(:underline)).click
end
def toggle_link
find(control_selector(:link)).click
end
end
def toggle_bold
find(control_selector(:bold)).click
end
def toggle_italic
find(control_selector(:italic)).click
end
def toggle_underline
find(control_selector(:underline)).click
end
def toggle_link
find(control_selector(:link)).click
end
end

Просмотреть файл

@@ -2,6 +2,11 @@
require_relative 'spec_helper'
require 'zeitwerk'
loader = Zeitwerk::Loader.new
loader.push_dir("#{__dir__}/page_objects")
loader.setup
ENV['RAILS_ENV'] = 'test'
require 'simplecov'
@@ -13,13 +18,8 @@ abort('The Rails environment is running in production mode!') if Rails.env.produ
require 'rspec/rails'
require 'capybara/rails'
require 'rspec/retry'
Rails.root.glob("../support/**/*.rb").each { |f| require_relative f }
Rails.root.glob("../page_objects/**/*.rb").each { |f| require_relative f }
# Force deprecations to raise an exception.
# ActiveSupport::Deprecation.behavior = :raise
Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require_relative f }
# Checks for pending migrations and applies them before tests are run.
# If you are not using ActiveRecord, you can remove these lines.
@@ -31,6 +31,12 @@ rescue ActiveRecord::PendingMigrationError => e
end
RSpec.configure do |config|
if Gem::Version.new(Rails.version) >= Gem::Version.new('7.1')
config.fixture_paths = [Rails.root.join('spec/fixtures')]
else
config.fixture_path = Rails.root.join('spec/fixtures')
end
config.infer_spec_type_from_file_location!
config.filter_rails_from_backtrace!
@@ -38,8 +44,6 @@ RSpec.configure do |config|
config.use_instantiated_fixtures = false
config.render_views = false
config.default_retry_count = 2
config.before(:suite) do
intro = ('-' * 80)
intro << "\n"

Просмотреть файл

@@ -9,10 +9,10 @@ Capybara.register_driver(:capybara_cuprite) do |app|
Capybara::Cuprite::Driver.new(
app,
window_size: [1600, 1280],
window_size: [1600, 1024],
browser_options: browser_options,
process_timeout: 20,
timeout: 20,
process_timeout: 30,
timeout: 30,
inspector: true,
headless: !ENV['CUPRITE_HEADLESS'].in?(%w[n 0 no false])
)

Просмотреть файл

@@ -2,9 +2,9 @@
RSpec.describe 'Quill editor' do
def lookup_editor(field:)
selector = ["##{field}_input.quill_editor", QuillEditor::SELECTOR].join(' ')
toolbar_selector = ["##{field}_input.quill_editor", QuillEditor::TOOLBAR_SELECTOR].join(' ')
QuillEditor.new(selector: selector, toolbar_selector: toolbar_selector)
selector = ["##{field}_input.quill_editor", Shared::QuillEditor::SELECTOR].join(' ')
toolbar_selector = ["##{field}_input.quill_editor", Shared::QuillEditor::TOOLBAR_SELECTOR].join(' ')
Shared::QuillEditor.new(selector: selector, toolbar_selector: toolbar_selector)
end
let(:author) { Author.create!(email: 'some_email@example.com', name: 'John Doe', age: 30) }