Monkey-patch instead of forking cypress-rails gem (#15797)
This commit is contained in:
parent
b22ad4c976
commit
dfb0d0300c
127 changed files with 25 additions and 10933 deletions
2
Gemfile
2
Gemfile
|
|
@ -141,7 +141,7 @@ group :development, :test do
|
|||
gem "amazing_print", "~> 1.4" # Great Ruby debugging companion: pretty print Ruby objects to visualize their structure
|
||||
gem "bullet", "~> 6.1" # help to kill N+1 queries and unused eager loading
|
||||
gem "capybara", "~> 3.36.0" # Capybara is an integration testing tool for rack based web applications
|
||||
gem "cypress-rails", github: "forem/cypress-rails", branch: "enable-knapsack-pro-support" # For end to end tests (E2E)
|
||||
gem "cypress-rails", "~> 0.5" # For end to end tests (E2E)
|
||||
gem "debug", ">= 1.0.0" # Provide a debug with step capabilities
|
||||
gem "dotenv-rails", "~> 2.7.6" # For loading ENV variables locally
|
||||
gem "faker", "~> 2.19" # A library for generating fake data such as names, addresses, and phone numbers
|
||||
|
|
|
|||
14
Gemfile.lock
14
Gemfile.lock
|
|
@ -6,15 +6,6 @@ GIT
|
|||
acts_as_follower (0.2.1)
|
||||
activerecord (>= 4.0)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/forem/cypress-rails.git
|
||||
revision: 3b89de0823ce2857a901f166647f508ad08f7463
|
||||
branch: enable-knapsack-pro-support
|
||||
specs:
|
||||
cypress-rails (0.5.3)
|
||||
puma (>= 3.8.0)
|
||||
railties (>= 5.2.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
|
|
@ -187,6 +178,9 @@ GEM
|
|||
crack (0.4.5)
|
||||
rexml
|
||||
crass (1.0.6)
|
||||
cypress-rails (0.5.3)
|
||||
puma (>= 3.8.0)
|
||||
railties (>= 5.2.0)
|
||||
dante (0.2.0)
|
||||
ddtrace (0.54.1)
|
||||
debase-ruby_core_source (= 0.10.12)
|
||||
|
|
@ -938,7 +932,7 @@ DEPENDENCIES
|
|||
carrierwave-bombshelter (~> 0.2)
|
||||
cloudinary (~> 1.21)
|
||||
counter_culture (~> 3.1)
|
||||
cypress-rails!
|
||||
cypress-rails (~> 0.5)
|
||||
ddtrace (~> 0.54.1)
|
||||
debug (>= 1.0.0)
|
||||
derailed_benchmarks (~> 2.1)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ if [ "$KNAPSACK_PRO_TEST_SUITE_TOKEN_CYPRESS" = "" ]; then
|
|||
KNAPSACK_PRO_ENDPOINT=https://api-disabled-for-fork.knapsackpro.com \
|
||||
KNAPSACK_PRO_MAX_REQUEST_RETRIES=0 \
|
||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_CYPRESS=disabled-for-fork \
|
||||
E2E=true bin/rails cypress:run_knapsack
|
||||
E2E=true bin/rails cypress:run
|
||||
else
|
||||
E2E=true bin/rails cypress:run_knapsack
|
||||
E2E=true bin/rails cypress:run
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,11 @@
|
|||
# running E2E tests. Otherwise this will run when system tests run.
|
||||
return unless Rails.env.test? && ENV["E2E"].present?
|
||||
|
||||
# Explicitly requiring lib/cypress-rails to load monkey-patch
|
||||
Dir.glob(Rails.root.join("lib/cypress-rails/*.rb")).each do |filename|
|
||||
require_dependency filename
|
||||
end
|
||||
|
||||
# rubocop:disable Rails/Output
|
||||
|
||||
CypressRails.hooks.before_server_start do
|
||||
|
|
|
|||
|
|
@ -15,3 +15,4 @@ Rails.autoloaders.main.ignore(Rails.root.join("lib/data_update_scripts"))
|
|||
Rails.autoloaders.main.ignore(Rails.root.join("lib/generators/data_update"))
|
||||
Rails.autoloaders.main.ignore(Rails.root.join("lib/generators/service"))
|
||||
Rails.autoloaders.main.ignore(Rails.root.join("lib/generators/settings_model"))
|
||||
Rails.autoloaders.main.ignore(Rails.root.join("lib/cypress-rails"))
|
||||
|
|
|
|||
11
lib/cypress-rails/finds_bin.rb
Normal file
11
lib/cypress-rails/finds_bin.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
module CypressRails
|
||||
class FindsBin
|
||||
def call(_dir = Dir.pwd)
|
||||
if ENV["KNAPSACK_PRO_CI_NODE_TOTAL"].present? && ENV["KNAPSACK_PRO_CI_NODE_INDEX"].present?
|
||||
"node_modules/.bin/knapsack-pro-cypress"
|
||||
else
|
||||
"node_modules/.bin/cypress"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
BIN
vendor/cache/cypress-rails-0.5.3.gem
vendored
Normal file
BIN
vendor/cache/cypress-rails-0.5.3.gem
vendored
Normal file
Binary file not shown.
|
|
@ -1,21 +0,0 @@
|
|||
name: CI
|
||||
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
ruby-version: ['2.7', '3.0']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ matrix.ruby-version }}
|
||||
bundler-cache: true
|
||||
|
||||
- name: Run tests
|
||||
run: ./script/test
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
/.bundle/
|
||||
/.yardoc
|
||||
/_yardoc/
|
||||
/coverage/
|
||||
/doc/
|
||||
/pkg/
|
||||
/spec/reports/
|
||||
/tmp/
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
ruby_version: 2.5
|
||||
ignore:
|
||||
- 'vendor/bundle/**/*'
|
||||
- 'example/node_modules/**/*'
|
||||
- 'example/vendor/bundle/**/*'
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
---
|
||||
sudo: false
|
||||
language: ruby
|
||||
cache: bundler
|
||||
rvm:
|
||||
- 2.6.3
|
||||
before_install: gem install bundler -v 1.17.3
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
# CHANGELOG
|
||||
|
||||
## 0.5.3
|
||||
|
||||
* Fix 2.5 & 2.6 compatibility
|
||||
[#100](https://github.com/testdouble/cypress-rails/issues/100)
|
||||
|
||||
## 0.5.2
|
||||
|
||||
* Fixes a puma deprecation warning
|
||||
[#95](https://github.com/testdouble/cypress-rails/pull/95)
|
||||
|
||||
## 0.5.1
|
||||
|
||||
* Sprinkles two instance variables to the custom transaction manager that cribs
|
||||
its implementation from ActiveRecord::TestFixtures (see f75f280)
|
||||
[#88](https://github.com/testdouble/cypress-rails/issues/88)
|
||||
[#89](https://github.com/testdouble/cypress-rails/pull/89)
|
||||
|
||||
## 0.5.0
|
||||
|
||||
* Add hook `after_server_start`
|
||||
[#63](https://github.com/testdouble/cypress-rails/pull/63)
|
||||
* Fix namespace bug
|
||||
[#64](https://github.com/testdouble/cypress-rails/pull/64)
|
||||
|
||||
## 0.4.2
|
||||
|
||||
* Add support to Rails 6.1 ([#52](https://github.com/testdouble/cypress-rails/issue/52))
|
||||
|
||||
## 0.4.1
|
||||
|
||||
* Add backcompat for Ruby 2.4
|
||||
([#47](https://github.com/testdouble/cypress-rails/pull/47))
|
||||
|
||||
## 0.4.0
|
||||
|
||||
* Add a `CYPRESS_RAILS_HOST` option that allows a hostname to be specified (as
|
||||
opposed to 127.0.0.1). Puma will still bind to 127.0.0.1, but Cypress will use
|
||||
the hostname in its `baseUrl`, which may be necessary for some folks' tests to
|
||||
work
|
||||
|
||||
## 0.3.0
|
||||
|
||||
* Add a `CYPRESS_RAILS_BASE_PATH` option which will be appended to the
|
||||
`CYPRESS_BASE_URL` option that cypress-rails sets when launching cypress
|
||||
commands. Apps that set `baseUrl` to something other than "/" can set this env
|
||||
var to match for consistent behavior (or else set it using Cypress.config in a
|
||||
support file)
|
||||
|
||||
## 0.2.0
|
||||
|
||||
* If `RAILS_ENV` has been explicitly set when the CLI or rake task is run,
|
||||
respect that set value instead of overriding it to "test"
|
||||
|
||||
## 0.1.3
|
||||
|
||||
* Improve behavior of SIGINT (Ctrl-C) so a traceback isn't printed and stdout
|
||||
isn't flushed after the program exits
|
||||
|
||||
## 0.1.2
|
||||
|
||||
* Drop the hard deps on capybara and selenium-webdrivers (instead inlining
|
||||
portions of the Capybara server logic). Additionally, add a hard dep on puma
|
||||
since this gem is useless without it
|
||||
|
||||
## 0.1.1
|
||||
|
||||
* Fix the `before_server_stop` hook by rolling back transactions first so that
|
||||
it can clean out test data
|
||||
|
||||
## 0.1.0
|
||||
|
||||
* **[Breaking]** Remove `CypressRails::TestCase`. Use `rake cypress:run` instead
|
||||
* **[Breaking]** cypress-rails now starts a transaction immediately after
|
||||
launching the server, which could result in other processes not being able
|
||||
to observe your changes. To revert to the old behavior, set the env var
|
||||
`CYPRESS_RAILS_TRANSACTIONAL_SERVER=false`
|
||||
* Add configuration variables `CYPRESS_RAILS_DIR`,
|
||||
`CYPRESS_RAILS_TRANSACTIONAL_SERVER`. Rename port and Cypress CLI forwarding
|
||||
to `CYPRESS_RAILS_PORT` and `CYPRESS_RAILS_CYPRESS_OPTS`
|
||||
* Add test data configuration hooks (to be run in an initializer):
|
||||
* `CypressRails.hooks.before_server_start`
|
||||
* `CypressRails.hooks.after_transaction_start`
|
||||
* `CypressRails.hooks.after_state_reset` - after a transaction rollback
|
||||
* `CypressRails.hooks.before_server_stop` - called in an `at_exit` hook
|
||||
|
||||
## 0.0.4
|
||||
|
||||
* Started a changelog
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
||||
|
||||
# Specify your gem's dependencies in cypress-rails.gemspec
|
||||
gemspec
|
||||
106
vendor/cache/cypress-rails-3b89de0823ce/Gemfile.lock
vendored
106
vendor/cache/cypress-rails-3b89de0823ce/Gemfile.lock
vendored
|
|
@ -1,106 +0,0 @@
|
|||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
cypress-rails (0.5.3)
|
||||
puma (>= 3.8.0)
|
||||
railties (>= 5.2.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionpack (6.1.4.1)
|
||||
actionview (= 6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
rack (~> 2.0, >= 2.0.9)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actionview (6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
activesupport (6.1.4.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
zeitwerk (~> 2.3)
|
||||
ast (2.4.2)
|
||||
builder (3.2.4)
|
||||
concurrent-ruby (1.1.9)
|
||||
crass (1.0.6)
|
||||
erubi (1.10.0)
|
||||
i18n (1.8.10)
|
||||
concurrent-ruby (~> 1.0)
|
||||
loofah (2.12.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
method_source (1.0.0)
|
||||
mini_portile2 (2.6.1)
|
||||
minitest (5.14.4)
|
||||
nio4r (2.5.8)
|
||||
nokogiri (1.12.4)
|
||||
mini_portile2 (~> 2.6.1)
|
||||
racc (~> 1.4)
|
||||
parallel (1.20.1)
|
||||
parser (3.0.1.1)
|
||||
ast (~> 2.4.1)
|
||||
puma (5.4.0)
|
||||
nio4r (~> 2.0)
|
||||
racc (1.5.2)
|
||||
rack (2.2.3)
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.4.2)
|
||||
loofah (~> 2.3)
|
||||
railties (6.1.4.1)
|
||||
actionpack (= 6.1.4.1)
|
||||
activesupport (= 6.1.4.1)
|
||||
method_source
|
||||
rake (>= 0.13)
|
||||
thor (~> 1.0)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.4)
|
||||
regexp_parser (2.1.1)
|
||||
rexml (3.2.5)
|
||||
rubocop (1.18.2)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.0.0.0)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml
|
||||
rubocop-ast (>= 1.7.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.7.0)
|
||||
parser (>= 3.0.1.1)
|
||||
rubocop-performance (1.11.3)
|
||||
rubocop (>= 1.7.0, < 2.0)
|
||||
rubocop-ast (>= 0.4.0)
|
||||
ruby-progressbar (1.11.0)
|
||||
standard (1.1.4)
|
||||
rubocop (= 1.18.2)
|
||||
rubocop-performance (= 1.11.3)
|
||||
thor (1.1.0)
|
||||
tzinfo (2.0.4)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (2.0.0)
|
||||
zeitwerk (2.4.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
bundler
|
||||
cypress-rails!
|
||||
minitest (~> 5.0)
|
||||
rake (~> 13.0)
|
||||
standard (>= 0.2.0)
|
||||
|
||||
BUNDLED WITH
|
||||
2.2.15
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019-2020 Test Double, LLC
|
||||
|
||||
Portions of the CypressRails::Server component:
|
||||
Copyright (c) 2009-2018 Thomas Walpole, Jonas Nicklas
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
357
vendor/cache/cypress-rails-3b89de0823ce/README.md
vendored
357
vendor/cache/cypress-rails-3b89de0823ce/README.md
vendored
|
|
@ -1,357 +0,0 @@
|
|||
# cypress-rails
|
||||
|
||||
This is a simple gem to make it easier to start writing browser tests with
|
||||
[Cypress](http://cypress.io) for your [Rails](https://rubyonrails.org) apps,
|
||||
regardless of whether your app is server-side rendered HTML, completely
|
||||
client-side JavaScript, or something in-between.
|
||||
|
||||
## Installation
|
||||
|
||||
**tl;dr**:
|
||||
|
||||
1. Install the npm package `cypress`
|
||||
2. Install this gem `cypress-rails`
|
||||
3. Run `rake cypress:init`
|
||||
|
||||
### Installing Cypress itself
|
||||
|
||||
The first step is making sure Cypress is installed (that's up to you, this
|
||||
library doesn't install Cypress, it just provides a little Rails-specific glue).
|
||||
|
||||
If you're on newer versions of Rails and using
|
||||
[webpacker](https://www.github.com/rails/webpacker) for your front-end assets,
|
||||
then you're likely already using yarn to manage your JavaScript dependencies. If
|
||||
that's the case, you can add Cypress with:
|
||||
|
||||
```sh
|
||||
$ yarn add --dev cypress
|
||||
```
|
||||
|
||||
If you're not using yarn in conjunction with your Rails app, check out the
|
||||
Cypress docs on getting it installed. At the end of the day, this gem just needs
|
||||
the `cypress` binary to exist either in `./node_modules/.bin/cypress` or on your
|
||||
`PATH`.
|
||||
|
||||
### Installing the cypress-rails gem
|
||||
|
||||
Now, to install the cypress-rails gem, you'll want to add it to your development
|
||||
& test gem groups of your Gemfile, so that you have easy access to its rake
|
||||
tasks:
|
||||
|
||||
```ruby
|
||||
group :development, :test do
|
||||
gem "cypress-rails"
|
||||
end
|
||||
```
|
||||
|
||||
Once installed, you'll want to run:
|
||||
|
||||
```sh
|
||||
$ rake cypress:init
|
||||
```
|
||||
|
||||
This will override a few configurations in your `cypress.json` configuration
|
||||
file.
|
||||
|
||||
## Usage
|
||||
|
||||
### Develop tests interactively with `cypress open`
|
||||
|
||||
When writing tests with Cypress, you'll find the most pleasant experience (by
|
||||
way of a faster feedback loop and an interactive, easy-to-inspect test runner)
|
||||
using the `cypress open` command.
|
||||
|
||||
When using Rails, however, you'll also want your Rails test server to be running
|
||||
so that there's something for Cypress to interact with. `cypress-rails` provides
|
||||
a wrapper for running `cypress open` with a dedicated Rails test server.
|
||||
|
||||
So, by running:
|
||||
|
||||
```sh
|
||||
$ rake cypress:open
|
||||
```
|
||||
|
||||
Any JavaScript files added to `cypress/integration` will be identified by
|
||||
Cypress as tests. Simply click a test file in the Cypress application window to
|
||||
launch the test in a browser. Each time you save the test file, it will re-run
|
||||
itself.
|
||||
|
||||
### Run tests headlessly with `cypress run`
|
||||
|
||||
To run your tests headlessly (e.g. when you're in CI), you'll want the `run`
|
||||
command:
|
||||
|
||||
```sh
|
||||
$ rake cypress:run
|
||||
```
|
||||
|
||||
## Managing your test data
|
||||
|
||||
The tricky thing about browser tests is that they usually depend on some test
|
||||
data being available with which to exercise the app efficiently. Because cypress
|
||||
is a JavaScript-based tool and can't easily manipulate your Rails app directly,
|
||||
cypress-rails provides a number of hooks that you can use to manage your test
|
||||
data.
|
||||
|
||||
Here's what a `config/initializers/cypress_rails.rb` initializer might look
|
||||
like:
|
||||
|
||||
```ruby
|
||||
return unless Rails.env.test?
|
||||
|
||||
CypressRails.hooks.before_server_start do
|
||||
# Called once, before either the transaction or the server is started
|
||||
end
|
||||
|
||||
CypressRails.hooks.after_transaction_start do
|
||||
# Called after the transaction is started (at launch and after each reset)
|
||||
end
|
||||
|
||||
CypressRails.hooks.after_state_reset do
|
||||
# Triggered after `/cypress_rails_reset_state` is called
|
||||
end
|
||||
|
||||
CypressRails.hooks.before_server_stop do
|
||||
# Called once, at_exit
|
||||
end
|
||||
```
|
||||
|
||||
(You can find [an
|
||||
example
|
||||
initializer](/example/config/initializers/cypress_rails_initializer.rb)
|
||||
in this repo.)
|
||||
|
||||
The gem also provides a special route on the test server:
|
||||
`/cypress_rails_reset_state`. Each time it's called, cypress-rails will do
|
||||
two things at the beginning of the next request received by the Rails app:
|
||||
|
||||
* If `CYPRESS_RAILS_TRANSACTIONAL_SERVER` is enabled, roll back the transaction,
|
||||
effectively resetting the application state to whatever it was at the start of
|
||||
the test run
|
||||
|
||||
* Trigger any `after_state_reset` hooks you've configured (regardless of the
|
||||
transactional server setting)
|
||||
|
||||
This way, you can easily instruct the server to reset its test state from your
|
||||
Cypress tests like so:
|
||||
|
||||
```js
|
||||
beforeEach(() => {
|
||||
cy.request('/cypress_rails_reset_state')
|
||||
})
|
||||
```
|
||||
|
||||
(Remember, in Cypress, `before` is a before-all hook and `beforeEach` is run
|
||||
between each test case!)
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment variables
|
||||
|
||||
The cypress-rails gem is configured entirely via environment variables. If you
|
||||
find yourself repeating a number of verbose environment variables as you run
|
||||
your tests, consider invoking the gem from a custom script or setting your
|
||||
preferred environment variables project-wide using a tool like
|
||||
[dotenv](https://github.com/bkeepers/dotenv).
|
||||
|
||||
|
||||
* **CYPRESS_RAILS_DIR** (default: `Dir.pwd`) the directory of your project
|
||||
* **CYPRESS_RAILS_HOST** (default: `"127.0.0.1"`) the hostname to bind to
|
||||
* **CYPRESS_RAILS_PORT** (default: _a random available port_) the port to run
|
||||
the Rails test server on
|
||||
* **CYPRESS_RAILS_BASE_PATH** (default: `"/"`) the base path for all Cypress's
|
||||
requests to the app (e.g. via `cy.visit()`). If you've customized your
|
||||
`baseUrl` setting (e.g. in `cypress.json`), you'll need to duplicate it with
|
||||
this environment variable
|
||||
* **CYPRESS_RAILS_TRANSACTIONAL_SERVER** (default: `true`) when true, will start
|
||||
a transaction on all database connections before launching the server. In
|
||||
general this means anything done during `cypress open` or `cypress run` will
|
||||
be rolled back on exit (similar to running a Rails System test)
|
||||
* **CYPRESS_RAILS_CYPRESS_OPTS** (default: _none_) any options you want to
|
||||
forward to the Cypress CLI when running its `open` or `run` commands.
|
||||
|
||||
#### Example: Running a single spec from the command line
|
||||
|
||||
It's a little verbose, but an example of using the above options to run a single
|
||||
Cypress test would look like this:
|
||||
|
||||
```
|
||||
$ CYPRESS_RAILS_CYPRESS_OPTS="--spec cypress/integration/a_test.js" bin/rake cypress:run
|
||||
```
|
||||
|
||||
#### Example: Running your tests in Chromium
|
||||
|
||||
By default, Cypress will run its tests in its packaged Electron app, unless you've configured it globally. To choose which browser it will run from the command line, try this:
|
||||
|
||||
```
|
||||
$ CYPRESS_RAILS_CYPRESS_OPTS="--browser chromium" bin/rake cypress:run
|
||||
```
|
||||
|
||||
### Initializer hooks
|
||||
|
||||
### before_server_start
|
||||
|
||||
Pass a block to `CypressRails.hooks.before_server_start` to register a hook that
|
||||
will execute before the server or any transaction has been started. If you use
|
||||
Rails fixtures, it may make sense to load them here, so they don't need to be
|
||||
re-inserted for each request
|
||||
|
||||
### after_server_start
|
||||
|
||||
Pass a block to `CypressRails.hooks.after_server_start` to register a hook that
|
||||
will execute after the server has booted.
|
||||
|
||||
### after_transaction_start
|
||||
|
||||
If there's any custom behavior or state management you want to do inside the
|
||||
transaction (so that it's also rolled back each time a reset is triggered),
|
||||
pass a block to `CypressRails.hooks.after_transaction_start`.
|
||||
|
||||
### after_state_reset
|
||||
|
||||
Every time the test server receives an HTTP request at
|
||||
`/cypress_rails_reset_state`, the transaction will be rolled back (if
|
||||
`CYPRESS_RAILS_TRANSACTIONAL_SERVER` is enabled) and the `after_state_reset`
|
||||
hook will be triggered. To set up the hook, pass a block to
|
||||
`CypressRails.hooks.after_state_reset`.
|
||||
|
||||
### before_server_stop
|
||||
|
||||
In case you've made any permanent changes to your test database that could
|
||||
pollute other test suites or scripts, you can use the `before_server_stop` to
|
||||
(assuming everything exits gracefully) clean things up and restore the state
|
||||
of your test database. To set up the hook, pass a block to
|
||||
`CypressRails.hooks.before_server_stop`.
|
||||
|
||||
## Configuring Rails
|
||||
|
||||
Beyond the configuration options above, you'll probably also want to disable caching
|
||||
in your Rails app's [config/environments/test.rb](/example/config/environments/test.rb#L9)
|
||||
file, so that changes to your Ruby code are reflected in your tests while you
|
||||
work on them with `rake cypress:open`. (If either option is set to
|
||||
`true`, any changes to your Ruby code will require a server restart to be reflected as you work
|
||||
on your tests.)
|
||||
|
||||
To illustrate, here's what that might look like in `config/environments/test.rb`:
|
||||
|
||||
```ruby
|
||||
config.cache_classes = false
|
||||
config.action_view.cache_template_loading = false
|
||||
```
|
||||
|
||||
## Setting up continuous integration
|
||||
|
||||
#### Circle CI
|
||||
|
||||
Nowadays, Cypress and Circle get along pretty well without much customization.
|
||||
The only tricky bit is that Cypress will install its large-ish binary to
|
||||
`~/.cache/Cypress`, so if you cache your dependencies, you'll want to include
|
||||
that path:
|
||||
|
||||
```yml
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: circleci/ruby:2.6-node-browsers
|
||||
- image: circleci/postgres:9.4.12-alpine
|
||||
environment:
|
||||
POSTGRES_USER: circleci
|
||||
steps:
|
||||
- checkout
|
||||
|
||||
# Bundle install dependencies
|
||||
- type: cache-restore
|
||||
key: v1-gems-{{ checksum "Gemfile.lock" }}
|
||||
|
||||
- run: bundle install --path vendor/bundle
|
||||
|
||||
- type: cache-save
|
||||
key: v1-gems-{{ checksum "Gemfile.lock" }}
|
||||
paths:
|
||||
- vendor/bundle
|
||||
|
||||
# Yarn dependencies
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-yarn-{{ checksum "yarn.lock" }}
|
||||
# fallback to using the latest cache if no exact match is found
|
||||
- v1-yarn-
|
||||
|
||||
- run: yarn install
|
||||
|
||||
- save_cache:
|
||||
paths:
|
||||
- node_modules
|
||||
- ~/.cache
|
||||
key: v1-yarn-{{ checksum "yarn.lock" }}
|
||||
|
||||
# Run your cypress tests
|
||||
- run: bin/rake cypress:run
|
||||
```
|
||||
|
||||
## Why use this?
|
||||
|
||||
Rails ships with a perfectly competent browser-testing facility called [system
|
||||
tests](https://guides.rubyonrails.org/testing.html#system-testing) which depend
|
||||
on [capybara](https://github.com/teamcapybara/capybara) to drive your tests,
|
||||
most often with [Selenium](https://www.seleniumhq.org). All of these tools work,
|
||||
are used by lots of people, and are a perfectly reasonable choice when writing
|
||||
full-stack tests of your Rails application.
|
||||
|
||||
So why would you go off the Rails to use Cypress and this gem, adding two
|
||||
additional layers to the Jenga tower of testing facilities that Rails ships
|
||||
with? Really, it comes down to the potential for an improved development
|
||||
experience. In particular:
|
||||
|
||||
* Cypress's [IDE-like `open`
|
||||
command](https://docs.cypress.io/guides/getting-started/writing-your-first-test.html#Add-a-test-file)
|
||||
provides a highly visual, interactive, inspectable test runner. Not only can
|
||||
you watch each test run and read the commands as they're executed, Cypress
|
||||
takes a DOM snapshot before and after each command, which makes rewinding and
|
||||
inspecting the state of the DOM trivially easy, something that I regularly
|
||||
find myself losing 20 minutes attempting to do with Capybara
|
||||
* `cypress open` enables an almost REPL-like feedback loop that is much faster
|
||||
and more information dense than using Capybara and Selenium. Rather than
|
||||
running a test from the command line, seeing it fail, then adding a debug
|
||||
breakpoint to a test to try to manipulate the browser or tweaking a call to a
|
||||
Capybara API method, failures tend to be rather obvious when using Cypress and
|
||||
fixing it is usually as easy as tweaking a command, hitting save, and watching
|
||||
it re-run
|
||||
* With very few exceptions, a Cypress test that works in a browser window will
|
||||
also pass when run headlessly in CI
|
||||
* Cypress selectors are [just jQuery
|
||||
selectors](https://api.jquery.com/category/selectors/), which makes them both
|
||||
more familiar and more powerful than the CSS and XPath selectors offered by
|
||||
Capybara. Additionally, Cypress makes it very easy to drop into a plain
|
||||
synchronous JavaScript function for [making more complex
|
||||
assertions](https://docs.cypress.io/guides/references/assertions.html#Should-callback)
|
||||
or composing repetitive tasks into [custom
|
||||
commands](https://docs.cypress.io/api/cypress-api/custom-commands.html#Syntax#article)
|
||||
* Cypress commands are, generally, much faster than analogous tasks in Selenium.
|
||||
Where certain clicks and form inputs will hang for 300-500ms for seemingly no
|
||||
reason when running against Selenium WebDriver, Cypress commands tend to run
|
||||
as fast as jQuery can select and fill an element (which is, of course, pretty
|
||||
fast)
|
||||
* By default, Cypress [takes a
|
||||
video](https://docs.cypress.io/guides/guides/screenshots-and-videos.html#Screenshots#article)
|
||||
of every headless test run, taking a lot of the mystery (and subsequent
|
||||
analysis & debugging) out of test failures in CI
|
||||
|
||||
Nevertheless, there are trade-offs to attempting this (most notably around
|
||||
Cypress's [limited browser
|
||||
support](https://docs.cypress.io/guides/guides/launching-browsers.html#Browsers)
|
||||
and the complications to test data management), and I wouldn't recommend
|
||||
adopting Cypress and writing a bunch of browser tests for every application.
|
||||
But, if the above points sound like solutions to problems you experience, you
|
||||
might consider trying it out.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
This project follows Test Double's [code of
|
||||
conduct](https://testdouble.com/code-of-conduct) for all community interactions,
|
||||
including (but not limited to) one-on-one communications, public posts/comments,
|
||||
code reviews, pull requests, and GitHub issues. If violations occur, Test Double
|
||||
will take any action they deem appropriate for the infraction, up to and
|
||||
including blocking a user from the organization's repositories.
|
||||
|
||||
11
vendor/cache/cypress-rails-3b89de0823ce/Rakefile
vendored
11
vendor/cache/cypress-rails-3b89de0823ce/Rakefile
vendored
|
|
@ -1,11 +0,0 @@
|
|||
require "bundler/gem_tasks"
|
||||
require "rake/testtask"
|
||||
require "standard/rake"
|
||||
|
||||
Rake::TestTask.new(:test) do |t|
|
||||
t.libs << "test"
|
||||
t.libs << "lib"
|
||||
t.test_files = FileList["test/**/*_test.rb"]
|
||||
end
|
||||
|
||||
task default: [:test, "standard:fix"]
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require "bundler/setup"
|
||||
require "cypress-rails"
|
||||
|
||||
# You can add fixtures and/or initialization code here to make experimenting
|
||||
# with your gem easier. You can also use a different console, if you like.
|
||||
|
||||
# (If you use this, don't forget to add pry to your Gemfile!)
|
||||
# require "pry"
|
||||
# Pry.start
|
||||
|
||||
require "irb"
|
||||
IRB.start(__FILE__)
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
set -vx
|
||||
|
||||
bundle install
|
||||
|
||||
# Do any other automated setup that you need to do here
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: cypress-rails 0.5.3 ruby lib
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "cypress-rails".freeze
|
||||
s.version = "0.5.3"
|
||||
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
||||
s.require_paths = ["lib".freeze]
|
||||
s.authors = ["Justin Searls".freeze]
|
||||
s.bindir = "exe".freeze
|
||||
s.date = "2021-10-22"
|
||||
s.email = ["searls@gmail.com".freeze]
|
||||
s.executables = ["cypress-rails".freeze]
|
||||
s.files = [".github/workflows/main.yml".freeze, ".gitignore".freeze, ".standard.yml".freeze, ".travis.yml".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "Gemfile.lock".freeze, "LICENSE.txt".freeze, "README.md".freeze, "Rakefile".freeze, "bin/console".freeze, "bin/setup".freeze, "cypress-rails.gemspec".freeze, "exe/cypress-rails".freeze, "lib/cypress-rails.rb".freeze, "lib/cypress-rails/config.rb".freeze, "lib/cypress-rails/env.rb".freeze, "lib/cypress-rails/finds_bin.rb".freeze, "lib/cypress-rails/init.rb".freeze, "lib/cypress-rails/initializer_hooks.rb".freeze, "lib/cypress-rails/launches_cypress.rb".freeze, "lib/cypress-rails/manages_transactions.rb".freeze, "lib/cypress-rails/open.rb".freeze, "lib/cypress-rails/railtie.rb".freeze, "lib/cypress-rails/rake.rb".freeze, "lib/cypress-rails/resets_state.rb".freeze, "lib/cypress-rails/run.rb".freeze, "lib/cypress-rails/run_knapsack.rb".freeze, "lib/cypress-rails/server.rb".freeze, "lib/cypress-rails/server/checker.rb".freeze, "lib/cypress-rails/server/middleware.rb".freeze, "lib/cypress-rails/server/puma.rb".freeze, "lib/cypress-rails/server/timer.rb".freeze, "lib/cypress-rails/starts_rails_server.rb".freeze, "lib/cypress-rails/tracks_resets.rb".freeze, "lib/cypress-rails/version.rb".freeze, "script/test".freeze, "script/test_example_app".freeze]
|
||||
s.homepage = "https://github.com/testdouble/cypress-rails".freeze
|
||||
s.licenses = ["MIT".freeze]
|
||||
s.rubygems_version = "3.2.22".freeze
|
||||
s.summary = "Helps you write Cypress tests of your Rails app".freeze
|
||||
|
||||
s.installed_by_version = "3.2.22" if s.respond_to? :installed_by_version
|
||||
|
||||
if s.respond_to? :specification_version then
|
||||
s.specification_version = 4
|
||||
end
|
||||
|
||||
if s.respond_to? :add_runtime_dependency then
|
||||
s.add_runtime_dependency(%q<railties>.freeze, [">= 5.2.0"])
|
||||
s.add_runtime_dependency(%q<puma>.freeze, [">= 3.8.0"])
|
||||
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
||||
s.add_development_dependency(%q<rake>.freeze, ["~> 13.0"])
|
||||
s.add_development_dependency(%q<minitest>.freeze, ["~> 5.0"])
|
||||
s.add_development_dependency(%q<standard>.freeze, [">= 0.2.0"])
|
||||
else
|
||||
s.add_dependency(%q<railties>.freeze, [">= 5.2.0"])
|
||||
s.add_dependency(%q<puma>.freeze, [">= 3.8.0"])
|
||||
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
||||
s.add_dependency(%q<rake>.freeze, ["~> 13.0"])
|
||||
s.add_dependency(%q<minitest>.freeze, ["~> 5.0"])
|
||||
s.add_dependency(%q<standard>.freeze, [">= 0.2.0"])
|
||||
end
|
||||
end
|
||||
|
|
@ -1 +0,0 @@
|
|||
defaults
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
||||
#
|
||||
# If you find yourself ignoring temporary files generated by your text editor
|
||||
# or operating system, you probably want to add a global ignore instead:
|
||||
# git config --global core.excludesfile '~/.gitignore_global'
|
||||
|
||||
# Ignore bundler config.
|
||||
/.bundle
|
||||
|
||||
# Ignore the default SQLite database.
|
||||
/db/*.sqlite3
|
||||
/db/*.sqlite3-journal
|
||||
|
||||
# Ignore all logfiles and tempfiles.
|
||||
/log/*
|
||||
/tmp/*
|
||||
|
||||
|
||||
/public/assets
|
||||
.byebug_history
|
||||
|
||||
# Ignore master key for decrypting credentials and more.
|
||||
/config/master.key
|
||||
|
||||
/public/packs
|
||||
/public/packs-test
|
||||
/node_modules
|
||||
/yarn-error.log
|
||||
yarn-debug.log*
|
||||
.yarn-integrity
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
gem "rails"
|
||||
gem "sqlite3"
|
||||
gem "puma"
|
||||
gem "webpacker"
|
||||
gem "bootsnap", require: false
|
||||
|
||||
group :development, :test do
|
||||
gem "cypress-rails", path: ".."
|
||||
end
|
||||
|
|
@ -1,164 +0,0 @@
|
|||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
cypress-rails (0.5.3)
|
||||
puma (>= 3.8.0)
|
||||
railties (>= 5.2.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
activejob (= 6.1.4)
|
||||
activerecord (= 6.1.4)
|
||||
activestorage (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
actionview (= 6.1.4)
|
||||
activejob (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.1.4)
|
||||
actionview (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
rack (~> 2.0, >= 2.0.9)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
activerecord (= 6.1.4)
|
||||
activestorage (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
activejob (6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
activerecord (6.1.4)
|
||||
activemodel (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
activestorage (6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
activejob (= 6.1.4)
|
||||
activerecord (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
marcel (~> 1.0.0)
|
||||
mini_mime (>= 1.1.0)
|
||||
activesupport (6.1.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
zeitwerk (~> 2.3)
|
||||
bootsnap (1.7.5)
|
||||
msgpack (~> 1.0)
|
||||
builder (3.2.4)
|
||||
concurrent-ruby (1.1.9)
|
||||
crass (1.0.6)
|
||||
erubi (1.10.0)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
i18n (1.8.10)
|
||||
concurrent-ruby (~> 1.0)
|
||||
loofah (2.10.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
marcel (1.0.1)
|
||||
method_source (1.0.0)
|
||||
mini_mime (1.1.0)
|
||||
mini_portile2 (2.5.3)
|
||||
minitest (5.14.4)
|
||||
msgpack (1.4.2)
|
||||
nio4r (2.5.7)
|
||||
nokogiri (1.11.7)
|
||||
mini_portile2 (~> 2.5.0)
|
||||
racc (~> 1.4)
|
||||
puma (5.3.2)
|
||||
nio4r (~> 2.0)
|
||||
racc (1.5.2)
|
||||
rack (2.2.3)
|
||||
rack-proxy (0.7.0)
|
||||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (6.1.4)
|
||||
actioncable (= 6.1.4)
|
||||
actionmailbox (= 6.1.4)
|
||||
actionmailer (= 6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
actiontext (= 6.1.4)
|
||||
actionview (= 6.1.4)
|
||||
activejob (= 6.1.4)
|
||||
activemodel (= 6.1.4)
|
||||
activerecord (= 6.1.4)
|
||||
activestorage (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 6.1.4)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
railties (6.1.4)
|
||||
actionpack (= 6.1.4)
|
||||
activesupport (= 6.1.4)
|
||||
method_source
|
||||
rake (>= 0.13)
|
||||
thor (~> 1.0)
|
||||
rake (13.0.4)
|
||||
semantic_range (3.0.0)
|
||||
sprockets (4.0.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.2)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.4.2)
|
||||
thor (1.1.0)
|
||||
tzinfo (2.0.4)
|
||||
concurrent-ruby (~> 1.0)
|
||||
webpacker (5.4.0)
|
||||
activesupport (>= 5.2)
|
||||
rack-proxy (>= 0.6.1)
|
||||
railties (>= 5.2)
|
||||
semantic_range (>= 2.3.0)
|
||||
websocket-driver (0.7.5)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
zeitwerk (2.4.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
bootsnap
|
||||
cypress-rails!
|
||||
puma
|
||||
rails
|
||||
sqlite3
|
||||
webpacker
|
||||
|
||||
BUNDLED WITH
|
||||
2.2.15
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# README
|
||||
|
||||
This README would normally document whatever steps are necessary to get the
|
||||
application up and running.
|
||||
|
||||
Things you may want to cover:
|
||||
|
||||
* Ruby version
|
||||
|
||||
* System dependencies
|
||||
|
||||
* Configuration
|
||||
|
||||
* Database creation
|
||||
|
||||
* Database initialization
|
||||
|
||||
* How to run the test suite
|
||||
|
||||
* Services (job queues, cache servers, search engines, etc.)
|
||||
|
||||
* Deployment instructions
|
||||
|
||||
* ...
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require_relative "config/application"
|
||||
|
||||
Rails.application.load_tasks
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
//= link_tree ../images
|
||||
//= link_directory ../stylesheets .css
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
*
|
||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
|
||||
* vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
||||
* files in this directory. Styles in this file should be added after the last require_* statement.
|
||||
* It is generally better to create a new file per style scope.
|
||||
*
|
||||
*= require_tree .
|
||||
*= require_self
|
||||
*/
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
class ComplimentsController < ApplicationController
|
||||
def index
|
||||
@compliments = Compliment.all
|
||||
end
|
||||
|
||||
def update
|
||||
Compliment.find(params[:id]).update!(params[:compliment].permit(:text))
|
||||
flash[:saved] = true
|
||||
redirect_to compliments_path
|
||||
end
|
||||
end
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
class FormsController < ApplicationController
|
||||
def static
|
||||
end
|
||||
end
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
class StaticPagesController < ApplicationController
|
||||
def external
|
||||
end
|
||||
end
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
module ApplicationHelper
|
||||
end
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// This file is automatically compiled by Webpack, along with any other files
|
||||
// present in this directory. You're encouraged to place your actual application logic in
|
||||
// a relevant structure within app/javascript and only use these pack files to reference
|
||||
// that code so it'll be compiled.
|
||||
|
||||
require("@rails/ujs").start()
|
||||
|
||||
|
||||
// Uncomment to copy all static images under ../images to the output folder and reference
|
||||
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
|
||||
// or the `imagePath` JavaScript helper below.
|
||||
//
|
||||
// const images = require.context('../images', true)
|
||||
// const imagePath = (name) => images(name, true)
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
class ApplicationJob < ActiveJob::Base
|
||||
# Automatically retry jobs that encountered a deadlock
|
||||
# retry_on ActiveRecord::Deadlocked
|
||||
|
||||
# Most jobs are safe to ignore if the underlying records are no longer available
|
||||
# discard_on ActiveJob::DeserializationError
|
||||
end
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
class Compliment < ApplicationRecord
|
||||
end
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<h1>Compliments Time!</h1>
|
||||
<% if flash[:saved] %>
|
||||
<div>Yay, you saved a compliment!</div>
|
||||
<% end %>
|
||||
<% @compliments.each.with_index do |compliment, i| %>
|
||||
<%= form_with model: compliment, local: true do |f| %>
|
||||
<%= f.text_field :text %>
|
||||
<%= f.submit "Save #{i + 1}" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<form>
|
||||
<div>
|
||||
<label for=name>Name</label>
|
||||
<input type=text id=name name=name>
|
||||
</div>
|
||||
<div>
|
||||
<label for=age>Age</label>
|
||||
<select id=age name=age>
|
||||
<option value="0">0-10</option>
|
||||
<option value="10">10-20</option>
|
||||
<option value="20">20-30</option>
|
||||
<option value="30">30-40</option>
|
||||
<option value="40">40-50</option>
|
||||
<option value="50">50-60</option>
|
||||
<option value="60">60+</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for=tool>Favorite tool</label>
|
||||
|
||||
<input name=tool id=tool type=radio value=capybara>Capybara</input>
|
||||
<input name=tool id=tool type=radio value=cypress>Cypress</input>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>AnApp</title>
|
||||
<%= csrf_meta_tags %>
|
||||
<%= csp_meta_tag %>
|
||||
|
||||
<%= javascript_pack_tag 'application' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= yield %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
<h1>Getting external compliments!</h1>
|
||||
|
||||
<script type="text/javascript">
|
||||
fetch('http://127.0.0.1:8080/compliment.json')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
// create a new div element
|
||||
const newDiv = document.createElement("div");
|
||||
|
||||
// and give it some content
|
||||
const newContent = document.createTextNode(data.complimentText);
|
||||
|
||||
// add the text node to the newly created div
|
||||
newDiv.appendChild(newContent);
|
||||
newDiv.id = 'external_compliment';
|
||||
|
||||
// add the newly created element and its content into the DOM
|
||||
document.body.append(newDiv);
|
||||
})
|
||||
.catch((e) => { console.log(e) })
|
||||
</script>
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
module.exports = function(api) {
|
||||
var validEnv = ['development', 'test', 'production']
|
||||
var currentEnv = api.env()
|
||||
var isDevelopmentEnv = api.env('development')
|
||||
var isProductionEnv = api.env('production')
|
||||
var isTestEnv = api.env('test')
|
||||
|
||||
if (!validEnv.includes(currentEnv)) {
|
||||
throw new Error(
|
||||
'Please specify a valid `NODE_ENV` or ' +
|
||||
'`BABEL_ENV` environment variables. Valid values are "development", ' +
|
||||
'"test", and "production". Instead, received: ' +
|
||||
JSON.stringify(currentEnv) +
|
||||
'.'
|
||||
)
|
||||
}
|
||||
|
||||
return {
|
||||
presets: [
|
||||
isTestEnv && [
|
||||
require('@babel/preset-env').default,
|
||||
{
|
||||
targets: {
|
||||
node: 'current'
|
||||
}
|
||||
}
|
||||
],
|
||||
(isProductionEnv || isDevelopmentEnv) && [
|
||||
require('@babel/preset-env').default,
|
||||
{
|
||||
forceAllTransforms: true,
|
||||
useBuiltIns: 'entry',
|
||||
corejs: 3,
|
||||
modules: false,
|
||||
exclude: ['transform-typeof-symbol']
|
||||
}
|
||||
]
|
||||
].filter(Boolean),
|
||||
plugins: [
|
||||
require('babel-plugin-macros'),
|
||||
require('@babel/plugin-syntax-dynamic-import').default,
|
||||
isTestEnv && require('babel-plugin-dynamic-import-node'),
|
||||
require('@babel/plugin-transform-destructuring').default,
|
||||
[
|
||||
require('@babel/plugin-proposal-class-properties').default,
|
||||
{
|
||||
loose: true
|
||||
}
|
||||
],
|
||||
[
|
||||
require('@babel/plugin-proposal-object-rest-spread').default,
|
||||
{
|
||||
useBuiltIns: true
|
||||
}
|
||||
],
|
||||
[
|
||||
require('@babel/plugin-transform-runtime').default,
|
||||
{
|
||||
helpers: false,
|
||||
regenerator: true,
|
||||
corejs: false
|
||||
}
|
||||
],
|
||||
[
|
||||
require('@babel/plugin-transform-regenerator').default,
|
||||
{
|
||||
async: false
|
||||
}
|
||||
]
|
||||
].filter(Boolean)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file was generated by Bundler.
|
||||
#
|
||||
# The application 'bundle' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
require "rubygems"
|
||||
|
||||
m = Module.new {
|
||||
module_function
|
||||
|
||||
def invoked_as_script?
|
||||
File.expand_path($0) == File.expand_path(__FILE__)
|
||||
end
|
||||
|
||||
def env_var_version
|
||||
ENV["BUNDLER_VERSION"]
|
||||
end
|
||||
|
||||
def cli_arg_version
|
||||
return unless invoked_as_script? # don't want to hijack other binstubs
|
||||
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
||||
bundler_version = nil
|
||||
update_index = nil
|
||||
ARGV.each_with_index do |a, i|
|
||||
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
||||
bundler_version = a
|
||||
end
|
||||
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/o
|
||||
bundler_version = $1 || ">= 0.a"
|
||||
update_index = i
|
||||
end
|
||||
bundler_version
|
||||
end
|
||||
|
||||
def gemfile
|
||||
gemfile = ENV["BUNDLE_GEMFILE"]
|
||||
return gemfile if gemfile && !gemfile.empty?
|
||||
|
||||
File.expand_path("../../Gemfile", __FILE__)
|
||||
end
|
||||
|
||||
def lockfile
|
||||
lockfile =
|
||||
case File.basename(gemfile)
|
||||
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
||||
else "#{gemfile}.lock"
|
||||
end
|
||||
File.expand_path(lockfile)
|
||||
end
|
||||
|
||||
def lockfile_version
|
||||
return unless File.file?(lockfile)
|
||||
lockfile_contents = File.read(lockfile)
|
||||
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/o
|
||||
Regexp.last_match(1)
|
||||
end
|
||||
|
||||
def bundler_version
|
||||
@bundler_version ||= env_var_version || cli_arg_version ||
|
||||
lockfile_version || "#{Gem::Requirement.default}.a"
|
||||
end
|
||||
|
||||
def load_bundler!
|
||||
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
||||
|
||||
# must dup string for RG < 1.8 compatibility
|
||||
activate_bundler(bundler_version.dup)
|
||||
end
|
||||
|
||||
def activate_bundler(bundler_version)
|
||||
if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
|
||||
bundler_version = "< 2"
|
||||
end
|
||||
gem_error = activation_error_handling {
|
||||
gem "bundler", bundler_version
|
||||
}
|
||||
return if gem_error.nil?
|
||||
require_error = activation_error_handling {
|
||||
require "bundler/version"
|
||||
}
|
||||
return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
||||
warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
|
||||
exit 42
|
||||
end
|
||||
|
||||
def activation_error_handling
|
||||
yield
|
||||
nil
|
||||
rescue StandardError, LoadError => e
|
||||
e
|
||||
end
|
||||
}
|
||||
|
||||
m.load_bundler!
|
||||
|
||||
if m.invoked_as_script?
|
||||
load Gem.bin_path("bundler", "bundle")
|
||||
end
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
APP_PATH = File.expand_path("../config/application", __dir__)
|
||||
require_relative "../config/boot"
|
||||
require "rails/commands"
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
require_relative "../config/boot"
|
||||
require "rake"
|
||||
Rake.application.run
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
require "fileutils"
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = File.expand_path("..", __dir__)
|
||||
|
||||
def system!(*args)
|
||||
system(*args) || abort("\n== Command #{args} failed ==")
|
||||
end
|
||||
|
||||
FileUtils.chdir APP_ROOT do
|
||||
# This script is a way to setup or update your development environment automatically.
|
||||
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
|
||||
# Add necessary setup steps to this file.
|
||||
|
||||
puts "== Installing dependencies =="
|
||||
system! "gem install bundler --conservative"
|
||||
system("bundle check") || system!("bundle install")
|
||||
|
||||
# Install JavaScript dependencies
|
||||
# system('bin/yarn')
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
# unless File.exist?('config/database.yml')
|
||||
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
||||
# end
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
system! "bin/rails db:prepare"
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! "bin/rails log:clear tmp:clear"
|
||||
|
||||
puts "\n== Restarting application server =="
|
||||
system! "bin/rails restart"
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
||||
ENV["NODE_ENV"] ||= "development"
|
||||
|
||||
require "pathname"
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||
Pathname.new(__FILE__).realpath)
|
||||
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
|
||||
require "webpacker"
|
||||
require "webpacker/webpack_runner"
|
||||
|
||||
APP_ROOT = File.expand_path("..", __dir__)
|
||||
Dir.chdir(APP_ROOT) do
|
||||
Webpacker::WebpackRunner.run(ARGV)
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
||||
ENV["NODE_ENV"] ||= "development"
|
||||
|
||||
require "pathname"
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||
Pathname.new(__FILE__).realpath)
|
||||
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
|
||||
require "webpacker"
|
||||
require "webpacker/dev_server_runner"
|
||||
|
||||
APP_ROOT = File.expand_path("..", __dir__)
|
||||
Dir.chdir(APP_ROOT) do
|
||||
Webpacker::DevServerRunner.run(ARGV)
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
APP_ROOT = File.expand_path("..", __dir__)
|
||||
Dir.chdir(APP_ROOT) do
|
||||
exec "yarnpkg", *ARGV
|
||||
rescue Errno::ENOENT
|
||||
warn "Yarn executable was not detected in the system."
|
||||
warn "Download Yarn at https://yarnpkg.com/en/docs/install"
|
||||
exit 1
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require_relative "config/environment"
|
||||
|
||||
run Rails.application
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
require_relative "boot"
|
||||
|
||||
require "rails"
|
||||
# Pick the frameworks you want:
|
||||
require "active_model/railtie"
|
||||
require "active_job/railtie"
|
||||
require "active_record/railtie"
|
||||
# require "active_storage/engine"
|
||||
require "action_controller/railtie"
|
||||
# require "action_mailer/railtie"
|
||||
# require "action_mailbox/engine"
|
||||
# require "action_text/engine"
|
||||
require "action_view/railtie"
|
||||
# require "action_cable/engine"
|
||||
# require "sprockets/railtie"
|
||||
require "rails/test_unit/railtie"
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
Bundler.require(*Rails.groups)
|
||||
|
||||
module AnApp
|
||||
class Application < Rails::Application
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 6.0
|
||||
|
||||
# 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.
|
||||
end
|
||||
end
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
|
||||
require "bundler/setup" # Set up gems listed in the Gemfile.
|
||||
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
|
||||
|
|
@ -1 +0,0 @@
|
|||
DJUkGRhh6Rx8q45jPHT1XsYpoNMz4ChMViVWSQZeto7oDh7zxPH0BnBy2jEq19FEw4pZQEOuoXFLNAxKj18u6cCFP+VhqhLXGBXvUaDTsc8mqGaUVWcHhQEhN8lyATemUguh+ZTd3/v07qkQRl5MST1qYfXVfRKrXOwFo084Z6uGtE5Gg/AoxC6s4i9Um29XlM17b7kol0tixUAhlOgL3NZYBqAWYivJIG2atRGbro2CSTQvNg+Fub7ibLx8M2v10/t/dP1R3/2+XYBOpr1ESCLh1HAZakK2/PJ9yQmHnMvRUAizFq0z1l6u3T4mYJY4lkdUTZkV36JHhlcn+mQ5eFRVv2w1TjtfsfoM9k/xSm2l6gmwtX6zi6SRHJdU9ziYIh/FIHIwdeILbkgyREs2bGwd4iURmWV/42Wn--U0kLZtq9WUWGspje--xvmf+T8cQhknKYgByMWVQw==
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# SQLite. Versions 3.8.0 and up are supported.
|
||||
# gem install sqlite3
|
||||
#
|
||||
# Ensure the SQLite 3 gem is defined in your Gemfile
|
||||
# gem 'sqlite3'
|
||||
#
|
||||
default: &default
|
||||
adapter: sqlite3
|
||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
||||
timeout: 5000
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
database: db/development.sqlite3
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
test:
|
||||
<<: *default
|
||||
database: db/test.sqlite3
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
database: db/production.sqlite3
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# Load the Rails application.
|
||||
require_relative "application"
|
||||
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# In the development environment your application's code is reloaded on
|
||||
# every request. This slows down response time but is perfect for development
|
||||
# since you don't have to restart the web server when you make code changes.
|
||||
config.cache_classes = false
|
||||
|
||||
# Do not eager load code on boot.
|
||||
config.eager_load = false
|
||||
|
||||
# Show full error reports.
|
||||
config.consider_all_requests_local = true
|
||||
|
||||
# Enable/disable caching. By default caching is disabled.
|
||||
# Run rails dev:cache to toggle caching.
|
||||
if Rails.root.join("tmp", "caching-dev.txt").exist?
|
||||
config.action_controller.perform_caching = true
|
||||
config.action_controller.enable_fragment_cache_logging = true
|
||||
|
||||
config.cache_store = :memory_store
|
||||
config.public_file_server.headers = {
|
||||
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
||||
}
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
config.cache_store = :null_store
|
||||
end
|
||||
|
||||
# Print deprecation notices to the Rails logger.
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Raise an error on page load if there are pending migrations.
|
||||
config.active_record.migration_error = :page_load
|
||||
|
||||
# Highlight code that triggered database queries in logs.
|
||||
config.active_record.verbose_query_logs = true
|
||||
|
||||
# Raises error for missing translations.
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
||||
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||
# routes, locales, etc. This feature depends on the listen gem.
|
||||
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||
end
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# Code is not reloaded between requests.
|
||||
config.cache_classes = true
|
||||
|
||||
# Eager load code on boot. This eager loads most of Rails and
|
||||
# your application in memory, allowing both threaded web servers
|
||||
# and those relying on copy on write to perform better.
|
||||
# Rake tasks automatically ignore this option for performance.
|
||||
config.eager_load = true
|
||||
|
||||
# Full error reports are disabled and caching is turned on.
|
||||
config.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
||||
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
||||
# config.require_master_key = true
|
||||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
# config.force_ssl = true
|
||||
|
||||
# Use the lowest log level to ensure availability of diagnostic information
|
||||
# when problems arise.
|
||||
config.log_level = :debug
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
config.log_tags = [:request_id]
|
||||
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment).
|
||||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_name_prefix = "an_app_production"
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation cannot be found).
|
||||
config.i18n.fallbacks = true
|
||||
|
||||
# Send deprecation notices to registered listeners.
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||
config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
# Use a different logger for distributed setups.
|
||||
# require 'syslog/logger'
|
||||
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
||||
|
||||
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
||||
logger = ActiveSupport::Logger.new($stdout)
|
||||
logger.formatter = config.log_formatter
|
||||
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
||||
end
|
||||
|
||||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
|
||||
# Inserts middleware to perform automatic connection switching.
|
||||
# The `database_selector` hash is used to pass options to the DatabaseSelector
|
||||
# middleware. The `delay` is used to determine how long to wait after a write
|
||||
# to send a subsequent read to the primary.
|
||||
#
|
||||
# The `database_resolver` class is used by the middleware to determine which
|
||||
# database is appropriate to use based on the time delay.
|
||||
#
|
||||
# The `database_resolver_context` class is used by the middleware to set
|
||||
# timestamps for the last write to the primary. The resolver uses the context
|
||||
# class timestamps to determine how long to wait before reading from the
|
||||
# replica.
|
||||
#
|
||||
# By default Rails will store a last write timestamp in the session. The
|
||||
# DatabaseSelector middleware is designed as such you can define your own
|
||||
# strategy for connection switching and pass that into the middleware through
|
||||
# these configuration options.
|
||||
# config.active_record.database_selector = { delay: 2.seconds }
|
||||
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
|
||||
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
|
||||
end
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# The test environment is used exclusively to run your application's
|
||||
# test suite. You never need to work with it otherwise. Remember that
|
||||
# your test database is "scratch space" for the test suite and is wiped
|
||||
# and recreated between test runs. Don't rely on the data there!
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
config.cache_classes = false
|
||||
|
||||
# Do not eager load code on boot. This avoids loading your whole application
|
||||
# just for the purpose of running a single test. If you are using a tool that
|
||||
# preloads Rails for running tests, you may have to set it to true.
|
||||
config.eager_load = false
|
||||
|
||||
# Configure public file server for tests with Cache-Control for performance.
|
||||
config.public_file_server.enabled = true
|
||||
config.public_file_server.headers = {
|
||||
"Cache-Control" => "public, max-age=3600"
|
||||
}
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
config.cache_store = :null_store
|
||||
|
||||
# Raise exceptions instead of rendering exception templates.
|
||||
config.action_dispatch.show_exceptions = false
|
||||
|
||||
# Disable request forgery protection in test environment.
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
|
||||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
# Raises error for missing translations.
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
end
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# ActiveSupport::Reloader.to_prepare do
|
||||
# ApplicationController.renderer.defaults.merge!(
|
||||
# http_host: 'example.org',
|
||||
# https: false
|
||||
# )
|
||||
# end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||
|
||||
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||
# Rails.backtrace_cleaner.remove_silencers!
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Define an application-wide content security policy
|
||||
# For further information see the following documentation
|
||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
||||
|
||||
# Rails.application.config.content_security_policy do |policy|
|
||||
# policy.default_src :self, :https
|
||||
# policy.font_src :self, :https, :data
|
||||
# policy.img_src :self, :https, :data
|
||||
# policy.object_src :none
|
||||
# policy.script_src :self, :https
|
||||
# policy.style_src :self, :https
|
||||
# # If you are using webpack-dev-server then specify webpack-dev-server host
|
||||
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
|
||||
|
||||
# # Specify URI for violation reports
|
||||
# # policy.report_uri "/csp-violation-report-endpoint"
|
||||
# end
|
||||
|
||||
# If you are using UJS then enable automatic nonce generation
|
||||
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
||||
|
||||
# Set the nonce only to specific directives
|
||||
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
|
||||
|
||||
# Report CSP violations to a specified URI
|
||||
# For further information see the following documentation:
|
||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
||||
# Rails.application.config.content_security_policy_report_only = true
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Specify a serializer for the signed and encrypted cookie jars.
|
||||
# Valid options are :json, :marshal, and :hybrid.
|
||||
Rails.application.config.action_dispatch.cookies_serializer = :json
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
return unless Rails.env.test?
|
||||
require "./lib/external_service"
|
||||
|
||||
Rails.application.load_tasks unless defined?(Rake::Task)
|
||||
|
||||
CypressRails.hooks.before_server_start do
|
||||
# Add our fixtures before the resettable transaction is started
|
||||
Rake::Task["db:fixtures:load"].invoke
|
||||
end
|
||||
|
||||
CypressRails.hooks.after_server_start do
|
||||
# After the server has booted we add the compliment to the existing fixture list!
|
||||
Compliment.create(text: "This shall be the first.")
|
||||
if Compliment.count == 4
|
||||
raise "I cannot run tests without compliments!"
|
||||
end
|
||||
|
||||
# Start up external service
|
||||
ExternalService.start_service
|
||||
end
|
||||
|
||||
CypressRails.hooks.after_transaction_start do
|
||||
# After each transaction, add this compliment (will be rolled back on reset)
|
||||
Compliment.create(text: "You are courageous")
|
||||
end
|
||||
|
||||
CypressRails.hooks.after_state_reset do
|
||||
if Compliment.count != 4
|
||||
raise "Wait I was expecting exactly 4 compliments!"
|
||||
end
|
||||
end
|
||||
|
||||
CypressRails.hooks.before_server_stop do
|
||||
# Purge and reload the test database so we don't leave our fixtures in there
|
||||
Rake::Task["db:test:prepare"].invoke
|
||||
end
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Configure sensitive parameters which will be filtered from the log file.
|
||||
Rails.application.config.filter_parameters += [:password]
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new inflection rules using the following format. Inflections
|
||||
# are locale specific, and you may define rules for as many different
|
||||
# locales as you wish. All of these examples are active by default:
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.plural /^(ox)$/i, '\1en'
|
||||
# inflect.singular /^(ox)en/i, '\1'
|
||||
# inflect.irregular 'person', 'people'
|
||||
# inflect.uncountable %w( fish sheep )
|
||||
# end
|
||||
|
||||
# These inflection rules are supported but not enabled by default:
|
||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||
# inflect.acronym 'RESTful'
|
||||
# end
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# This file contains settings for ActionController::ParamsWrapper which
|
||||
# is enabled by default.
|
||||
|
||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
wrap_parameters format: [:json]
|
||||
end
|
||||
|
||||
# To enable root element in JSON for ActiveRecord objects.
|
||||
# ActiveSupport.on_load(:active_record) do
|
||||
# self.include_root_in_json = true
|
||||
# end
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
# Files in the config/locales directory are used for internationalization
|
||||
# and are automatically loaded by Rails. If you want to use locales other
|
||||
# than English, add the necessary files in this directory.
|
||||
#
|
||||
# To use the locales, use `I18n.t`:
|
||||
#
|
||||
# I18n.t 'hello'
|
||||
#
|
||||
# In views, this is aliased to just `t`:
|
||||
#
|
||||
# <%= t('hello') %>
|
||||
#
|
||||
# To use a different locale, set it with `I18n.locale`:
|
||||
#
|
||||
# I18n.locale = :es
|
||||
#
|
||||
# This would use the information in config/locales/es.yml.
|
||||
#
|
||||
# The following keys must be escaped otherwise they will not be retrieved by
|
||||
# the default I18n backend:
|
||||
#
|
||||
# true, false, on, off, yes, no
|
||||
#
|
||||
# Instead, surround them with single quotes.
|
||||
#
|
||||
# en:
|
||||
# 'true': 'foo'
|
||||
#
|
||||
# To learn more, please read the Rails Internationalization guide
|
||||
# available at https://guides.rubyonrails.org/i18n.html.
|
||||
|
||||
en:
|
||||
hello: "Hello world"
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# Puma can serve each request in a thread from an internal thread pool.
|
||||
# The `threads` method setting takes two numbers: a minimum and maximum.
|
||||
# Any libraries that use thread pools should be configured to match
|
||||
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
||||
# and maximum; this matches the default thread size of Active Record.
|
||||
#
|
||||
max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 5)
|
||||
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
|
||||
threads min_threads_count, max_threads_count
|
||||
|
||||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
||||
#
|
||||
port ENV.fetch("PORT", 3000)
|
||||
|
||||
# Specifies the `environment` that Puma will run in.
|
||||
#
|
||||
environment ENV.fetch("RAILS_ENV") { "development" }
|
||||
|
||||
# Specifies the `pidfile` that Puma will use.
|
||||
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
|
||||
|
||||
# Specifies the number of `workers` to boot in clustered mode.
|
||||
# Workers are forked web server processes. If using threads and workers together
|
||||
# the concurrency of the application would be max `threads` * `workers`.
|
||||
# Workers do not work on JRuby or Windows (both of which do not support
|
||||
# processes).
|
||||
#
|
||||
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
||||
|
||||
# Use the `preload_app!` method when specifying a `workers` number.
|
||||
# This directive tells Puma to first boot the application and load code
|
||||
# before forking the application. This takes advantage of Copy On Write
|
||||
# process behavior so workers use less memory.
|
||||
#
|
||||
# preload_app!
|
||||
|
||||
# Allow puma to be restarted by `rails restart` command.
|
||||
plugin :tmp_restart
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
Rails.application.routes.draw do
|
||||
get "/an_static_form", to: "forms#static"
|
||||
get "/external_request", to: "static_pages#external"
|
||||
|
||||
resources :compliments
|
||||
|
||||
root "compliments#index"
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||
|
||||
const environment = require('./environment')
|
||||
|
||||
module.exports = environment.toWebpackConfig()
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
const { environment } = require('@rails/webpacker')
|
||||
|
||||
module.exports = environment
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
|
||||
|
||||
const environment = require('./environment')
|
||||
|
||||
module.exports = environment.toWebpackConfig()
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||
|
||||
const environment = require('./environment')
|
||||
|
||||
module.exports = environment.toWebpackConfig()
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
||||
|
||||
default: &default
|
||||
source_path: app/javascript
|
||||
source_entry_path: packs
|
||||
public_root_path: public
|
||||
public_output_path: packs
|
||||
cache_path: tmp/cache/webpacker
|
||||
check_yarn_integrity: false
|
||||
webpack_compile_output: false
|
||||
|
||||
# Additional paths webpack should lookup modules
|
||||
# ['app/assets', 'engine/foo/app/assets']
|
||||
resolved_paths: []
|
||||
|
||||
# Reload manifest.json on all requests so we reload latest compiled packs
|
||||
cache_manifest: false
|
||||
|
||||
# Extract and emit a css file
|
||||
extract_css: false
|
||||
|
||||
static_assets_extensions:
|
||||
- .jpg
|
||||
- .jpeg
|
||||
- .png
|
||||
- .gif
|
||||
- .tiff
|
||||
- .ico
|
||||
- .svg
|
||||
- .eot
|
||||
- .otf
|
||||
- .ttf
|
||||
- .woff
|
||||
- .woff2
|
||||
|
||||
extensions:
|
||||
- .mjs
|
||||
- .js
|
||||
- .sass
|
||||
- .scss
|
||||
- .css
|
||||
- .module.sass
|
||||
- .module.scss
|
||||
- .module.css
|
||||
- .png
|
||||
- .svg
|
||||
- .gif
|
||||
- .jpeg
|
||||
- .jpg
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
compile: true
|
||||
|
||||
# Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
|
||||
check_yarn_integrity: true
|
||||
|
||||
# Reference: https://webpack.js.org/configuration/dev-server/
|
||||
dev_server:
|
||||
https: false
|
||||
host: localhost
|
||||
port: 3035
|
||||
public: localhost:3035
|
||||
hmr: false
|
||||
# Inline should be set to true if using HMR
|
||||
inline: true
|
||||
overlay: true
|
||||
compress: true
|
||||
disable_host_check: true
|
||||
use_local_ip: false
|
||||
quiet: false
|
||||
headers:
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
watch_options:
|
||||
ignored: '**/node_modules/**'
|
||||
|
||||
|
||||
test:
|
||||
<<: *default
|
||||
compile: true
|
||||
|
||||
# Compile test packs to a separate directory
|
||||
public_output_path: packs-test
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
|
||||
# Production depends on precompilation of packs prior to booting for performance.
|
||||
compile: false
|
||||
|
||||
# Extract and emit a css file
|
||||
extract_css: true
|
||||
|
||||
# Cache manifest.json for performance
|
||||
cache_manifest: true
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"screenshotsFolder": "tmp/cypress_screenshots",
|
||||
"trashAssetsBeforeRuns": false,
|
||||
"videosFolder": "tmp/cypress_videos"
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
describe('Compliments', () => {
|
||||
beforeEach(() => {
|
||||
cy.request('/cypress_rails_reset_state')
|
||||
cy.visit('/compliments')
|
||||
})
|
||||
|
||||
it('renders 3 fixtures + 1 custom compliment', () => {
|
||||
cy.get('input[value="You make cool things"]')
|
||||
cy.get('input[value="You are very kind"]')
|
||||
cy.get('input[value="You motivate others"]')
|
||||
cy.get('input[value="You are courageous"]')
|
||||
})
|
||||
|
||||
it('lets me edit the compliments', () => {
|
||||
cy.get('input[value="You are very kind"]').clear().type('You are SUPER kind{enter}')
|
||||
|
||||
// Shows a confirmation
|
||||
cy.contains('Yay, you saved a compliment!')
|
||||
|
||||
// Shows the input with the new value
|
||||
cy.get('input[value="You are very kind"]').should('not.exist')
|
||||
cy.get('input[value="You are SUPER kind"]')
|
||||
})
|
||||
|
||||
it('resets the compliments between each test case', () => {
|
||||
// Make sure the original compliment is still here
|
||||
cy.get('input[value="You are SUPER kind"]').should('not.exist')
|
||||
cy.get('input[value="You are very kind"]')
|
||||
|
||||
// Still shows all 4 compliments
|
||||
cy.get('input[type=text]').should('have.length', 4)
|
||||
})
|
||||
|
||||
})
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
describe('External Service', () => {
|
||||
it('Fetches data from an external, running server', () => {
|
||||
cy.visit('/external_request');
|
||||
cy.get('#external_compliment').should(
|
||||
'have.text',
|
||||
'Wow, look at you fetch data!'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
/// <reference types="Cypress" />
|
||||
context('Static HTML with no database stuff', () => {
|
||||
it('Fills a form', () => {
|
||||
cy.visit('/an_static_form')
|
||||
cy.get('#name').type('Human Person')
|
||||
cy.get('#age').select('30-40')
|
||||
cy.get('input[value=cypress]').check()
|
||||
|
||||
cy.get('#name').should('have.value', 'Human Person')
|
||||
cy.get('#age').should('have.value', '30')
|
||||
cy.get('input[value=cypress]').should('be.checked')
|
||||
})
|
||||
})
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/// <reference types="cypress" />
|
||||
// ***********************************************************
|
||||
// This example plugins/index.js can be used to load plugins
|
||||
//
|
||||
// You can change the location of this file or turn off loading
|
||||
// the plugins file with the 'pluginsFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/plugins-guide
|
||||
// ***********************************************************
|
||||
|
||||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
|
||||
/**
|
||||
* @type {Cypress.PluginConfig}
|
||||
*/
|
||||
module.exports = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
class CreateCompliments < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :compliments do |t|
|
||||
t.string :text
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +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 `rails
|
||||
# db:schema:load`. When creating a new database, `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: 2020_03_04_023531) do
|
||||
create_table "compliments", force: :cascade do |t|
|
||||
t.string "text"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
||||
# Character.create(name: 'Luke', movie: movies.first)
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"complimentText": "Wow, look at you fetch data!"
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
class ExternalService
|
||||
class << self
|
||||
def start_service
|
||||
@job_pid = fork {
|
||||
exec "yarn start"
|
||||
}
|
||||
Process.detach(@job_pid)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"name": "an_app",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "http-server external_service --cors"
|
||||
},
|
||||
"dependencies": {
|
||||
"@rails/ujs": "^6.0.0-alpha",
|
||||
"@rails/webpacker": "5.4.0",
|
||||
"http-server": "^0.12.3"
|
||||
},
|
||||
"version": "0.1.0",
|
||||
"devDependencies": {
|
||||
"cypress": "7.6.0",
|
||||
"webpack-dev-server": "^3.8.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
module.exports = {
|
||||
plugins: [
|
||||
require('postcss-import'),
|
||||
require('postcss-flexbugs-fixes'),
|
||||
require('postcss-preset-env')({
|
||||
autoprefixer: {
|
||||
flexbox: 'no-2009'
|
||||
},
|
||||
stage: 3
|
||||
})
|
||||
]
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The page you were looking for doesn't exist (404)</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<style>
|
||||
.rails-default-error-page {
|
||||
background-color: #EFEFEF;
|
||||
color: #2E2F30;
|
||||
text-align: center;
|
||||
font-family: arial, sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.rails-default-error-page div.dialog {
|
||||
width: 95%;
|
||||
max-width: 33em;
|
||||
margin: 4em auto 0;
|
||||
}
|
||||
|
||||
.rails-default-error-page div.dialog > div {
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #BBB;
|
||||
border-top: #B00100 solid 4px;
|
||||
border-top-left-radius: 9px;
|
||||
border-top-right-radius: 9px;
|
||||
background-color: white;
|
||||
padding: 7px 12% 0;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
|
||||
.rails-default-error-page h1 {
|
||||
font-size: 100%;
|
||||
color: #730E15;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.rails-default-error-page div.dialog > p {
|
||||
margin: 0 0 1em;
|
||||
padding: 1em;
|
||||
background-color: #F7F7F7;
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #999;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-top-color: #DADADA;
|
||||
color: #666;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="rails-default-error-page">
|
||||
<!-- This file lives in public/404.html -->
|
||||
<div class="dialog">
|
||||
<div>
|
||||
<h1>The page you were looking for doesn't exist.</h1>
|
||||
<p>You may have mistyped the address or the page may have moved.</p>
|
||||
</div>
|
||||
<p>If you are the application owner check the logs for more information.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The change you wanted was rejected (422)</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<style>
|
||||
.rails-default-error-page {
|
||||
background-color: #EFEFEF;
|
||||
color: #2E2F30;
|
||||
text-align: center;
|
||||
font-family: arial, sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.rails-default-error-page div.dialog {
|
||||
width: 95%;
|
||||
max-width: 33em;
|
||||
margin: 4em auto 0;
|
||||
}
|
||||
|
||||
.rails-default-error-page div.dialog > div {
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #BBB;
|
||||
border-top: #B00100 solid 4px;
|
||||
border-top-left-radius: 9px;
|
||||
border-top-right-radius: 9px;
|
||||
background-color: white;
|
||||
padding: 7px 12% 0;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
|
||||
.rails-default-error-page h1 {
|
||||
font-size: 100%;
|
||||
color: #730E15;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.rails-default-error-page div.dialog > p {
|
||||
margin: 0 0 1em;
|
||||
padding: 1em;
|
||||
background-color: #F7F7F7;
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #999;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-top-color: #DADADA;
|
||||
color: #666;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="rails-default-error-page">
|
||||
<!-- This file lives in public/422.html -->
|
||||
<div class="dialog">
|
||||
<div>
|
||||
<h1>The change you wanted was rejected.</h1>
|
||||
<p>Maybe you tried to change something you didn't have access to.</p>
|
||||
</div>
|
||||
<p>If you are the application owner check the logs for more information.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>We're sorry, but something went wrong (500)</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<style>
|
||||
.rails-default-error-page {
|
||||
background-color: #EFEFEF;
|
||||
color: #2E2F30;
|
||||
text-align: center;
|
||||
font-family: arial, sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.rails-default-error-page div.dialog {
|
||||
width: 95%;
|
||||
max-width: 33em;
|
||||
margin: 4em auto 0;
|
||||
}
|
||||
|
||||
.rails-default-error-page div.dialog > div {
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #BBB;
|
||||
border-top: #B00100 solid 4px;
|
||||
border-top-left-radius: 9px;
|
||||
border-top-right-radius: 9px;
|
||||
background-color: white;
|
||||
padding: 7px 12% 0;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
|
||||
.rails-default-error-page h1 {
|
||||
font-size: 100%;
|
||||
color: #730E15;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.rails-default-error-page div.dialog > p {
|
||||
margin: 0 0 1em;
|
||||
padding: 1em;
|
||||
background-color: #F7F7F7;
|
||||
border: 1px solid #CCC;
|
||||
border-right-color: #999;
|
||||
border-left-color: #999;
|
||||
border-bottom-color: #999;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-top-color: #DADADA;
|
||||
color: #666;
|
||||
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="rails-default-error-page">
|
||||
<!-- This file lives in public/500.html -->
|
||||
<div class="dialog">
|
||||
<div>
|
||||
<h1>We're sorry, but something went wrong.</h1>
|
||||
</div>
|
||||
<p>If you are the application owner check the logs for more information.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1 +0,0 @@
|
|||
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
require "test_helper"
|
||||
|
||||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
||||
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
|
||||
end
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
kind:
|
||||
text: "You are very kind"
|
||||
|
||||
creative:
|
||||
text: "You make cool things"
|
||||
|
||||
encouraging:
|
||||
text: "You motivate others"
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
ENV["RAILS_ENV"] ||= "test"
|
||||
require_relative "../config/environment"
|
||||
require "rails/test_help"
|
||||
|
||||
class ActiveSupport::TestCase
|
||||
# Run tests in parallel with specified workers
|
||||
parallelize(workers: :number_of_processors)
|
||||
|
||||
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
||||
fixtures :all
|
||||
|
||||
# Add more helper methods to be used by all tests here...
|
||||
end
|
||||
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue