├── .browserslistrc ├── .circleci └── config.yml ├── .env.sample ├── .github ├── PULL_REQUEST_TEMPLATE.md └── dependabot.yml ├── .gitignore ├── .node-version ├── .nvmrc ├── .raygun-version ├── .rspec ├── .rubocop.yml ├── .ruby-gemset ├── .ruby-version ├── Gemfile ├── Gemfile.lock ├── Procfile ├── README.md ├── Rakefile ├── app ├── assets │ └── README.md ├── controllers │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ └── pages_controller.rb ├── helpers │ └── application_helper.rb ├── javascript │ ├── channels │ │ ├── consumer.js │ │ └── index.js │ ├── packs │ │ └── application.js │ └── stylesheets │ │ ├── _buttons.scss │ │ ├── _colors.scss │ │ ├── _footer.scss │ │ ├── _header.scss │ │ ├── _layout.scss │ │ ├── _variables.scss │ │ └── application.scss ├── jobs │ └── application_job.rb ├── mailers │ ├── .keep │ └── application_mailer.rb ├── models │ ├── .keep │ ├── application_record.rb │ └── concerns │ │ └── .keep └── views │ ├── layouts │ └── application.html.slim │ └── pages │ └── root.html.slim ├── babel.config.js ├── bin ├── rails ├── rake ├── reset-acceptance-with-production-data.sh ├── reset-acceptance-with-sample-data.sh ├── reset-config.cfg ├── reset-development-with-production-data.sh ├── rspec ├── setup ├── webpack ├── webpack-dev-server └── yarn ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── application_controller_renderer.rb │ ├── backtrace_silencers.rb │ ├── content_security_policy.rb │ ├── cookies_serializer.rb │ ├── cors.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── permissions_policy.rb │ ├── session_store.rb │ ├── simple_form.rb │ └── wrap_parameters.rb ├── locales │ ├── en.yml │ └── simple_form.en.yml ├── puma.rb ├── routes.rb ├── secrets.yml ├── storage.yml ├── webpack │ ├── development.js │ ├── environment.js │ ├── production.js │ └── test.js └── webpacker.yml ├── db ├── sample_data.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep ├── tasks │ ├── .keep │ ├── auto_annotate_models.rake │ ├── coverage.rake │ ├── db.rake │ ├── rubocop.rake │ └── spec.rake └── templates │ ├── rails │ └── scaffold_controller │ │ └── controller.rb │ └── rspec │ ├── controller │ └── controller_spec.rb │ ├── model │ └── model_spec.rb │ └── scaffold │ └── controller_spec.rb ├── log └── .keep ├── package.json ├── postcss.config.js ├── public ├── 404.html ├── 422.html ├── 500.html ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── favicon.ico └── robots.txt ├── spec ├── controllers │ └── pages_controller_spec.rb ├── rails_helper.rb ├── spec_helper.rb ├── support │ ├── capybara.rb │ ├── factory_bot.rb │ ├── raise_on_js_errors.rb │ └── shoulda_matchers.rb └── system │ └── pages_spec.rb ├── vendor └── assets │ ├── javascripts │ └── .keep │ └── stylesheets │ └── .keep └── yarn.lock /.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | orbs: 3 | browser-tools: circleci/browser-tools@1.2.5 4 | node: circleci/node@5.0.2 5 | ruby: circleci/ruby@2.0.0 6 | 7 | executors: 8 | rails: 9 | docker: 10 | - image: cimg/ruby:3.1.3-browsers 11 | environment: 12 | BUNDLE_JOBS: 4 13 | BUNDLE_PATH: vendor/bundle 14 | PGHOST: 127.0.0.1 15 | PGUSER: postgres 16 | RAILS_ENV: test 17 | - image: cimg/postgres:14.2 18 | environment: 19 | POSTGRES_USER: postgres 20 | POSTGRES_DB: app_prototype_test 21 | POSTGRES_PASSWORD: "password" # Must be non-empty. 22 | 23 | commands: 24 | install-node-deps: 25 | description: Install Yarn and Node dependencies 26 | steps: 27 | - node/install: 28 | install-yarn: true 29 | node-version: "16.18.1" 30 | - node/install-packages: 31 | pkg-manager: yarn 32 | db-setup: 33 | description: Set up database 34 | steps: 35 | # Using structure.sql? Install postgresql-client for loading structure. 36 | #- run: sudo apt-get install postgresql-client 37 | - run: 38 | name: Set up database 39 | command: bundle exec rake db:create db:schema:load 40 | 41 | jobs: 42 | load_data: 43 | executor: rails 44 | steps: 45 | - checkout 46 | - ruby/install-deps 47 | - db-setup 48 | - run: 49 | # Ensure seeds run without issues 50 | name: Load seeds 51 | command: bin/rails db:seed 52 | - run: 53 | # Ensure sample_data runs without issues 54 | name: Load sample data 55 | command: bin/rails db:sample_data 56 | rubocop: 57 | executor: rails 58 | steps: 59 | - checkout 60 | - ruby/install-deps 61 | - ruby/rubocop-check 62 | rspec: 63 | executor: rails 64 | # Divide up specs and run them in parallel across multiple containers to mitigate slow tests 65 | # parallelism: 4 66 | steps: 67 | - checkout 68 | - browser-tools/install-chrome 69 | - browser-tools/install-chromedriver 70 | - ruby/install-deps 71 | - install-node-deps 72 | - db-setup 73 | - run: 74 | name: Precompile assets 75 | command: bin/rails assets:precompile 76 | - ruby/rspec-test 77 | - store_artifacts: 78 | # Save screenshots for debugging 79 | path: ./tmp/screenshots 80 | 81 | workflows: 82 | version: 2 83 | build: 84 | jobs: 85 | - load_data 86 | - rubocop 87 | - rspec 88 | -------------------------------------------------------------------------------- /.env.sample: -------------------------------------------------------------------------------- 1 | # Set environment variables needed for development here. These values will be 2 | # used unless they're already set. 3 | # 4 | # https://devcenter.heroku.com/articles/heroku-local#set-up-your-local-environment-variables 5 | 6 | PORT=3000 7 | RAILS_MAX_THREADS=5 8 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Problem 2 | ======= 3 | 4 | problem statement, including 5 | [link to Pivotal Tracker #12345678](https://www.pivotaltracker.com/story/show/12345678) 6 | 7 | Solution 8 | ======== 9 | 10 | What I/we did to solve this problem 11 | 12 | with @pairperson1 13 | 14 | Change summary 15 | -------------- 16 | 17 | * Tidy, well formulated commit message 18 | * Another great commit message 19 | * Something else I/we did 20 | 21 | Steps to Verify 22 | --------------- 23 | 24 | 1. A setup step / beginning state 25 | 1. What to do next 26 | 1. Any other instructions 27 | 1. Expected behavior 28 | 1. Suggestions for testing 29 | 30 | 31 | 32 | New Dependencies 33 | ---------------- 34 | 35 | Consider adding links to relevant listings from https://snyk.io or https://www.ruby-toolbox.com 36 | 37 | 38 | 39 | Accessibility Checks 40 | -------------------- 41 | 42 | - [ ] Text remains visible and feature is still functional even when browser is zoomed 200% 43 | - [ ] Feature is functional using purely keyboard-based interactions 44 | - [ ] Passes a Lighthouse audit (choose Lighthouse tab in Google Chrome devtools and run reports with **accessibility** selected, for both desktop and mobile) 45 | 46 | Screenshots 47 | ----------- 48 | 49 | Show-n-tell images/animations here 50 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: bundler 4 | directory: "/" 5 | schedule: 6 | interval: weekly 7 | day: thursday 8 | time: "12:30" 9 | timezone: America/Los_Angeles 10 | open-pull-requests-limit: 0 11 | versioning-strategy: increase-if-necessary 12 | - package-ecosystem: npm 13 | directory: "/" 14 | schedule: 15 | interval: weekly 16 | day: thursday 17 | time: "12:30" 18 | timezone: America/Los_Angeles 19 | open-pull-requests-limit: 0 20 | versioning-strategy: increase-if-necessary 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ingore application config. 11 | /.env 12 | /.env.*local 13 | 14 | # Ignore the default SQLite database. 15 | /db/*.sqlite3 16 | /db/*.sqlite3-journal 17 | 18 | # Ignore all logfiles and tempfiles. 19 | /log/* 20 | /tmp/* 21 | !/log/.keep 22 | !/tmp/.keep 23 | /.rubocop-* 24 | /yarn-error.log 25 | yarn-debug.log* 26 | .yarn-integrity 27 | 28 | # Ingore testing and debugging. 29 | /coverage/ 30 | /spec/examples.txt 31 | .byebug_history 32 | 33 | # Ignore uploaded files in development. 34 | /storage/* 35 | !/storage/.keep 36 | 37 | # Ignore compiled assets and node modules. 38 | /node_modules 39 | /public/assets 40 | /public/packs 41 | /public/packs-test 42 | 43 | # Ignore master key for decrypting credentials and more. 44 | /config/master.key 45 | 46 | # Ignore editor metadata. 47 | .idea/ 48 | .DS_Store 49 | *~ 50 | -------------------------------------------------------------------------------- /.node-version: -------------------------------------------------------------------------------- 1 | 16.18.1 2 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | .node-version -------------------------------------------------------------------------------- /.raygun-version: -------------------------------------------------------------------------------- 1 | 1.1.1 2 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_from: 2 | - https://raw.githubusercontent.com/carbonfive/c5-conventions/main/rubocop/.rubocop-common.yml 3 | - https://raw.githubusercontent.com/carbonfive/c5-conventions/main/rubocop/.rubocop-performance.yml 4 | - https://raw.githubusercontent.com/carbonfive/c5-conventions/main/rubocop/.rubocop-rails.yml 5 | - https://raw.githubusercontent.com/carbonfive/c5-conventions/main/rubocop/.rubocop-rspec.yml 6 | 7 | require: 8 | - rubocop-performance 9 | - rubocop-rails 10 | - rubocop-rspec 11 | -------------------------------------------------------------------------------- /.ruby-gemset: -------------------------------------------------------------------------------- 1 | app-prototype 2 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 3.1.3 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 | 4 | # Heroku uses the ruby version to configure your application"s runtime. 5 | ruby "3.1.3" 6 | 7 | gem "amazing_print" 8 | gem "bootsnap", require: false 9 | gem "pg" 10 | gem "puma", "~> 5.6" # Rails doesn't yet support puma 6 as of rails 7.0 11 | gem "rack-canonical-host" 12 | gem "rails", "~> 7.0.3" 13 | gem "simple_form" 14 | gem "slim-rails" 15 | gem "webpacker" 16 | # gem "webpacker-react" 17 | 18 | # Env specific dependencies... 19 | group :production do 20 | gem "rack-timeout" 21 | end 22 | 23 | group :development, :test do 24 | gem "byebug" 25 | gem "factory_bot_rails" 26 | gem "rspec_junit_formatter", require: false 27 | gem "rspec-rails" 28 | gem "rubocop", require: false 29 | gem "rubocop-performance", require: false 30 | gem "rubocop-rails", require: false 31 | gem "rubocop-rspec", require: false 32 | end 33 | 34 | group :development do 35 | gem "annotate" 36 | gem "better_errors" 37 | gem "binding_of_caller" 38 | gem "dotenv-rails" 39 | gem "launchy" 40 | end 41 | 42 | group :test do 43 | gem "capybara" 44 | # gem "capybara-email" 45 | gem "selenium-webdriver" 46 | gem "shoulda-matchers" 47 | gem "simplecov" 48 | gem "webdrivers" 49 | end 50 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actioncable (7.0.4) 5 | actionpack (= 7.0.4) 6 | activesupport (= 7.0.4) 7 | nio4r (~> 2.0) 8 | websocket-driver (>= 0.6.1) 9 | actionmailbox (7.0.4) 10 | actionpack (= 7.0.4) 11 | activejob (= 7.0.4) 12 | activerecord (= 7.0.4) 13 | activestorage (= 7.0.4) 14 | activesupport (= 7.0.4) 15 | mail (>= 2.7.1) 16 | net-imap 17 | net-pop 18 | net-smtp 19 | actionmailer (7.0.4) 20 | actionpack (= 7.0.4) 21 | actionview (= 7.0.4) 22 | activejob (= 7.0.4) 23 | activesupport (= 7.0.4) 24 | mail (~> 2.5, >= 2.5.4) 25 | net-imap 26 | net-pop 27 | net-smtp 28 | rails-dom-testing (~> 2.0) 29 | actionpack (7.0.4) 30 | actionview (= 7.0.4) 31 | activesupport (= 7.0.4) 32 | rack (~> 2.0, >= 2.2.0) 33 | rack-test (>= 0.6.3) 34 | rails-dom-testing (~> 2.0) 35 | rails-html-sanitizer (~> 1.0, >= 1.2.0) 36 | actiontext (7.0.4) 37 | actionpack (= 7.0.4) 38 | activerecord (= 7.0.4) 39 | activestorage (= 7.0.4) 40 | activesupport (= 7.0.4) 41 | globalid (>= 0.6.0) 42 | nokogiri (>= 1.8.5) 43 | actionview (7.0.4) 44 | activesupport (= 7.0.4) 45 | builder (~> 3.1) 46 | erubi (~> 1.4) 47 | rails-dom-testing (~> 2.0) 48 | rails-html-sanitizer (~> 1.1, >= 1.2.0) 49 | activejob (7.0.4) 50 | activesupport (= 7.0.4) 51 | globalid (>= 0.3.6) 52 | activemodel (7.0.4) 53 | activesupport (= 7.0.4) 54 | activerecord (7.0.4) 55 | activemodel (= 7.0.4) 56 | activesupport (= 7.0.4) 57 | activestorage (7.0.4) 58 | actionpack (= 7.0.4) 59 | activejob (= 7.0.4) 60 | activerecord (= 7.0.4) 61 | activesupport (= 7.0.4) 62 | marcel (~> 1.0) 63 | mini_mime (>= 1.1.0) 64 | activesupport (7.0.4) 65 | concurrent-ruby (~> 1.0, >= 1.0.2) 66 | i18n (>= 1.6, < 2) 67 | minitest (>= 5.1) 68 | tzinfo (~> 2.0) 69 | addressable (2.8.1) 70 | public_suffix (>= 2.0.2, < 6.0) 71 | amazing_print (1.4.0) 72 | annotate (3.2.0) 73 | activerecord (>= 3.2, < 8.0) 74 | rake (>= 10.4, < 14.0) 75 | ast (2.4.2) 76 | better_errors (2.9.1) 77 | coderay (>= 1.0.0) 78 | erubi (>= 1.0.0) 79 | rack (>= 0.9.0) 80 | binding_of_caller (1.0.0) 81 | debug_inspector (>= 0.0.1) 82 | bootsnap (1.14.0) 83 | msgpack (~> 1.2) 84 | builder (3.2.4) 85 | byebug (11.1.3) 86 | capybara (3.38.0) 87 | addressable 88 | matrix 89 | mini_mime (>= 0.1.3) 90 | nokogiri (~> 1.8) 91 | rack (>= 1.6.0) 92 | rack-test (>= 0.6.3) 93 | regexp_parser (>= 1.5, < 3.0) 94 | xpath (~> 3.2) 95 | childprocess (4.1.0) 96 | coderay (1.1.3) 97 | concurrent-ruby (1.1.10) 98 | crass (1.0.6) 99 | debug_inspector (1.1.0) 100 | diff-lcs (1.5.0) 101 | docile (1.4.0) 102 | dotenv (2.8.1) 103 | dotenv-rails (2.8.1) 104 | dotenv (= 2.8.1) 105 | railties (>= 3.2) 106 | erubi (1.11.0) 107 | factory_bot (6.2.1) 108 | activesupport (>= 5.0.0) 109 | factory_bot_rails (6.2.0) 110 | factory_bot (~> 6.2.0) 111 | railties (>= 5.0.0) 112 | globalid (1.0.0) 113 | activesupport (>= 5.0) 114 | i18n (1.12.0) 115 | concurrent-ruby (~> 1.0) 116 | json (2.6.2) 117 | launchy (2.5.0) 118 | addressable (~> 2.7) 119 | loofah (2.19.0) 120 | crass (~> 1.0.2) 121 | nokogiri (>= 1.5.9) 122 | mail (2.7.1) 123 | mini_mime (>= 0.1.1) 124 | marcel (1.0.2) 125 | matrix (0.4.2) 126 | method_source (1.0.0) 127 | mini_mime (1.1.2) 128 | mini_portile2 (2.8.0) 129 | minitest (5.16.3) 130 | msgpack (1.6.0) 131 | net-imap (0.3.1) 132 | net-protocol 133 | net-pop (0.1.2) 134 | net-protocol 135 | net-protocol (0.1.3) 136 | timeout 137 | net-smtp (0.3.3) 138 | net-protocol 139 | nio4r (2.5.8) 140 | nokogiri (1.13.9) 141 | mini_portile2 (~> 2.8.0) 142 | racc (~> 1.4) 143 | parallel (1.22.1) 144 | parser (3.1.2.1) 145 | ast (~> 2.4.1) 146 | pg (1.4.5) 147 | public_suffix (5.0.0) 148 | puma (5.6.5) 149 | nio4r (~> 2.0) 150 | racc (1.6.0) 151 | rack (2.2.4) 152 | rack-canonical-host (1.1.0) 153 | addressable (> 0, < 3) 154 | rack (>= 1.0.0, < 3) 155 | rack-proxy (0.7.4) 156 | rack 157 | rack-test (2.0.2) 158 | rack (>= 1.3) 159 | rack-timeout (0.6.3) 160 | rails (7.0.4) 161 | actioncable (= 7.0.4) 162 | actionmailbox (= 7.0.4) 163 | actionmailer (= 7.0.4) 164 | actionpack (= 7.0.4) 165 | actiontext (= 7.0.4) 166 | actionview (= 7.0.4) 167 | activejob (= 7.0.4) 168 | activemodel (= 7.0.4) 169 | activerecord (= 7.0.4) 170 | activestorage (= 7.0.4) 171 | activesupport (= 7.0.4) 172 | bundler (>= 1.15.0) 173 | railties (= 7.0.4) 174 | rails-dom-testing (2.0.3) 175 | activesupport (>= 4.2.0) 176 | nokogiri (>= 1.6) 177 | rails-html-sanitizer (1.4.3) 178 | loofah (~> 2.3) 179 | railties (7.0.4) 180 | actionpack (= 7.0.4) 181 | activesupport (= 7.0.4) 182 | method_source 183 | rake (>= 12.2) 184 | thor (~> 1.0) 185 | zeitwerk (~> 2.5) 186 | rainbow (3.1.1) 187 | rake (13.0.6) 188 | regexp_parser (2.6.1) 189 | rexml (3.2.5) 190 | rspec-core (3.12.0) 191 | rspec-support (~> 3.12.0) 192 | rspec-expectations (3.12.0) 193 | diff-lcs (>= 1.2.0, < 2.0) 194 | rspec-support (~> 3.12.0) 195 | rspec-mocks (3.12.0) 196 | diff-lcs (>= 1.2.0, < 2.0) 197 | rspec-support (~> 3.12.0) 198 | rspec-rails (6.0.1) 199 | actionpack (>= 6.1) 200 | activesupport (>= 6.1) 201 | railties (>= 6.1) 202 | rspec-core (~> 3.11) 203 | rspec-expectations (~> 3.11) 204 | rspec-mocks (~> 3.11) 205 | rspec-support (~> 3.11) 206 | rspec-support (3.12.0) 207 | rspec_junit_formatter (0.6.0) 208 | rspec-core (>= 2, < 4, != 2.12.0) 209 | rubocop (1.39.0) 210 | json (~> 2.3) 211 | parallel (~> 1.10) 212 | parser (>= 3.1.2.1) 213 | rainbow (>= 2.2.2, < 4.0) 214 | regexp_parser (>= 1.8, < 3.0) 215 | rexml (>= 3.2.5, < 4.0) 216 | rubocop-ast (>= 1.23.0, < 2.0) 217 | ruby-progressbar (~> 1.7) 218 | unicode-display_width (>= 1.4.0, < 3.0) 219 | rubocop-ast (1.23.0) 220 | parser (>= 3.1.1.0) 221 | rubocop-performance (1.15.1) 222 | rubocop (>= 1.7.0, < 2.0) 223 | rubocop-ast (>= 0.4.0) 224 | rubocop-rails (2.17.3) 225 | activesupport (>= 4.2.0) 226 | rack (>= 1.1) 227 | rubocop (>= 1.33.0, < 2.0) 228 | rubocop-rspec (2.15.0) 229 | rubocop (~> 1.33) 230 | ruby-progressbar (1.11.0) 231 | rubyzip (2.3.2) 232 | selenium-webdriver (4.6.1) 233 | childprocess (>= 0.5, < 5.0) 234 | rexml (~> 3.2, >= 3.2.5) 235 | rubyzip (>= 1.2.2, < 3.0) 236 | websocket (~> 1.0) 237 | semantic_range (3.0.0) 238 | shoulda-matchers (5.2.0) 239 | activesupport (>= 5.2.0) 240 | simple_form (5.1.0) 241 | actionpack (>= 5.2) 242 | activemodel (>= 5.2) 243 | simplecov (0.21.2) 244 | docile (~> 1.1) 245 | simplecov-html (~> 0.11) 246 | simplecov_json_formatter (~> 0.1) 247 | simplecov-html (0.12.3) 248 | simplecov_json_formatter (0.1.4) 249 | slim (4.1.0) 250 | temple (>= 0.7.6, < 0.9) 251 | tilt (>= 2.0.6, < 2.1) 252 | slim-rails (3.5.1) 253 | actionpack (>= 3.1) 254 | railties (>= 3.1) 255 | slim (>= 3.0, < 5.0) 256 | temple (0.8.2) 257 | thor (1.2.1) 258 | tilt (2.0.11) 259 | timeout (0.3.0) 260 | tzinfo (2.0.5) 261 | concurrent-ruby (~> 1.0) 262 | unicode-display_width (2.3.0) 263 | webdrivers (5.2.0) 264 | nokogiri (~> 1.6) 265 | rubyzip (>= 1.3.0) 266 | selenium-webdriver (~> 4.0) 267 | webpacker (5.4.3) 268 | activesupport (>= 5.2) 269 | rack-proxy (>= 0.6.1) 270 | railties (>= 5.2) 271 | semantic_range (>= 2.3.0) 272 | websocket (1.2.9) 273 | websocket-driver (0.7.5) 274 | websocket-extensions (>= 0.1.0) 275 | websocket-extensions (0.1.5) 276 | xpath (3.2.0) 277 | nokogiri (~> 1.8) 278 | zeitwerk (2.6.6) 279 | 280 | PLATFORMS 281 | ruby 282 | 283 | DEPENDENCIES 284 | amazing_print 285 | annotate 286 | better_errors 287 | binding_of_caller 288 | bootsnap 289 | byebug 290 | capybara 291 | dotenv-rails 292 | factory_bot_rails 293 | launchy 294 | pg 295 | puma (~> 5.6) 296 | rack-canonical-host 297 | rack-timeout 298 | rails (~> 7.0.3) 299 | rspec-rails 300 | rspec_junit_formatter 301 | rubocop 302 | rubocop-performance 303 | rubocop-rails 304 | rubocop-rspec 305 | selenium-webdriver 306 | shoulda-matchers 307 | simple_form 308 | simplecov 309 | slim-rails 310 | webdrivers 311 | webpacker 312 | 313 | RUBY VERSION 314 | ruby 3.1.3 315 | 316 | BUNDLED WITH 317 | 2.3.11 318 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec puma -C config/puma.rb 2 | #worker: bundle exec rake jobs:work 3 | release: bundle exec rake db:migrate db:seed 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # App Prototype 2 | 3 | ... 4 | 5 | Generated with [Raygun](https://github.com/carbonfive/raygun). 6 | 7 | # Development 8 | 9 | ## Getting Started 10 | 11 | ### Requirements 12 | 13 | To run the specs or fire up the server, be sure you have these installed (and running): 14 | 15 | * Ruby 3.0 (see [.ruby-version](.ruby-version)). 16 | * Node 16 (see [.node-version](.node-version)). 17 | * Yarn 1.x (`npm install -g yarn`). 18 | * PostgreSQL 14+. (`brew install postgresql@14`). 19 | 20 | To manage deployments you will need: 21 | 22 | * Heroku CLI (`brew install heroku`). 23 | 24 | It is strongly recommended that you use a version manager like [rbenv](https://github.com/rbenv/rbenv) (for Ruby), [nvm](https://github.com/nvm-sh/nvm) or [nodenv](https://github.com/nodenv/nodenv) (for Node), or [asdf](https://asdf-vm.com/) (for both) to ensure the correct Ruby and Node versions. 25 | 26 | ### First Time Setup 27 | 28 | #### `bin/setup` 29 | 30 | After cloning, run [./bin/setup](bin/setup) to install missing gems and prepare the database. 31 | 32 | Note, `rake db:sample_data` (run as part of setup) loads a small set of data for development. Check out 33 | [db/sample_data.rb](db/sample_data.rb) for details. 34 | 35 | #### `.env` 36 | 37 | The `bin/setup` script will create a `.env` file that defines settings for your local environment. Do not check this into source control. Refer to the [environment variables](#environment-variables) section below for what can be specified in `.env`. 38 | 39 | ### Running the Specs 40 | 41 | To run all Ruby and Javascript specs. 42 | 43 | $ ./bin/rake 44 | 45 | Note: `./bin/rake` runs the bundled version of rake (there's a `./bin/rspec` and `./bin/rails` too). You can add 46 | `./bin` to your PATH too, then you'll always use the correct version of these scripts as enforced by the `Gemfile.lock`. 47 | 48 | ### Running the Application Locally 49 | 50 | The easiest way to run the app is using `yarn start`. This starts all the processes needed for development, including the Rails server and the webpack dev server. See `package.json` for details. 51 | 52 | 53 | $ yarn start 54 | 55 | The app will then be accessible at . 56 | 57 | ### Webpack Dev Server 58 | 59 | By default, webpacker will compile assets on demand. In other words, you don’t need to precompile all assets ahead of time — webpacker lazily compiles assets it has not served yet. However, you will need to manually reload your browser to see new changes when you edit an asset. 60 | 61 | Alternatively, for live code reloading, you can run `./bin/webpack-dev-server` in a separate terminal from `rails s`. This done for you automatically if you use `yarn start` to run the app. Asset requests are proxied to the dev server, and it will automatically refresh your browser when it detects changes to the pack. 62 | 63 | If you stop the dev server, Rails automatically reverts back to on-demand compilation. 64 | 65 | ## Conventions 66 | 67 | ### Git 68 | 69 | * Branch `development` is auto-deployed to acceptance. 70 | * Branch `main` is auto-deployed to production. 71 | * Create feature branches off of `development` using the naming convention 72 | `(features|chores|bugs)/a-brief-description-######`, where ###### is the tracker id. 73 | * Rebase your feature branch before merging into `development` to produce clean/compact merge bubbles. 74 | * Always retain merge commits when merging into `development` (e.g. `git merge --no-ff branchname`). 75 | * Use `git merge development` (fast-forward, no merge commit) from `main`. 76 | * Craft atomic commits that make sense on their own and can be easily cherry-picked or reverted if necessary. 77 | 78 | ### Code Style 79 | 80 | Rubocop is configured to enforce the style guide for this project. 81 | 82 | ## Additional/Optional Development Details 83 | 84 | ### Code Coverage (local) 85 | 86 | Coverage for the ruby specs: 87 | 88 | $ COVERAGE=true rspec 89 | 90 | Code coverage is reported to Code Climate on every CI build so there's a record of trending. 91 | 92 | ### Using retest 93 | 94 | Install and run `retest` to automatically listen for file changes and run the appropriate specs: 95 | 96 | $ gem install retest 97 | $ retest 98 | 99 | ### Using ChromeDriver 100 | 101 | The ChromeDriver version used in this project is maintained by the [webdrivers](https://github.com/titusfortner/webdrivers) gem. This is means that the 102 | feature specs are not running against the ChromeDriver installed previously on the machine, such as by Homebrew. 103 | 104 | ### Headed vs headless Chrome 105 | 106 | System specs marked with `js: true` run using headless Chrome by default, in the interest of speed. When writing or troubleshooting specs, you may want to run the normal (i.e. "headed") version of Chrome so you can see what is being rendered and use the Chrome developer tools. 107 | 108 | To do so, specify `HEADLESS=false` in your environment when running the specs. For example: 109 | 110 | $ HEADLESS=false bin/rspec spec/system 111 | 112 | ### Continuous Integration/Deployment with CircleCI and Heroku 113 | 114 | This project is configured for continuous integration with CircleCI, see [.circleci/config.yml](.circleci/config.yml) for details. 115 | 116 | On successful builds, Heroku will trigger a deployment via its 117 | [GitHub Integration](https://devcenter.heroku.com/articles/github-integration#automatic-deploys). 118 | 119 | # Server Environments 120 | 121 | ### Hosting 122 | 123 | Acceptance and Production are hosted on Heroku under the _email@example.com_ account. 124 | 125 | ### Environment Variables 126 | 127 | Several common features and operational parameters can be set using environment variables. 128 | 129 | **Required for deployment** 130 | 131 | * `DATABASE_URL` - URL of the PostgreSQL database; e.g. `postgres://user:password@host:port/database` 132 | * `NODE_ENV` - Set to `production` for all deployment environments 133 | * `RACK_ENV` - Set to `production` for all deployment environments 134 | * `RAILS_ENV` - Set to `production` for all deployment environments 135 | * `SECRET_KEY_BASE` - Secret key base for verifying signed cookies. Should be 30+ random characters and secret! 136 | 137 | **Optional** 138 | 139 | * `ASSET_HOST` - Load assets from this host (e.g. CDN) (default: none). 140 | * `BASIC_AUTH_PASSWORD` - Enable basic auth with this password. 141 | * `BASIC_AUTH_USER` - Set a basic auth username (not required, password enables basic auth). 142 | * `CANONICAL_HOSTNAME` - Canonical hostname for this application. Other incoming requests will be redirected to this hostname. Also used by mailers to generate full URLs. 143 | * `DB_POOL` - Number of DB connections per pool (i.e. per worker) (default: RAILS_MAX_THREADS or 5). 144 | * `FORCE_SSL` - Require SSL for all requests, redirecting if necessary (default: false). 145 | * `PORT` - Port to listen on (default: 3000). 146 | * `RACK_TIMEOUT_SERVICE_TIMEOUT` - Terminate requests that take longer than this time (default: 15s). 147 | * `RAILS_LOG_TO_STDOUT` - Log to standard out, good for Heroku (default: false). 148 | * `RAILS_MAX_THREADS` - Threads per worker (default: 5). 149 | * `RAILS_MIN_THREADS` - Threads per worker (default: 5). 150 | * `RAILS_SERVE_STATIC_FILES` - Serve static assets, good for Heroku (default: false). 151 | * `WEB_CONCURRENCY` - Number of puma workers to spawn (default: 1; consider 2 for medium Heroku dynos, or 8 for large). 152 | 153 | ### Third Party Services 154 | 155 | * Heroku for hosting. 156 | * CircleCI for continuous integration. 157 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path("config/application", __dir__) 5 | 6 | AppPrototype::Application.load_tasks 7 | 8 | if Rails.env.development? || Rails.env.test? 9 | Rake::Task[:default].clear_prerequisites 10 | task default: %i[spec rubocop] 11 | end 12 | -------------------------------------------------------------------------------- /app/assets/README.md: -------------------------------------------------------------------------------- 1 | This app does not use the Rails asset pipeline; it uses webpacker instead. Place images and styles under `app/javascript/` and then require them from one of the webpack entry points in `app/javascript/packs/`. To re-enable the asset pipeline, revert these changes: [#267](https://github.com/carbonfive/raygun-rails/pull/267). 2 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | 6 | after_action :cache_control_no_store_by_default 7 | 8 | private 9 | 10 | def cache_control_no_store_by_default 11 | response.cache_control[:no_store] = true if response.cache_control.empty? 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfive/raygun-rails/1fad7f58cbed90aebad56d3b9fea9fe4c7293673/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/pages_controller.rb: -------------------------------------------------------------------------------- 1 | class PagesController < ApplicationController 2 | def root 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | # action name to use for the primary submit button on scaffold-created CRUD forms 3 | def btn_action_prefix 4 | case action_name 5 | when "new", "create" 6 | "Create" 7 | when "edit", "update" 8 | "Update" 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/javascript/channels/consumer.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command. 3 | 4 | import { createConsumer } from "@rails/actioncable" 5 | 6 | export default createConsumer() 7 | -------------------------------------------------------------------------------- /app/javascript/channels/index.js: -------------------------------------------------------------------------------- 1 | // Load all the channels within this directory and all subdirectories. 2 | // Channel files must be named *_channel.js. 3 | 4 | const channels = require.context('.', true, /_channel\.js$/) 5 | channels.keys().forEach(channels) 6 | -------------------------------------------------------------------------------- /app/javascript/packs/application.js: -------------------------------------------------------------------------------- 1 | // Polyfill modern JS features, like promises, async functions, etc. 2 | import "core-js/stable"; 3 | import "regenerator-runtime/runtime"; 4 | 5 | // This file is automatically compiled by Webpack, along with any other files 6 | // present in this directory. You're encouraged to place your actual application logic in 7 | // a relevant structure within app/javascript and only use these pack files to reference 8 | // that code so it'll be compiled. 9 | 10 | require("@rails/ujs").start(); 11 | require("@rails/activestorage").start(); 12 | require("channels"); 13 | 14 | 15 | // Uncomment to copy all static images under ../images to the output folder and reference 16 | // them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>) 17 | // or the `imagePath` JavaScript helper below. 18 | // 19 | // const images = require.context('../images', true); 20 | // const imagePath = (name) => images(name, true); 21 | 22 | import "../stylesheets/application"; 23 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/_buttons.scss: -------------------------------------------------------------------------------- 1 | @import "_colors"; 2 | 3 | $border-radius: 4px; 4 | $button-padding: 15px; 5 | $background-color: $white; 6 | $border-color: $gray-cc; 7 | $color: $gray-40; 8 | 9 | .btn { 10 | color: $color; 11 | outline:0; 12 | border: 1px solid $border-color; 13 | border-radius: $border-radius; 14 | background-color: $background-color; 15 | transition: background-color 0.3s ease; 16 | padding: $button-padding; 17 | &:hover { 18 | background-color: darken($background-color, 10); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/_colors.scss: -------------------------------------------------------------------------------- 1 | $white: #ffffff; 2 | $gray-40: #404040; 3 | $gray-99: #999999; 4 | $gray-cc: #cccccc; 5 | $gray-fa: #fafafa; 6 | $black: #000000; 7 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/_footer.scss: -------------------------------------------------------------------------------- 1 | @import "_variables"; 2 | @import "_colors"; 3 | 4 | .footer { 5 | position: absolute; 6 | bottom: 0; 7 | width: 100%; 8 | height: $footer-height; 9 | line-height: 1; 10 | border-top: 1px solid $gray-cc; 11 | 12 | p { 13 | margin: 0; 14 | color: $gray-99; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/_header.scss: -------------------------------------------------------------------------------- 1 | @import "colors"; 2 | 3 | .header { 4 | border-bottom: 1px solid $gray-cc; 5 | } 6 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/_layout.scss: -------------------------------------------------------------------------------- 1 | @import "_variables"; 2 | 3 | html { 4 | position: relative; 5 | min-height: 100%; 6 | font-family: $font-family; 7 | font-size: 100%; 8 | } 9 | 10 | body { 11 | margin: 0 0 $footer-height; 12 | } 13 | 14 | .container { 15 | position: relative; 16 | padding: 10px; 17 | } 18 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/_variables.scss: -------------------------------------------------------------------------------- 1 | $footer-height: 40px; 2 | $font-family: 'Roboto', 'Helvetica', sans-serif; 3 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | @import "_layout"; 2 | @import "_header"; 3 | @import "_footer"; 4 | @import "_buttons"; 5 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | # Automatically retry jobs that encountered a deadlock 3 | # retry_on ActiveRecord::Deadlocked 4 | 5 | # Most jobs are safe to ignore if the underlying records are no longer available 6 | # discard_on ActiveJob::DeserializationError 7 | end 8 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfive/raygun-rails/1fad7f58cbed90aebad56d3b9fea9fe4c7293673/app/mailers/.keep -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: "from@example.com" 3 | layout "mailer" 4 | end 5 | -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfive/raygun-rails/1fad7f58cbed90aebad56d3b9fea9fe4c7293673/app/models/.keep -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfive/raygun-rails/1fad7f58cbed90aebad56d3b9fea9fe4c7293673/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/views/layouts/application.html.slim: -------------------------------------------------------------------------------- 1 | doctype 5 2 | html 3 | head 4 | title App Prototype 5 | = stylesheet_pack_tag "application", media: "all", "data-turbolinks-track": "reload" 6 | = javascript_packs_with_chunks_tag "application", 'data-turbolinks-track': 'reload' 7 | = csrf_meta_tag 8 | meta name="viewport" content="width=device-width, initial-scale=1.0" 9 | 10 | body id=(controller.controller_name) class=(controller.action_name) 11 | header.header 12 | .container 13 | a href="/" App Prototype 14 | 15 | main.container role="main" 16 | - flash.each do |name, msg| 17 | .alert role="alert" 18 | = raw(msg) 19 | = yield 20 | 21 | footer.footer 22 | .container 23 | p © #{Date.current.year} All rights reserved. 24 | -------------------------------------------------------------------------------- /app/views/pages/root.html.slim: -------------------------------------------------------------------------------- 1 | javascript: 2 | /* This little bit of silliness is here to ensure our js feature specs are working. Remove at will. */ 3 | window.addEventListener('load', function () { 4 | var enjoy = document.createElement("button"); 5 | enjoy.classList.add("btn") 6 | enjoy.append("And away we go!"); 7 | 8 | document.querySelector(".hero p:last-child") 9 | .appendChild(enjoy); 10 | }); 11 | 12 | .hero 13 | h1 Hello, world! 14 | br 15 | p Welcome to your newly generated rails application... 16 | p Meander around the code to see what's been done for you. Many small, and a few not-so-small, customizations have been made. 17 | p Custom generator templates create views that are bootstrap compatible and specs that are factory-aware and follow best practices. 18 | p Your application is ready for easy deployment to heroku. 19 | p 20 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function (api) { 2 | var validEnv = ["development", "test", "production"]; 3 | var currentEnv = api.env(); 4 | var isDevelopmentEnv = api.env("development"); 5 | var isProductionEnv = api.env("production"); 6 | var isTestEnv = api.env("test"); 7 | 8 | if (!validEnv.includes(currentEnv)) { 9 | throw new Error( 10 | "Please specify a valid `NODE_ENV` or " + 11 | '`BABEL_ENV` environment variables. Valid values are "development", ' + 12 | '"test", and "production". Instead, received: ' + 13 | JSON.stringify(currentEnv) + 14 | "." 15 | ); 16 | } 17 | 18 | return { 19 | presets: [ 20 | isTestEnv && [ 21 | "@babel/preset-env", 22 | { 23 | targets: { 24 | node: "current", 25 | }, 26 | }, 27 | ], 28 | (isProductionEnv || isDevelopmentEnv) && [ 29 | "@babel/preset-env", 30 | { 31 | forceAllTransforms: true, 32 | useBuiltIns: "entry", 33 | corejs: 3, 34 | modules: false, 35 | exclude: ["transform-typeof-symbol"], 36 | }, 37 | ], 38 | ].filter(Boolean), 39 | plugins: [ 40 | "babel-plugin-macros", 41 | "@babel/plugin-syntax-dynamic-import", 42 | isTestEnv && "babel-plugin-dynamic-import-node", 43 | "@babel/plugin-transform-destructuring", 44 | [ 45 | "@babel/plugin-proposal-class-properties", 46 | { 47 | loose: true, 48 | }, 49 | ], 50 | [ 51 | "@babel/plugin-proposal-object-rest-spread", 52 | { 53 | useBuiltIns: true, 54 | }, 55 | ], 56 | [ 57 | "@babel/plugin-proposal-private-methods", 58 | { 59 | loose: true, 60 | }, 61 | ], 62 | [ 63 | "@babel/plugin-proposal-private-property-in-object", 64 | { 65 | loose: true, 66 | }, 67 | ], 68 | [ 69 | "@babel/plugin-transform-runtime", 70 | { 71 | helpers: false, 72 | }, 73 | ], 74 | [ 75 | "@babel/plugin-transform-regenerator", 76 | { 77 | async: false, 78 | }, 79 | ], 80 | ].filter(Boolean), 81 | }; 82 | }; 83 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path("../config/application", __dir__) 3 | require_relative "../config/boot" 4 | require "rails/commands" 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative "../config/boot" 3 | require "rake" 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /bin/reset-acceptance-with-production-data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cwd=`dirname "$0"` 3 | source "$cwd/reset-config.cfg" 4 | 5 | echo "Copying production data to acceptance (destructive)..." 6 | sleep 3 7 | 8 | set -x 9 | 10 | heroku pg:copy $PRODUCTION::DATABASE_URL DATABASE_URL --confirm $ACCEPTANCE 11 | -------------------------------------------------------------------------------- /bin/reset-acceptance-with-sample-data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cwd=`dirname "$0"` 3 | source "$cwd/reset-config.cfg" 4 | 5 | echo "Loading sample_data on acceptance (destructive)..." 6 | sleep 3 7 | 8 | set -x 9 | 10 | heroku pg:reset DATABASE_URL --confirm $ACCEPTANCE 11 | heroku run rake db:migrate -a $ACCEPTANCE 12 | heroku run rake db:seed db:sample_data -a $ACCEPTANCE 13 | -------------------------------------------------------------------------------- /bin/reset-config.cfg: -------------------------------------------------------------------------------- 1 | APP_NAME="app-prototype" 2 | DB_NAME="app_prototype" 3 | PRODUCTION="$APP_NAME-production" 4 | ACCEPTANCE="$APP_NAME-acceptance" 5 | -------------------------------------------------------------------------------- /bin/reset-development-with-production-data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cwd=`dirname "$0"` 3 | source "$cwd/reset-config.cfg" 4 | 5 | echo "Loading production data in development (destructive)..." 6 | sleep 3 7 | 8 | DEVELOPMENT_DB="${DB_NAME}_development" 9 | 10 | set -x 11 | 12 | rake db:drop 13 | heroku pg:pull DATABASE_URL $DEVELOPMENT_DB -a $PRODUCTION 14 | -------------------------------------------------------------------------------- /bin/rspec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rspec' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rspec-core", "rspec") 30 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require "fileutils" 3 | 4 | # path to your application root. 5 | APP_ROOT = File.expand_path("..", __dir__) 6 | 7 | def system!(*args) 8 | system(*args) || abort("\n== Command #{args} failed ==") 9 | end 10 | 11 | FileUtils.chdir APP_ROOT do 12 | # This script is a way to set up or update your development environment automatically. 13 | # This script is idempotent, so that you can run it at any time and get an expectable outcome. 14 | # Add necessary setup steps to this file. 15 | 16 | puts "== Installing dependencies ==" 17 | system! "gem install bundler --conservative" 18 | system("bundle check") || system!("bundle install --jobs 4") 19 | 20 | # Install JavaScript dependencies 21 | system!("bin/yarn") if File.exist?("yarn.lock") 22 | 23 | puts "\n== Copying sample files ==" 24 | FileUtils.cp ".env.sample", ".env" unless File.exist?(".env") 25 | 26 | puts "\n== Preparing database ==" 27 | system! "bin/rails db:prepare db:sample_data" 28 | 29 | puts "\n== Removing old logs and tempfiles ==" 30 | system! "bin/rails log:clear tmp:clear tmp:create" 31 | 32 | puts "\n== Restarting application server ==" 33 | system! "bin/rails restart" 34 | end 35 | -------------------------------------------------------------------------------- /bin/webpack: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "rubygems" 11 | require "bundler/setup" 12 | 13 | require "webpacker" 14 | require "webpacker/webpack_runner" 15 | 16 | APP_ROOT = File.expand_path("..", __dir__) 17 | Dir.chdir(APP_ROOT) do 18 | Webpacker::WebpackRunner.run(ARGV) 19 | end 20 | -------------------------------------------------------------------------------- /bin/webpack-dev-server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "rubygems" 11 | require "bundler/setup" 12 | 13 | require "webpacker" 14 | require "webpacker/dev_server_runner" 15 | 16 | APP_ROOT = File.expand_path("..", __dir__) 17 | Dir.chdir(APP_ROOT) do 18 | Webpacker::DevServerRunner.run(ARGV) 19 | end 20 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | 4 | APP_ROOT = File.expand_path('..', __dir__) 5 | Dir.chdir(APP_ROOT) do 6 | executable_path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path| 7 | normalized_path = File.expand_path(path) 8 | 9 | normalized_path != __dir__ && File.executable?(Pathname.new(normalized_path).join('yarn')) 10 | end 11 | 12 | if executable_path 13 | exec File.expand_path(Pathname.new(executable_path).join('yarn')), *ARGV 14 | else 15 | $stderr.puts "Yarn executable was not detected in the system." 16 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" 17 | exit 1 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative "config/environment" 4 | 5 | # Redirect to the custom (canonical) hostname. 6 | use Rack::CanonicalHost, ENV.fetch("CANONICAL_HOSTNAME", nil) if ENV["CANONICAL_HOSTNAME"].present? 7 | 8 | # Optional Basic Auth - Enabled if BASIC_AUTH_PASSWORD is set. User is optional (any value will be accepted). 9 | BASIC_AUTH_USER = ENV["BASIC_AUTH_USER"].presence 10 | BASIC_AUTH_PASSWORD = ENV["BASIC_AUTH_PASSWORD"].presence 11 | 12 | if BASIC_AUTH_PASSWORD 13 | use Rack::Auth::Basic do |username, password| 14 | password == BASIC_AUTH_PASSWORD && (BASIC_AUTH_USER.blank? || username == BASIC_AUTH_USER) 15 | end 16 | end 17 | 18 | run Rails.application 19 | Rails.application.load_server 20 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative "boot" 2 | 3 | require "rails" 4 | # Pick the frameworks you want: 5 | require "active_model/railtie" 6 | require "active_job/railtie" 7 | require "active_record/railtie" 8 | require "active_storage/engine" 9 | require "action_controller/railtie" 10 | require "action_mailer/railtie" 11 | require "action_text/engine" 12 | require "action_view/railtie" 13 | # require "action_cable/engine" 14 | # require "action_mailbox/engine" 15 | # require "sprockets/railtie" 16 | # require "rails/test_unit/railtie" 17 | 18 | # Require the gems listed in Gemfile, including any gems 19 | # you've limited to :test, :development, or :production. 20 | Bundler.require(*Rails.groups) 21 | 22 | module AppPrototype 23 | class Application < Rails::Application 24 | # Initialize configuration defaults for originally generated Rails version. 25 | config.load_defaults 7.0 26 | 27 | # Configuration for the application, engines, and railties goes here. 28 | # 29 | # These settings can be overridden in specific environments using the files 30 | # in config/environments, which are processed later. 31 | # 32 | # config.time_zone = "Central Time (US & Canada)" 33 | # config.eager_load_paths << Rails.root.join("extras") 34 | 35 | # Enable/disable generators. 36 | config.generators do |g| 37 | # Core Rails 38 | # g.orm :active_record, primary_key_type: :uuid 39 | g.javascripts false 40 | g.stylesheets false 41 | g.helper false 42 | 43 | # Specs 44 | g.factory_bot true 45 | g.routing_specs false 46 | g.view_specs false 47 | g.controller_specs false 48 | g.request_specs false 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) 2 | 3 | require "bundler/setup" # Set up gems listed in the Gemfile. 4 | require "bootsnap/setup" # Speed up boot time by caching expensive operations. 5 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: app_prototype_production 11 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL: versions 9.1 and up are supported. 2 | 3 | default: &default 4 | adapter: postgresql 5 | encoding: unicode 6 | pool: <%= ENV["DB_POOL"].presence || ENV["RAILS_MAX_THREADS"].presence || 5 %> 7 | timeout: 5000 8 | 9 | development: 10 | <<: *default 11 | database: app_prototype_development 12 | 13 | # Warning: The database defined as "test" will be erased and 14 | # re-generated from your development database when you run "rake". 15 | # Do not set this db to the same as development or production. 16 | test: 17 | <<: *default 18 | database: app_prototype_test 19 | 20 | production: 21 | <<: *default 22 | url: <%= ENV["DATABASE_URL"] %> 23 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative "application" 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # In the development environment your application's code is reloaded any time 7 | # it changes. This slows down response time but is perfect for development 8 | # since you don't have to restart the web server when you make code changes. 9 | config.cache_classes = false 10 | 11 | # Do not eager load code on boot. 12 | config.eager_load = false 13 | 14 | # Show full error reports. 15 | config.consider_all_requests_local = true 16 | 17 | # Enable server timing 18 | config.server_timing = true 19 | 20 | # Enable/disable caching. By default caching is disabled. 21 | # Run rails dev:cache to toggle caching. 22 | if Rails.root.join("tmp/caching-dev.txt").exist? 23 | config.action_controller.perform_caching = true 24 | config.action_controller.enable_fragment_cache_logging = true 25 | 26 | config.cache_store = :memory_store 27 | config.public_file_server.headers = { 28 | "Cache-Control" => "public, max-age=#{2.days.to_i}" 29 | } 30 | else 31 | config.action_controller.perform_caching = false 32 | 33 | config.cache_store = :null_store 34 | end 35 | 36 | # Store uploaded files on the local file system (see config/storage.yml for options). 37 | config.active_storage.service = :local 38 | 39 | # Default to the :test mailer and raise errors. 40 | config.action_mailer.delivery_method = :test 41 | config.action_mailer.raise_delivery_errors = true 42 | config.action_mailer.perform_caching = false 43 | config.action_mailer.default_url_options = { host: "localhost:3000" } 44 | 45 | # Print deprecation notices to the Rails logger. 46 | config.active_support.deprecation = :log 47 | 48 | # Raise exceptions for disallowed deprecations. 49 | config.active_support.disallowed_deprecation = :raise 50 | 51 | # Tell Active Support which deprecation messages to disallow. 52 | config.active_support.disallowed_deprecation_warnings = [] 53 | 54 | # Raise an error on page load if there are pending migrations. 55 | config.active_record.migration_error = :page_load 56 | 57 | # Highlight code that triggered database queries in logs. 58 | config.active_record.verbose_query_logs = true 59 | 60 | # Raises error for missing translations. 61 | # config.i18n.raise_on_missing_translations = true 62 | 63 | # Annotate rendered view with file names. 64 | # config.action_view.annotate_rendered_view_with_filenames = true 65 | 66 | # Uncomment if you wish to allow Action Cable access from any origin. 67 | # config.action_cable.disable_request_forgery_protection = true 68 | end 69 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # Code is not reloaded between requests. 7 | config.cache_classes = true 8 | 9 | # Eager load code on boot. This eager loads most of Rails and 10 | # your application in memory, allowing both threaded web servers 11 | # and those relying on copy on write to perform better. 12 | # Rake tasks automatically ignore this option for performance. 13 | config.eager_load = true 14 | 15 | # Full error reports are disabled and caching is turned on. 16 | config.consider_all_requests_local = false 17 | config.action_controller.perform_caching = true 18 | 19 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 20 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 21 | # config.require_master_key = true 22 | 23 | if ENV["RAILS_SERVE_STATIC_FILES"].present? 24 | config.public_file_server.enabled = true 25 | 26 | # Enable gzip for dynamically generated HTML and API responses. 27 | # Remove if NGNIX, Cloudflare, or similar reverse-proxy is in place that already provides gzip. 28 | config.middleware.insert_after ActionDispatch::Static, Rack::Deflater 29 | else 30 | # Disable serving static files from the `/public` folder by default since 31 | # Apache or NGINX already handles this. 32 | config.public_file_server.enabled = false 33 | end 34 | 35 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 36 | config.action_controller.asset_host = ENV["ASSET_HOST"].presence 37 | 38 | # Specifies the header that your server uses for sending files. 39 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache 40 | # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX 41 | 42 | # Store uploaded files on the local file system (see config/storage.yml for options). 43 | config.active_storage.service = :local 44 | 45 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 46 | config.force_ssl = ENV["FORCE_SSL"].present? 47 | 48 | # Include generic and useful information about system operation, but avoid logging too much 49 | # information to avoid inadvertent exposure of personally identifiable information (PII). 50 | config.log_level = :info 51 | 52 | # Prepend all log lines with the following tags. 53 | config.log_tags = [:request_id] 54 | 55 | # Use a different cache store in production. 56 | # config.cache_store = :mem_cache_store 57 | 58 | # Use a real queuing backend for Active Job (and separate queues per environment). 59 | # config.active_job.queue_adapter = :sidekiq 60 | # config.active_job.queue_name_prefix = nil # Not supported by sidekiq 61 | 62 | config.action_mailer.perform_caching = false 63 | 64 | # Ignore bad email addresses and do not raise email delivery errors. 65 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 66 | # config.action_mailer.raise_delivery_errors = false 67 | 68 | # Set the host so that we can generate full URLs outside the context of a request 69 | # (e.g. sending email). 70 | config.action_mailer.default_url_options = { host: ENV.fetch("CANONICAL_HOSTNAME", "app-prototype.herokuapp.com") } 71 | 72 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 73 | # the I18n.default_locale when a translation cannot be found). 74 | config.i18n.fallbacks = true 75 | 76 | # Don't log any deprecations. 77 | config.active_support.report_deprecations = false 78 | 79 | # Use default logging formatter so that PID and timestamp are not suppressed. 80 | config.log_formatter = ::Logger::Formatter.new 81 | 82 | # Use a different logger for distributed setups. 83 | # require 'syslog/logger' 84 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 85 | 86 | if ENV["RAILS_LOG_TO_STDOUT"].present? 87 | logger = ActiveSupport::Logger.new($stdout) 88 | logger.formatter = config.log_formatter 89 | config.logger = ActiveSupport::TaggedLogging.new(logger) 90 | end 91 | 92 | # Do not dump schema after migrations. 93 | config.active_record.dump_schema_after_migration = false 94 | end 95 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | # The test environment is used exclusively to run your application's 4 | # test suite. You never need to work with it otherwise. Remember that 5 | # your test database is "scratch space" for the test suite and is wiped 6 | # and recreated between test runs. Don't rely on the data there! 7 | 8 | Rails.application.configure do 9 | # Settings specified here will take precedence over those in config/application.rb. 10 | 11 | # Turn false under Spring and add config.action_view.cache_template_loading = true. 12 | config.cache_classes = true 13 | 14 | # Eager loading loads your whole application. When running a single test locally, 15 | # this probably isn't necessary. It's a good idea to do in a continuous integration 16 | # system, or in some way before deploying your code. 17 | config.eager_load = ENV["CI"].present? 18 | 19 | # Configure public file server for tests with Cache-Control for performance. 20 | config.public_file_server.enabled = true 21 | config.public_file_server.headers = { 22 | "Cache-Control" => "public, max-age=#{1.hour.to_i}" 23 | } 24 | 25 | # Show full error reports and disable caching. 26 | config.consider_all_requests_local = true 27 | config.action_controller.perform_caching = false 28 | config.cache_store = :null_store 29 | 30 | # Raise exceptions instead of rendering exception templates. 31 | config.action_dispatch.show_exceptions = false 32 | 33 | # Disable request forgery protection in test environment. 34 | config.action_controller.allow_forgery_protection = false 35 | 36 | # Store uploaded files on the local file system in a temporary directory. 37 | config.active_storage.service = :test 38 | 39 | config.action_mailer.perform_caching = false 40 | 41 | # Tell Action Mailer not to deliver emails to the real world. 42 | # The :test delivery method accumulates sent emails in the 43 | # ActionMailer::Base.deliveries array. 44 | config.action_mailer.delivery_method = :test 45 | 46 | config.action_mailer.default_url_options = { host: "example.com" } 47 | 48 | # Print deprecation notices to the stderr. 49 | config.active_support.deprecation = :stderr 50 | 51 | # Raise exceptions for disallowed deprecations. 52 | config.active_support.disallowed_deprecation = :raise 53 | 54 | # Tell Active Support which deprecation messages to disallow. 55 | config.active_support.disallowed_deprecation_warnings = [] 56 | 57 | # Raises error for missing translations. 58 | # config.i18n.raise_on_missing_translations = true 59 | 60 | # Annotate rendered view with file names. 61 | # config.action_view.annotate_rendered_view_with_filenames = true 62 | end 63 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ActiveSupport::Reloader.to_prepare do 4 | # ApplicationController.renderer.defaults.merge!( 5 | # http_host: "example.org", 6 | # https: false 7 | # ) 8 | # end 9 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code 7 | # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". 8 | Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"] 9 | -------------------------------------------------------------------------------- /config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Define an application-wide content security policy. 4 | # See the Securing Rails Applications Guide for more information: 5 | # https://guides.rubyonrails.org/security.html#content-security-policy-header 6 | 7 | # Rails.application.configure do 8 | # config.content_security_policy do |policy| 9 | # policy.default_src :self, :https 10 | # policy.font_src :self, :https, :data 11 | # policy.img_src :self, :https, :data 12 | # policy.object_src :none 13 | # policy.script_src :self, :https 14 | # policy.style_src :self, :https 15 | # # Specify URI for violation reports 16 | # # policy.report_uri "/csp-violation-report-endpoint" 17 | # end 18 | # 19 | # # Generate session nonces for permitted importmap and inline scripts 20 | # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } 21 | # config.content_security_policy_nonce_directives = %w(script-src) 22 | # 23 | # # Report violations without enforcing the policy. 24 | # # config.content_security_policy_report_only = true 25 | # end 26 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /config/initializers/cors.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Avoid CORS issues when API is called from the frontend app. 4 | # Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests. 5 | 6 | # Read more: https://github.com/cyu/rack-cors 7 | 8 | # Rails.application.config.middleware.insert_before 0, Rack::Cors do 9 | # allow do 10 | # origins "example.com" 11 | # 12 | # resource "*", 13 | # headers: :any, 14 | # methods: [:get, :post, :put, :patch, :delete, :options, :head] 15 | # end 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure parameters to be filtered from the log file. Use this to limit dissemination of 4 | # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported 5 | # notations and behaviors. 6 | Rails.application.config.filter_parameters += %i[ 7 | passw secret token _key crypt salt certificate otp ssn 8 | ] 9 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, "\\1en" 8 | # inflect.singular /^(ox)en/i, "\\1" 9 | # inflect.irregular "person", "people" 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym "RESTful" 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/permissions_policy.rb: -------------------------------------------------------------------------------- 1 | # Define an application-wide HTTP permissions policy. For further 2 | # information see https://developers.google.com/web/updates/2018/06/feature-policy 3 | # 4 | # Rails.application.config.permissions_policy do |f| 5 | # f.camera :none 6 | # f.gyroscope :none 7 | # f.microphone :none 8 | # f.usb :none 9 | # f.fullscreen :self 10 | # f.payment :self, "https://secure.example.com" 11 | # end 12 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: "_app_prototype_session" 4 | -------------------------------------------------------------------------------- /config/initializers/simple_form.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Uncomment this and change the path if necessary to include your own 3 | # components. 4 | # See https://github.com/plataformatec/simple_form#custom-components to know 5 | # more about custom components. 6 | # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f } 7 | # 8 | # Use this setup block to configure all options available in SimpleForm. 9 | # 10 | # rubocop:disable Layout/LineLength 11 | 12 | SimpleForm.setup do |config| 13 | # Wrappers are used by the form builder to generate a 14 | # complete input. You can remove any component from the 15 | # wrapper, change the order or even add your own to the 16 | # stack. The options given below are used to wrap the 17 | # whole input. 18 | config.wrappers :default, class: :input, hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b| 19 | ## Extensions enabled by default 20 | # Any of these extensions can be disabled for a 21 | # given input by passing: `f.input EXTENSION_NAME => false`. 22 | # You can make any of these extensions optional by 23 | # renaming `b.use` to `b.optional`. 24 | 25 | # Determines whether to use HTML5 (:email, :url, ...) 26 | # and required attributes 27 | b.use :html5 28 | 29 | # Calculates placeholders automatically from I18n 30 | # You can also pass a string as f.input placeholder: "Placeholder" 31 | b.use :placeholder 32 | 33 | ## Optional extensions 34 | # They are disabled unless you pass `f.input EXTENSION_NAME => true` 35 | # to the input. If so, they will retrieve the values from the model 36 | # if any exists. If you want to enable any of those 37 | # extensions by default, you can change `b.optional` to `b.use`. 38 | 39 | # Calculates maxlength from length validations for string inputs 40 | # and/or database column lengths 41 | b.optional :maxlength 42 | 43 | # Calculate minlength from length validations for string inputs 44 | b.optional :minlength 45 | 46 | # Calculates pattern from format validations for string inputs 47 | b.optional :pattern 48 | 49 | # Calculates min and max from length validations for numeric inputs 50 | b.optional :min_max 51 | 52 | # Calculates readonly automatically from readonly attributes 53 | b.optional :readonly 54 | 55 | ## Inputs 56 | # b.use :input, class: 'input', error_class: 'is-invalid', valid_class: 'is-valid' 57 | b.use :label_input 58 | b.use :hint, wrap_with: { tag: :span, class: :hint } 59 | b.use :error, wrap_with: { tag: :span, class: :error } 60 | 61 | ## full_messages_for 62 | # If you want to display the full error message for the attribute, you can 63 | # use the component :full_error, like: 64 | # 65 | # b.use :full_error, wrap_with: { tag: :span, class: :error } 66 | end 67 | 68 | # The default wrapper to be used by the FormBuilder. 69 | config.default_wrapper = :default 70 | 71 | # Define the way to render check boxes / radio buttons with labels. 72 | # Defaults to :nested for bootstrap config. 73 | # inline: input + label 74 | # nested: label > input 75 | config.boolean_style = :nested 76 | 77 | # Default class for buttons 78 | config.button_class = "btn" 79 | 80 | # Method used to tidy up errors. Specify any Rails Array method. 81 | # :first lists the first message for each field. 82 | # Use :to_sentence to list all errors for each field. 83 | # config.error_method = :first 84 | 85 | # Default tag used for error notification helper. 86 | config.error_notification_tag = :div 87 | 88 | # CSS class to add for error notification helper. 89 | config.error_notification_class = "error_notification" 90 | 91 | # ID to add for error notification helper. 92 | # config.error_notification_id = nil 93 | 94 | # Series of attempts to detect a default label method for collection. 95 | # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] 96 | 97 | # Series of attempts to detect a default value method for collection. 98 | # config.collection_value_methods = [ :id, :to_s ] 99 | 100 | # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. 101 | # config.collection_wrapper_tag = nil 102 | 103 | # You can define the class to use on all collection wrappers. Defaulting to none. 104 | # config.collection_wrapper_class = nil 105 | 106 | # You can wrap each item in a collection of radio/check boxes with a tag, 107 | # defaulting to :span. 108 | # config.item_wrapper_tag = :span 109 | 110 | # You can define a class to use in all item wrappers. Defaulting to none. 111 | # config.item_wrapper_class = nil 112 | 113 | # How the label text should be generated altogether with the required text. 114 | # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" } 115 | 116 | # You can define the class to use on all labels. Default is nil. 117 | # config.label_class = nil 118 | 119 | # You can define the default class to be used on forms. Can be overriden 120 | # with `html: { :class }`. Defaulting to none. 121 | # config.default_form_class = nil 122 | 123 | # You can define which elements should obtain additional classes 124 | # config.generate_additional_classes_for = [:wrapper, :label, :input] 125 | 126 | # Whether attributes are required by default (or not). Default is true. 127 | # config.required_by_default = true 128 | 129 | # Tell browsers whether to use the native HTML5 validations (novalidate form option). 130 | # These validations are enabled in SimpleForm's internal config but disabled by default 131 | # in this configuration, which is recommended due to some quirks from different browsers. 132 | # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, 133 | # change this configuration to true. 134 | config.browser_validations = false 135 | 136 | # Collection of methods to detect if a file type was given. 137 | # config.file_methods = [ :mounted_as, :file?, :public_filename, :attached? ] 138 | 139 | # Custom mappings for input types. This should be a hash containing a regexp 140 | # to match as key, and the input type that will be used when the field name 141 | # matches the regexp as value. 142 | # config.input_mappings = { /count/ => :integer } 143 | 144 | # Custom wrappers for input types. This should be a hash containing an input 145 | # type as key and the wrapper that will be used for all inputs with specified type. 146 | # config.wrapper_mappings = { string: :prepend } 147 | 148 | # Namespaces where SimpleForm should look for custom input classes that 149 | # override default inputs. 150 | # config.custom_inputs_namespaces << "CustomInputs" 151 | 152 | # Default priority for time_zone inputs. 153 | # config.time_zone_priority = nil 154 | 155 | # Default priority for country inputs. 156 | # config.country_priority = nil 157 | 158 | # When false, do not use translations for labels. 159 | # config.translate_labels = true 160 | 161 | # Automatically discover new inputs in Rails' autoload path. 162 | # config.inputs_discovery = true 163 | 164 | # Cache SimpleForm inputs discovery 165 | # config.cache_discovery = !Rails.env.development? 166 | 167 | # Default class for inputs 168 | # config.input_class = nil 169 | 170 | # Define the default class of the input wrapper of the boolean input. 171 | config.boolean_label_class = "checkbox" 172 | 173 | # Defines if the default input wrapper class should be included in radio 174 | # collection wrappers. 175 | # config.include_default_input_wrapper_class = true 176 | 177 | # Defines which i18n scope will be used in Simple Form. 178 | # config.i18n_scope = 'simple_form' 179 | 180 | # Defines validation classes to the input_field. By default it's nil. 181 | # config.input_field_valid_class = 'is-valid' 182 | # config.input_field_error_class = 'is-invalid' 183 | end 184 | 185 | # rubocop:enable Layout/LineLength 186 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # The following keys must be escaped otherwise they will not be retrieved by 20 | # the default I18n backend: 21 | # 22 | # true, false, on, off, yes, no 23 | # 24 | # Instead, surround them with single quotes. 25 | # 26 | # en: 27 | # 'true': 'foo' 28 | # 29 | # To learn more, please read the Rails Internationalization guide 30 | # available at https://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /config/locales/simple_form.en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | simple_form: 3 | "yes": 'Yes' 4 | "no": 'No' 5 | required: 6 | text: 'required' 7 | mark: '*' 8 | # You can uncomment the line below if you need to overwrite the whole required html. 9 | # When using html, text and mark won't be used. 10 | # html: '*' 11 | error_notification: 12 | default_message: "Please review the problems below:" 13 | # Examples 14 | # labels: 15 | # defaults: 16 | # password: 'Password' 17 | # user: 18 | # new: 19 | # email: 'E-mail to sign in.' 20 | # edit: 21 | # email: 'E-mail.' 22 | # hints: 23 | # defaults: 24 | # username: 'User name to sign in.' 25 | # password: 'No special characters, please.' 26 | # include_blanks: 27 | # defaults: 28 | # age: 'Rather not say' 29 | # prompts: 30 | # defaults: 31 | # age: 'Select your age' 32 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers: a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum; this matches the default thread size of Active Record. 6 | # 7 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 5) 8 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } 9 | threads min_threads_count, max_threads_count 10 | 11 | # Specifies the `worker_timeout` threshold that Puma will use to wait before 12 | # terminating a worker in development environments. 13 | # 14 | worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" 15 | 16 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 17 | # 18 | port ENV.fetch("PORT", 3000) 19 | 20 | # Specifies the `environment` that Puma will run in. 21 | # 22 | environment ENV.fetch("RAILS_ENV") { "development" } 23 | 24 | # Specifies the `pidfile` that Puma will use. 25 | # 26 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } 27 | 28 | # Specifies the number of `workers` to boot in clustered mode. 29 | # Workers are forked web server processes. If using threads and workers together 30 | # the concurrency of the application would be max `threads` * `workers`. 31 | # Workers do not work on JRuby or Windows (both of which do not support 32 | # processes). 33 | # 34 | workers_count = ENV.fetch("WEB_CONCURRENCY", 1).to_i 35 | 36 | if workers_count > 1 37 | workers workers_count 38 | 39 | # Use the `preload_app!` method when specifying a `workers` number. 40 | # This directive tells Puma to first boot the application and load code 41 | # before forking the application. This takes advantage of Copy On Write 42 | # process behavior so workers use less memory. 43 | # 44 | preload_app! 45 | end 46 | 47 | # Allow puma to be restarted by `rails restart` command. 48 | plugin :tmp_restart 49 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html 3 | 4 | root to: "pages#root" 5 | end 6 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rails secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | # Shared secrets are available across all environments. 14 | 15 | # shared: 16 | # api_key: a1B2c3D4e5F6 17 | 18 | # Environmental secrets are only available for that specific environment. 19 | 20 | development: 21 | secret_key_base: 15b721e926db1637418f242623b9891c99e0b6a64e1003c33c28d974fbdb58ac8575ddd269be6dcb21ba5984ffcf848d2e0e9c4543345b401c65874b6d9bcc7a 22 | 23 | test: 24 | secret_key_base: 50dcf6cffc356f041b683ef260ae53331fba47c5042188adfa33af5d97a60a12d1a4b7513a5f8ae2b262b9b3e97df4aabedda752a75d3ea25592b536f9f76375 25 | 26 | # Do not keep production secrets in the unencrypted secrets file. 27 | # Instead, either read values from the environment. 28 | # Or, use `bin/rails secrets:setup` to configure encrypted secrets 29 | # and move the `production:` environment over there. 30 | 31 | # Do not keep production secrets in the repository, 32 | # instead read values from the environment. 33 | production: 34 | secret_key_base: <%= ENV['SECRET_KEY_BASE'] %> 35 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket 23 | 24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /config/webpack/development.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | 3 | environment.splitChunks() 4 | 5 | module.exports = environment 6 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpacker.yml: -------------------------------------------------------------------------------- 1 | # Note: You must restart bin/webpack-dev-server for changes to take effect 2 | 3 | default: &default 4 | source_path: app/javascript 5 | source_entry_path: packs 6 | public_root_path: public 7 | public_output_path: packs 8 | cache_path: tmp/cache/webpacker 9 | check_yarn_integrity: false 10 | webpack_compile_output: false 11 | 12 | # Additional paths webpack should lookup modules 13 | # ['app/assets', 'engine/foo/app/assets'] 14 | resolved_paths: [] 15 | 16 | # Reload manifest.json on all requests so we reload latest compiled packs 17 | cache_manifest: false 18 | 19 | # Extract and emit a css file 20 | extract_css: false 21 | 22 | static_assets_extensions: 23 | - .jpg 24 | - .jpeg 25 | - .png 26 | - .gif 27 | - .tiff 28 | - .ico 29 | - .svg 30 | - .eot 31 | - .otf 32 | - .ttf 33 | - .woff 34 | - .woff2 35 | 36 | extensions: 37 | - .mjs 38 | - .js 39 | - .sass 40 | - .scss 41 | - .css 42 | - .module.sass 43 | - .module.scss 44 | - .module.css 45 | - .png 46 | - .svg 47 | - .gif 48 | - .jpeg 49 | - .jpg 50 | 51 | development: 52 | <<: *default 53 | compile: true 54 | 55 | # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules 56 | check_yarn_integrity: true 57 | 58 | # Reference: https://webpack.js.org/configuration/dev-server/ 59 | dev_server: 60 | https: false 61 | host: localhost 62 | port: 3035 63 | public: localhost:3035 64 | hmr: false 65 | # Inline should be set to true if using HMR 66 | inline: true 67 | overlay: true 68 | compress: true 69 | disable_host_check: true 70 | use_local_ip: false 71 | quiet: false 72 | headers: 73 | 'Access-Control-Allow-Origin': '*' 74 | watch_options: 75 | ignored: '**/node_modules/**' 76 | 77 | 78 | test: 79 | <<: *default 80 | compile: true 81 | 82 | # Compile test packs to a separate directory 83 | public_output_path: packs-test 84 | 85 | production: 86 | <<: *default 87 | 88 | # Production depends on precompilation of packs prior to booting for performance. 89 | compile: false 90 | 91 | # Extract and emit a css file 92 | extract_css: true 93 | 94 | # Cache manifest.json for performance 95 | cache_manifest: true 96 | -------------------------------------------------------------------------------- /db/sample_data.rb: -------------------------------------------------------------------------------- 1 | # Populate the database with a small set of realistic sample data so that as a developer/designer, you can use the 2 | # application without having to create a bunch of stuff or pull down production data. 3 | # 4 | # After running db:sample_data, a developer/designer should be able to fire up the app, sign in, browse data and see 5 | # examples of practically anything (interesting) that can happen in the system. 6 | # 7 | # It's a good idea to build this up along with the features; when you build a feature, make sure you can easily demo it 8 | # after running db:sample_data. 9 | # 10 | # Data that is required by the application across all environments (i.e. reference data) should _not_ be included here. 11 | # That belongs in seeds.rb instead. 12 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # This file is the source Rails uses to define your schema when running `bin/rails 6 | # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to 7 | # be faster and is potentially less error prone than running all of your 8 | # migrations from scratch. Old migrations may fail to apply correctly if those 9 | # migrations use external dependencies or application code. 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema[7.0].define(version: 0) do 14 | # These are extensions that must be enabled in order to support this database 15 | enable_extension "plpgsql" 16 | 17 | end 18 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfive/raygun-rails/1fad7f58cbed90aebad56d3b9fea9fe4c7293673/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfive/raygun-rails/1fad7f58cbed90aebad56d3b9fea9fe4c7293673/lib/tasks/.keep -------------------------------------------------------------------------------- /lib/tasks/auto_annotate_models.rake: -------------------------------------------------------------------------------- 1 | # NOTE: only doing this in development as some production environments (Heroku) 2 | # NOTE: are sensitive to local FS writes, and besides -- it's just not proper 3 | # NOTE: to have a dev-mode tool do its thing in production. 4 | if Rails.env.development? 5 | require "annotate" 6 | task :set_annotation_options do 7 | # You can override any of these by setting an environment variable of the 8 | # same name. 9 | Annotate.set_defaults( 10 | "active_admin" => "false", 11 | "additional_file_patterns" => [], 12 | "routes" => "false", 13 | "models" => "true", 14 | "position_in_routes" => "before", 15 | "position_in_class" => "before", 16 | "position_in_test" => "before", 17 | "position_in_fixture" => "before", 18 | "position_in_factory" => "before", 19 | "position_in_serializer" => "before", 20 | "show_foreign_keys" => "true", 21 | "show_complete_foreign_keys" => "false", 22 | "show_indexes" => "true", 23 | "simple_indexes" => "false", 24 | "model_dir" => "app/models", 25 | "root_dir" => "", 26 | "include_version" => "false", 27 | "require" => "", 28 | "exclude_tests" => "true", 29 | "exclude_fixtures" => "false", 30 | "exclude_factories" => "false", 31 | "exclude_serializers" => "false", 32 | "exclude_scaffolds" => "true", 33 | "exclude_controllers" => "true", 34 | "exclude_helpers" => "true", 35 | "exclude_sti_subclasses" => "false", 36 | "ignore_model_sub_dir" => "false", 37 | "ignore_columns" => nil, 38 | "ignore_routes" => nil, 39 | "ignore_unknown_models" => "false", 40 | "hide_limit_column_types" => "integer,bigint,boolean", 41 | "hide_default_column_types" => "json,jsonb,hstore", 42 | "skip_on_db_migrate" => "false", 43 | "format_bare" => "true", 44 | "format_rdoc" => "false", 45 | "format_yard" => "false", 46 | "format_markdown" => "false", 47 | "sort" => "true", 48 | "force" => "false", 49 | "frozen" => "false", 50 | "classified_sort" => "false", 51 | "trace" => "false", 52 | "wrapper_open" => nil, 53 | "wrapper_close" => nil, 54 | "with_comment" => "true" 55 | ) 56 | end 57 | 58 | Annotate.load_tasks 59 | end 60 | -------------------------------------------------------------------------------- /lib/tasks/coverage.rake: -------------------------------------------------------------------------------- 1 | namespace :spec do 2 | task :enable_coverage do 3 | ENV["COVERAGE"] = "1" 4 | end 5 | 6 | desc "Executes specs with code coverage reports" 7 | task coverage: :enable_coverage do 8 | Rake::Task[:spec].invoke 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /lib/tasks/db.rake: -------------------------------------------------------------------------------- 1 | namespace :db do 2 | desc "Load a small, representative set of data so that the application can start in an use state (for development)." 3 | task sample_data: :environment do 4 | sample_data = Rails.root.join("db/sample_data.rb") 5 | load(sample_data) if sample_data 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/tasks/rubocop.rake: -------------------------------------------------------------------------------- 1 | begin 2 | require "rubocop/rake_task" 3 | 4 | RuboCop::RakeTask.new 5 | rescue LoadError # rubocop:disable Lint/SuppressedException 6 | end 7 | -------------------------------------------------------------------------------- /lib/tasks/spec.rake: -------------------------------------------------------------------------------- 1 | begin 2 | require "rspec/core" 3 | require "rspec/core/rake_task" 4 | 5 | namespace :spec do 6 | desc "Run the code examples in spec/ except those in spec/system" 7 | RSpec::Core::RakeTask.new(:without_system) do |t| 8 | t.exclude_pattern = "spec/system/**/*_spec.rb" 9 | end 10 | end 11 | rescue LoadError 12 | namespace :spec do 13 | task :without_system do 14 | # Intentionally left blank. 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /lib/templates/rails/scaffold_controller/controller.rb: -------------------------------------------------------------------------------- 1 | <% if namespaced? -%> 2 | require_dependency "<%= namespaced_path %>/application_controller" 3 | 4 | <% end -%> 5 | <% module_namespacing do -%> 6 | class <%= controller_class_name %>Controller < ApplicationController 7 | before_action :set_<%= singular_table_name %>, only: %i[show edit update destroy] 8 | 9 | def index 10 | @<%= plural_table_name %> = <%= orm_class.all(class_name) %> 11 | end 12 | 13 | def show 14 | end 15 | 16 | def new 17 | @<%= singular_table_name %> = <%= orm_class.build(class_name) %> 18 | end 19 | 20 | def edit 21 | end 22 | 23 | def create 24 | @<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %> 25 | 26 | if @<%= orm_instance.save %> 27 | redirect_to @<%= singular_table_name %>, notice: <%= %{"#{human_name} was successfully created."} %> 28 | else 29 | render :new 30 | end 31 | end 32 | 33 | def update 34 | if @<%= orm_instance.update("#{singular_table_name}_params") %> 35 | redirect_to @<%= singular_table_name %>, notice: <%= %{"#{human_name} was successfully updated."} %> 36 | else 37 | render :edit 38 | end 39 | end 40 | 41 | def destroy 42 | @<%= orm_instance.destroy %> 43 | redirect_to <%= index_helper %>_url, notice: <%= %{"#{human_name} was successfully destroyed."} %> 44 | end 45 | 46 | private 47 | 48 | # Use callbacks to share common setup or constraints between actions. 49 | def set_<%= singular_table_name %> 50 | @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %> 51 | end 52 | 53 | # Only allow a trusted parameter "white list" through. 54 | def <%= "#{singular_table_name}_params" %> 55 | <%- if attributes_names.empty? -%> 56 | params.fetch(:<%= singular_table_name %>, {}) 57 | <%- else -%> 58 | params.require(:<%= singular_table_name %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>) 59 | <%- end -%> 60 | end 61 | end 62 | <% end -%> 63 | -------------------------------------------------------------------------------- /lib/templates/rspec/controller/controller_spec.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | <% module_namespacing do -%> 4 | RSpec.describe <%= class_name %>Controller, <%= type_metatag(:controller) %> do 5 | 6 | <% for action in actions -%> 7 | describe "GET #<%= action %>" do 8 | it "returns http success" do 9 | get :<%= action %> 10 | expect(response).to have_http_status(:success) 11 | end 12 | end 13 | 14 | <% end -%> 15 | end 16 | <% end -%> 17 | -------------------------------------------------------------------------------- /lib/templates/rspec/model/model_spec.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | <% module_namespacing do -%> 4 | RSpec.describe <%= class_name %>, <%= type_metatag(:model) %> do 5 | pending "add some examples to (or delete) #{__FILE__}" 6 | end 7 | <% end -%> 8 | -------------------------------------------------------------------------------- /lib/templates/rspec/scaffold/controller_spec.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | # This spec was generated by rspec-rails when you ran the scaffold generator. 4 | # It demonstrates how one might use RSpec to specify the controller code that 5 | # was generated by Rails when you ran the scaffold generator. 6 | # 7 | # It assumes that the implementation code is generated by the rails scaffold 8 | # generator. If you are using any extension libraries to generate different 9 | # controller code, this generated spec may or may not pass. 10 | # 11 | # It only uses APIs available in rails and/or rspec-rails. There are a number 12 | # of tools you can use to make these specs even more expressive, but we're 13 | # sticking to rails and rspec-rails APIs to keep things simple and stable. 14 | # 15 | # Compared to earlier versions of this generator, there is very limited use of 16 | # stubs and message expectations in this spec. Stubs are only used when there 17 | # is no simpler way to get a handle on the object needed for the example. 18 | # Message expectations are only used when there is no simpler way to specify 19 | # that an instance is receiving a specific message. 20 | # 21 | # Also compared to earlier versions of this generator, there are no longer any 22 | # expectations of assigns and templates rendered. These features have been 23 | # removed from Rails core in Rails 5, but can be added back in via the 24 | # `rails-controller-testing` gem. 25 | 26 | <% module_namespacing do -%> 27 | RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:controller) %> do 28 | # This should return the minimal set of attributes required to create a valid 29 | # <%= class_name %>. As you add validations to <%= class_name %>, be sure to 30 | # adjust the attributes here as well. 31 | let(:valid_attributes) do 32 | attributes_for :<%= file_name %> 33 | end 34 | 35 | let(:invalid_attributes) do 36 | skip("Add a hash of attributes invalid for your model") 37 | end 38 | 39 | # This should return the minimal set of values that should be in the session 40 | # in order to pass any filters (e.g. authentication) defined in 41 | # <%= controller_class_name %>Controller. Be sure to keep this updated too. 42 | let(:valid_session) { {} } 43 | 44 | <% unless options[:singleton] -%> 45 | describe "GET #index" do 46 | it "returns a success response" do 47 | <%= class_name %>.create! valid_attributes 48 | get :index, params: {}, session: valid_session 49 | expect(response).to be_successful 50 | end 51 | end 52 | 53 | <% end -%> 54 | describe "GET #show" do 55 | it "returns a success response" do 56 | <%= file_name %> = <%= class_name %>.create! valid_attributes 57 | get :show, params: { id: <%= file_name %>.to_param }, session: valid_session 58 | expect(response).to be_successful 59 | end 60 | end 61 | 62 | describe "GET #new" do 63 | it "returns a success response" do 64 | get :new, params: {}, session: valid_session 65 | expect(response).to be_successful 66 | end 67 | end 68 | 69 | describe "GET #edit" do 70 | it "returns a success response" do 71 | <%= file_name %> = <%= class_name %>.create! valid_attributes 72 | get :edit, params: { id: <%= file_name %>.to_param }, session: valid_session 73 | expect(response).to be_successful 74 | end 75 | end 76 | 77 | describe "POST #create" do 78 | context "with valid params" do 79 | it "creates a new <%= class_name %>" do 80 | expect { 81 | post :create, params: { <%= ns_file_name %>: valid_attributes }, session: valid_session 82 | }.to change(<%= class_name %>, :count).by(1) 83 | end 84 | 85 | it "redirects to the created <%= ns_file_name %>" do 86 | post :create, params: { <%= ns_file_name %>: valid_attributes }, session: valid_session 87 | expect(response).to redirect_to(<%= class_name %>.last) 88 | end 89 | end 90 | 91 | context "with invalid params" do 92 | it "returns a success response (i.e. to display the 'new' template)" do 93 | post :create, params: { <%= ns_file_name %>: invalid_attributes }, session: valid_session 94 | expect(response).to be_successful 95 | end 96 | end 97 | end 98 | 99 | describe "PUT #update" do 100 | context "with valid params" do 101 | let(:new_attributes) do 102 | skip("Add a hash of attributes valid for your model") 103 | end 104 | 105 | it "updates the requested <%= ns_file_name %>" do 106 | <%= file_name %> = <%= class_name %>.create! valid_attributes 107 | put :update, params: { id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes }, session: valid_session 108 | <%= file_name %>.reload 109 | skip("Add assertions for updated state") 110 | end 111 | 112 | it "redirects to the <%= ns_file_name %>" do 113 | <%= file_name %> = <%= class_name %>.create! valid_attributes 114 | put :update, params: { id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes }, session: valid_session 115 | expect(response).to redirect_to(<%= file_name %>) 116 | end 117 | end 118 | 119 | context "with invalid params" do 120 | it "returns a success response (i.e. to display the 'edit' template)" do 121 | <%= file_name %> = <%= class_name %>.create! valid_attributes 122 | put :update, params: { id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes }, session: valid_session 123 | expect(response).to be_successful 124 | end 125 | end 126 | end 127 | 128 | describe "DELETE #destroy" do 129 | it "destroys the requested <%= ns_file_name %>" do 130 | <%= file_name %> = <%= class_name %>.create! valid_attributes 131 | expect { 132 | delete :destroy, params: { id: <%= file_name %>.to_param }, session: valid_session 133 | }.to change(<%= class_name %>, :count).by(-1) 134 | end 135 | 136 | it "redirects to the <%= table_name %> list" do 137 | <%= file_name %> = <%= class_name %>.create! valid_attributes 138 | delete :destroy, params: { id: <%= file_name %>.to_param }, session: valid_session 139 | expect(response).to redirect_to(<%= index_helper %>_url) 140 | end 141 | end 142 | end 143 | <% end -%> 144 | -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfive/raygun-rails/1fad7f58cbed90aebad56d3b9fea9fe4c7293673/log/.keep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app-prototype", 3 | "private": true, 4 | "version": "0.2.0", 5 | "engines": { 6 | "node": "^16.18.1" 7 | }, 8 | "scripts": { 9 | "start": "concurrently --raw --kill-others-on-fail 'bin/rails s -b 0.0.0.0' 'bin/webpack-dev-server'" 10 | }, 11 | "dependencies": { 12 | "@rails/actioncable": "^6.1", 13 | "@rails/activestorage": "^6.1", 14 | "@rails/ujs": "^6.1", 15 | "@rails/webpacker": "^5.4.3", 16 | "core-js": "^3.26.1", 17 | "regenerator-runtime": "^0.13.10" 18 | }, 19 | "devDependencies": { 20 | "concurrently": "^7.5.0", 21 | "webpack-dev-server": "^3.11.3" 22 | }, 23 | "resolutions": { 24 | "node-forge": "^0.10.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('postcss-import'), 4 | require('postcss-flexbugs-fixes'), 5 | require('postcss-preset-env')({ 6 | autoprefixer: { 7 | flexbox: 'no-2009' 8 | }, 9 | stage: 3 10 | }) 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfive/raygun-rails/1fad7f58cbed90aebad56d3b9fea9fe4c7293673/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfive/raygun-rails/1fad7f58cbed90aebad56d3b9fea9fe4c7293673/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfive/raygun-rails/1fad7f58cbed90aebad56d3b9fea9fe4c7293673/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /spec/controllers/pages_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | RSpec.describe PagesController do 4 | describe "GET 'root'" do 5 | subject(:execute_request) { get "root" } 6 | 7 | it "returns http success" do 8 | execute_request 9 | expect(response).to be_successful 10 | end 11 | 12 | it "sends the cache-control header to disable browser caches" do 13 | execute_request 14 | expect(response.headers["Cache-Control"]).to eq("no-store") 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is copied to spec/ when you run 'rails generate rspec:install' 2 | require "spec_helper" 3 | ENV["RAILS_ENV"] ||= "test" 4 | require File.expand_path("../config/environment", __dir__) 5 | 6 | # Prevent database truncation if the environment is production 7 | abort("The Rails environment is running in production mode!") if Rails.env.production? 8 | 9 | require "rspec/rails" 10 | 11 | # Add additional requires below this line. Rails is not loaded until this point! 12 | 13 | # Requires supporting ruby files with custom matchers and macros, etc, in 14 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are 15 | # run as spec files by default. This means that files in spec/support that end 16 | # in _spec.rb will both be required and run as specs, causing the specs to be 17 | # run twice. It is recommended that you do not name files matching this glob to 18 | # end with _spec.rb. You can configure this pattern with the --pattern 19 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. 20 | # 21 | # The following line is provided for convenience purposes. It has the downside 22 | # of increasing the boot-up time by auto-requiring all files in the support 23 | # directory. Alternatively, in the individual `*_spec.rb` files, manually 24 | # require only the support files necessary. 25 | # 26 | Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } 27 | 28 | # Checks for pending migrations and applies them before tests are run. 29 | # If you are not using ActiveRecord, you can remove these lines. 30 | begin 31 | ActiveRecord::Migration.maintain_test_schema! 32 | rescue ActiveRecord::PendingMigrationError => e 33 | puts e.to_s.strip 34 | exit 1 35 | end 36 | 37 | RSpec.configure do |config| 38 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 39 | # config.fixture_path = "#{::Rails.root}/spec/fixtures" 40 | 41 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 42 | # examples within a transaction, remove the following line or assign false 43 | # instead of true. 44 | config.use_transactional_fixtures = true 45 | 46 | # You can uncomment this line to turn off ActiveRecord support entirely. 47 | # config.use_active_record = false 48 | 49 | # RSpec Rails can automatically mix in different behaviours to your tests 50 | # based on their file location, for example enabling you to call `get` and 51 | # `post` in specs under `spec/controllers`. 52 | # 53 | # You can disable this behaviour by removing the line below, and instead 54 | # explicitly tag your specs with their type, e.g.: 55 | # 56 | # RSpec.describe UsersController, type: :controller do 57 | # # ... 58 | # end 59 | # 60 | # The different available types are documented in the features, such as in 61 | # https://relishapp.com/rspec/rspec-rails/docs 62 | config.infer_spec_type_from_file_location! 63 | 64 | # Filter lines from Rails gems in backtraces. 65 | config.filter_rails_from_backtrace! 66 | # arbitrary gems may also be filtered via: 67 | # config.filter_gems_from_backtrace("gem name") 68 | 69 | # Enable time helpers like `travel_to` and `freeze_time` to be used within specs 70 | # https://api.rubyonrails.org/classes/ActiveSupport/Testing/TimeHelpers.html 71 | config.include ActiveSupport::Testing::TimeHelpers 72 | end 73 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # Coverage must be enabled before the application is loaded. 2 | if ENV["COVERAGE"] 3 | require "simplecov" 4 | 5 | SimpleCov.start do 6 | add_filter "/spec/" 7 | add_filter "/config/" 8 | add_filter "/vendor/" 9 | add_group "Models", "app/models" 10 | add_group "Controllers", "app/controllers" 11 | add_group "Helpers", "app/helpers" 12 | add_group "Views", "app/views" 13 | add_group "Mailers", "app/mailers" 14 | end 15 | end 16 | 17 | # This file was generated by the `rspec --init` command. Conventionally, all 18 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. 19 | # The generated `.rspec` file contains `--require spec_helper` which will cause 20 | # this file to always be loaded, without a need to explicitly require it in any 21 | # files. 22 | # 23 | # Given that it is always loaded, you are encouraged to keep this file as 24 | # light-weight as possible. Requiring heavyweight dependencies from this file 25 | # will add to the boot time of your test suite on EVERY test run, even for an 26 | # individual file that may not need all of that loaded. Instead, consider making 27 | # a separate helper file that requires the additional dependencies and performs 28 | # the additional setup, and require it from the spec files that actually need 29 | # it. 30 | # 31 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration 32 | RSpec.configure do |config| 33 | # rspec-expectations config goes here. You can use an alternate 34 | # assertion/expectation library such as wrong or the stdlib/minitest 35 | # assertions if you prefer. 36 | config.expect_with :rspec do |expectations| 37 | # This option will default to `true` in RSpec 4. It makes the `description` 38 | # and `failure_message` of custom matchers include text for helper methods 39 | # defined using `chain`, e.g.: 40 | # be_bigger_than(2).and_smaller_than(4).description 41 | # # => "be bigger than 2 and smaller than 4" 42 | # ...rather than: 43 | # # => "be bigger than 2" 44 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 45 | end 46 | 47 | # rspec-mocks config goes here. You can use an alternate test double 48 | # library (such as bogus or mocha) by changing the `mock_with` option here. 49 | config.mock_with :rspec do |mocks| 50 | # Prevents you from mocking or stubbing a method that does not exist on 51 | # a real object. This is generally recommended, and will default to 52 | # `true` in RSpec 4. 53 | mocks.verify_partial_doubles = true 54 | end 55 | 56 | # This option will default to `:apply_to_host_groups` in RSpec 4 (and will 57 | # have no way to turn it off -- the option exists only for backwards 58 | # compatibility in RSpec 3). It causes shared context metadata to be 59 | # inherited by the metadata hash of host groups and examples, rather than 60 | # triggering implicit auto-inclusion in groups with matching metadata. 61 | config.shared_context_metadata_behavior = :apply_to_host_groups 62 | 63 | # Enable aggregate failures unless it's a system spec or explicitly 64 | # configured at the spec level. 65 | config.define_derived_metadata(type: proc { |type| type != :system }) do |meta| 66 | meta[:aggregate_failures] = true 67 | end 68 | 69 | config.define_derived_metadata(type: :system) do |meta| 70 | meta[:aggregate_failures] = false unless meta.key?(:aggregate_failures) 71 | end 72 | 73 | # This allows you to limit a spec run to individual examples or groups 74 | # you care about by tagging them with `:focus` metadata. When nothing 75 | # is tagged with `:focus`, all examples get run. RSpec also provides 76 | # aliases for `it`, `describe`, and `context` that include `:focus` 77 | # metadata: `fit`, `fdescribe` and `fcontext`, respectively. 78 | config.filter_run_when_matching :focus 79 | 80 | # Allows RSpec to persist some state between runs in order to support 81 | # the `--only-failures` and `--next-failure` CLI options. We recommend 82 | # you configure your source control system to ignore this file. 83 | config.example_status_persistence_file_path = "spec/examples.txt" 84 | 85 | # Limits the available syntax to the non-monkey patched syntax that is 86 | # recommended. For more details, see: 87 | # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ 88 | # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ 89 | # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode 90 | config.disable_monkey_patching! 91 | 92 | # Many RSpec users commonly either run the entire suite or an individual 93 | # file, and it's useful to allow more verbose output when running an 94 | # individual spec file. 95 | if config.files_to_run.one? 96 | # Use the documentation formatter for detailed output, 97 | # unless a formatter has already been configured 98 | # (e.g. via a command-line flag). 99 | config.default_formatter = "doc" 100 | end 101 | 102 | # Print the 10 slowest examples and example groups at the 103 | # end of the spec run, to help surface which specs are running 104 | # particularly slow. 105 | # config.profile_examples = 10 106 | 107 | # Run specs in random order to surface order dependencies. If you find an 108 | # order dependency and want to debug it, you can fix the order by providing 109 | # the seed, which is printed after each run. 110 | # --seed 1234 111 | config.order = :random 112 | 113 | # Seed global randomization in this process using the `--seed` CLI option. 114 | # Setting this allows you to use `--seed` to deterministically reproduce 115 | # test failures related to randomization by passing the same `--seed` value 116 | # as the one that triggered the failure. 117 | Kernel.srand config.seed 118 | 119 | # Run non-system specs before system specs. `--seed` still applies to ordering both sets. 120 | config.register_ordering(:global) do |items| 121 | systems, others = items.partition { |g| g.metadata[:type] == :system } 122 | others + systems 123 | end 124 | end 125 | -------------------------------------------------------------------------------- /spec/support/capybara.rb: -------------------------------------------------------------------------------- 1 | require "selenium/webdriver" 2 | 3 | Webdrivers.cache_time = 24.hours.seconds 4 | 5 | Capybara.register_driver :chrome do |app| 6 | Capybara::Selenium::Driver.new app, browser: :chrome 7 | end 8 | 9 | Capybara.register_driver :headless_chrome do |app| 10 | browser_options = ::Selenium::WebDriver::Chrome::Options.new( 11 | # This enables access to the JS console logs in your feature specs. 12 | # You can see the logs during the test by calling (for example): 13 | # 14 | # puts page.driver.browser.manage.logs.get(:browser).map(&:inspect).join("\n") 15 | # 16 | # This will print out each log entry in the JS log, including e.g. the React welcome notice. 17 | logging_prefs: { "browser" => "ALL" } 18 | ) 19 | browser_options.args << "--headless" 20 | browser_options.args << "--window-size=1024,3840" 21 | 22 | # Try this if chrome crashes. https://sites.google.com/a/chromium.org/chromedriver/help/chrome-doesn-t-start 23 | # browser_options.args << "--no-sandbox" 24 | 25 | Capybara::Selenium::Driver.new( 26 | app, 27 | browser: :chrome, 28 | capabilities: [::Selenium::WebDriver::Remote::Capabilities.chrome, browser_options] 29 | ) 30 | end 31 | 32 | chrome_driver = (ENV["HEADLESS"] == "false") ? :chrome : :headless_chrome 33 | 34 | Capybara.default_driver = :rack_test 35 | Capybara.javascript_driver = chrome_driver 36 | 37 | RSpec.configure do |config| 38 | config.before(:each, type: :system) do 39 | driven_by(:rack_test) 40 | end 41 | 42 | config.before(:each, js: true, type: :system) do 43 | driven_by(chrome_driver) 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /spec/support/factory_bot.rb: -------------------------------------------------------------------------------- 1 | RSpec.configure do |config| 2 | config.include FactoryBot::Syntax::Methods 3 | end 4 | -------------------------------------------------------------------------------- /spec/support/raise_on_js_errors.rb: -------------------------------------------------------------------------------- 1 | JavaScriptError = Class.new(StandardError) 2 | 3 | # Raise on JS errors (i.e., things logged to the Chrome console as errors). 4 | # Disregard HTTP 4xx errors because, while Chrome does log them as errors, 5 | # back-end servers often use them to indicate statuses such as form validation 6 | # errors, which may well be the intended effect of a test. 7 | RSpec.configure do |config| 8 | config.after(type: :system, js: true) do 9 | js_console_output = page.driver.browser.logs.get(:browser) 10 | http_4xx_error_detector = /the server responded with a status of 4/ 11 | js_errors = js_console_output.select do |log_item| 12 | log_item.level == "SEVERE" && log_item.message !~ http_4xx_error_detector 13 | end 14 | if js_errors.present? 15 | exception_headline = "This test caused JS errors." 16 | exception_details = js_errors.map(&:message).map { |line| line.indent(2, " ") }.join("\n") 17 | raise JavaScriptError, [exception_headline, exception_details].join("\n") 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/support/shoulda_matchers.rb: -------------------------------------------------------------------------------- 1 | Shoulda::Matchers.configure do |config| 2 | config.integrate do |with| 3 | with.test_framework :rspec 4 | with.library :rails 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/system/pages_spec.rb: -------------------------------------------------------------------------------- 1 | require "rails_helper" 2 | 3 | RSpec.describe "Static Pages" do 4 | # Here's a placeholder feature spec to use as an example, uses the default driver. 5 | it "/ should include the application name in its title" do 6 | visit root_path 7 | 8 | expect(page).to have_title "App Prototype" 9 | end 10 | 11 | # Another contrived example, this one relies on the javascript driver. 12 | it "/ should include a button with the CTA message 'And away we go!'", js: true do 13 | visit root_path 14 | 15 | expect(page).to have_button("And away we go!") 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfive/raygun-rails/1fad7f58cbed90aebad56d3b9fea9fe4c7293673/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carbonfive/raygun-rails/1fad7f58cbed90aebad56d3b9fea9fe4c7293673/vendor/assets/stylesheets/.keep --------------------------------------------------------------------------------