diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index 0f60568..9f4d55c 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -5,18 +5,18 @@ on: branches: [ master ] jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - ruby: [ 2.4, 2.5, 2.6 ] + ruby: [ 3.3, 3.4 ] name: rspec with ruby ${{ matrix.ruby }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true bundler: 1 - - run: bundle exec rspec \ No newline at end of file + - run: bundle exec rspec diff --git a/fix-db-schema-conflicts.gemspec b/fix-db-schema-conflicts.gemspec index 739a058..0a423e7 100644 --- a/fix-db-schema-conflicts.gemspec +++ b/fix-db-schema-conflicts.gemspec @@ -20,9 +20,9 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler' spec.add_development_dependency 'rake' - spec.add_development_dependency 'rspec', '~>3.4.0' - spec.add_development_dependency 'rails', '~> 4.2.0' - spec.add_development_dependency 'sqlite3', '~> 1.3.0' + spec.add_development_dependency 'rspec' + spec.add_development_dependency 'rails' + spec.add_development_dependency 'sqlite3' spec.add_dependency 'rubocop', '>= 0.38.0' diff --git a/spec/integration/integration_spec.rb b/spec/integration/integration_spec.rb index 20f1885..f511e13 100644 --- a/spec/integration/integration_spec.rb +++ b/spec/integration/integration_spec.rb @@ -24,15 +24,15 @@ def reference_db_schema # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160322223258) do +ActiveRecord::Schema[8.0].define(version: 2016_03_22_223258) do create_table "companies", force: :cascade do |t| t.string "addr1" t.string "addr2" @@ -43,12 +43,11 @@ def reference_db_schema t.string "state" t.datetime "updated_at", null: false t.string "zip" + t.index ["city"], name: "index_companies_on_city" + t.index ["name"], name: "index_companies_on_name" + t.index ["state"], name: "index_companies_on_state" end - add_index "companies", ["city"], name: "index_companies_on_city" - add_index "companies", ["name"], name: "index_companies_on_name" - add_index "companies", ["state"], name: "index_companies_on_state" - create_table "people", force: :cascade do |t| t.integer "age" t.date "birthdate" diff --git a/spec/test-app/.gitignore b/spec/test-app/.gitignore index 050c9d9..f92525c 100644 --- a/spec/test-app/.gitignore +++ b/spec/test-app/.gitignore @@ -1,17 +1,34 @@ # See https://help.github.com/articles/ignoring-files for more about ignoring files. # -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile '~/.gitignore_global' +# Temporary files generated by your text editor or operating system +# belong in git's global ignore instead: +# `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore` # Ignore bundler config. /.bundle -# Ignore the default SQLite database. -/db/*.sqlite3 -/db/*.sqlite3-journal +# Ignore all environment files. +/.env* # Ignore all logfiles and tempfiles. /log/* +/tmp/* !/log/.keep -/tmp +!/tmp/.keep + +# Ignore pidfiles, but keep the directory. +/tmp/pids/* +!/tmp/pids/ +!/tmp/pids/.keep + +# Ignore storage (uploaded files in development and any SQLite databases). +/storage/* +!/storage/.keep +/tmp/storage/* +!/tmp/storage/ +!/tmp/storage/.keep + +/public/assets + +# Ignore master key for decrypting credentials and more. +/config/master.key diff --git a/spec/test-app/Gemfile b/spec/test-app/Gemfile index 7ab0618..53f0e0c 100644 --- a/spec/test-app/Gemfile +++ b/spec/test-app/Gemfile @@ -1,8 +1,6 @@ -source 'https://rubygems.org' +source "https://rubygems.org" -# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.2.5.2' +# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" +gem "rails", "~> 8.0.2" # Use sqlite3 as the database for Active Record -gem 'sqlite3' - -gem 'fix-db-schema-conflicts', path: '../..' +gem "sqlite3", ">= 2.1" diff --git a/spec/test-app/Gemfile.lock b/spec/test-app/Gemfile.lock index c0941b9..cbabf40 100644 --- a/spec/test-app/Gemfile.lock +++ b/spec/test-app/Gemfile.lock @@ -1,125 +1,218 @@ -PATH - remote: ../.. - specs: - fix-db-schema-conflicts (1.2.0) - rubocop (>= 0.36.0) - GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.5.2) - actionpack (= 4.2.5.2) - actionview (= 4.2.5.2) - activejob (= 4.2.5.2) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.5.2) - actionview (= 4.2.5.2) - activesupport (= 4.2.5.2) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.5.2) - activesupport (= 4.2.5.2) + actioncable (8.0.2) + actionpack (= 8.0.2) + activesupport (= 8.0.2) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (8.0.2) + actionpack (= 8.0.2) + activejob (= 8.0.2) + activerecord (= 8.0.2) + activestorage (= 8.0.2) + activesupport (= 8.0.2) + mail (>= 2.8.0) + actionmailer (8.0.2) + actionpack (= 8.0.2) + actionview (= 8.0.2) + activejob (= 8.0.2) + activesupport (= 8.0.2) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (8.0.2) + actionview (= 8.0.2) + activesupport (= 8.0.2) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (8.0.2) + actionpack (= 8.0.2) + activerecord (= 8.0.2) + activestorage (= 8.0.2) + activesupport (= 8.0.2) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (8.0.2) + activesupport (= 8.0.2) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.5.2) - activesupport (= 4.2.5.2) - globalid (>= 0.3.0) - activemodel (4.2.5.2) - activesupport (= 4.2.5.2) - builder (~> 3.1) - activerecord (4.2.5.2) - activemodel (= 4.2.5.2) - activesupport (= 4.2.5.2) - arel (~> 6.0) - activesupport (4.2.5.2) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - arel (6.0.3) - ast (2.2.0) - builder (3.2.2) - concurrent-ruby (1.0.1) - erubis (2.7.0) - globalid (0.3.6) - activesupport (>= 4.1.0) - i18n (0.7.0) - json (1.8.3) - loofah (2.0.3) - nokogiri (>= 1.5.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) - mime-types (2.99.1) - mini_portile2 (2.0.0) - minitest (5.8.4) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) - parser (2.3.0.6) - ast (~> 2.2) - powerpack (0.1.1) - rack (1.6.4) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.5.2) - actionmailer (= 4.2.5.2) - actionpack (= 4.2.5.2) - actionview (= 4.2.5.2) - activejob (= 4.2.5.2) - activemodel (= 4.2.5.2) - activerecord (= 4.2.5.2) - activesupport (= 4.2.5.2) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.5.2) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) - railties (4.2.5.2) - actionpack (= 4.2.5.2) - activesupport (= 4.2.5.2) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rainbow (2.1.0) - rake (11.1.1) - rubocop (0.38.0) - parser (>= 2.3.0.6, < 3.0) - powerpack (~> 0.1) - rainbow (>= 1.99.1, < 3.0) - ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.7.5) - sprockets (3.5.2) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (8.0.2) + activesupport (= 8.0.2) + globalid (>= 0.3.6) + activemodel (8.0.2) + activesupport (= 8.0.2) + activerecord (8.0.2) + activemodel (= 8.0.2) + activesupport (= 8.0.2) + timeout (>= 0.4.0) + activestorage (8.0.2) + actionpack (= 8.0.2) + activejob (= 8.0.2) + activerecord (= 8.0.2) + activesupport (= 8.0.2) + marcel (~> 1.0) + activesupport (8.0.2) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.9) + builder (3.3.0) + concurrent-ruby (1.3.5) + connection_pool (2.5.2) + crass (1.0.6) + date (3.4.1) + drb (2.2.1) + erubi (1.13.1) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + io-console (0.8.0) + irb (1.15.2) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + logger (1.7.0) + loofah (2.24.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + mini_mime (1.1.5) + minitest (5.25.5) + net-imap (0.5.7) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.1) + net-protocol + nio4r (2.7.4) + nokogiri (1.18.8-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.8-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.18.8-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.8-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.18.8-arm64-darwin) + racc (~> 1.4) + nokogiri (1.18.8-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.18.8-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.8-x86_64-linux-musl) + racc (~> 1.4) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + psych (5.2.3) + date + stringio + racc (1.8.1) + rack (3.1.13) + rack-session (2.1.0) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) + rack (>= 1.3) + rackup (2.2.1) + rack (>= 3) + rails (8.0.2) + actioncable (= 8.0.2) + actionmailbox (= 8.0.2) + actionmailer (= 8.0.2) + actionpack (= 8.0.2) + actiontext (= 8.0.2) + actionview (= 8.0.2) + activejob (= 8.0.2) + activemodel (= 8.0.2) + activerecord (= 8.0.2) + activestorage (= 8.0.2) + activesupport (= 8.0.2) + bundler (>= 1.15.0) + railties (= 8.0.2) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.0.2) + actionpack (= 8.0.2) + activesupport (= 8.0.2) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rake (13.2.1) + rdoc (6.13.1) + psych (>= 4.0.0) + reline (0.6.1) + io-console (~> 0.5) + securerandom (0.4.1) + sqlite3 (2.6.0-aarch64-linux-gnu) + sqlite3 (2.6.0-aarch64-linux-musl) + sqlite3 (2.6.0-arm-linux-gnu) + sqlite3 (2.6.0-arm-linux-musl) + sqlite3 (2.6.0-arm64-darwin) + sqlite3 (2.6.0-x86_64-darwin) + sqlite3 (2.6.0-x86_64-linux-gnu) + sqlite3 (2.6.0-x86_64-linux-musl) + stringio (3.1.7) + thor (1.3.2) + timeout (0.4.3) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.0.4) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - sqlite3 (1.3.11) - thor (0.19.1) - thread_safe (0.3.5) - tzinfo (1.2.2) - thread_safe (~> 0.1) - unicode-display_width (1.0.2) + uri (1.0.3) + useragent (0.16.11) + websocket-driver (0.7.7) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.7.2) PLATFORMS - ruby + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES - fix-db-schema-conflicts! - rails (= 4.2.5.2) - sqlite3 + rails (~> 8.0.2) + sqlite3 (>= 2.1) BUNDLED WITH - 1.10.6 + 2.6.8 diff --git a/spec/test-app/Rakefile b/spec/test-app/Rakefile index ba6b733..9a5ea73 100644 --- a/spec/test-app/Rakefile +++ b/spec/test-app/Rakefile @@ -1,6 +1,6 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require File.expand_path('../config/application', __FILE__) +require_relative "config/application" Rails.application.load_tasks diff --git a/spec/test-app/app/assets/config/manifest.js b/spec/test-app/app/assets/config/manifest.js deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/app/assets/images/.keep b/spec/test-app/app/assets/images/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/app/assets/javascripts/application.js b/spec/test-app/app/assets/javascripts/application.js deleted file mode 100644 index e07c5a8..0000000 --- a/spec/test-app/app/assets/javascripts/application.js +++ /dev/null @@ -1,16 +0,0 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, -// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// compiled file. -// -// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details -// about supported directives. -// -//= require jquery -//= require jquery_ujs -//= require turbolinks -//= require_tree . diff --git a/spec/test-app/app/assets/stylesheets/application.css b/spec/test-app/app/assets/stylesheets/application.css deleted file mode 100644 index f9cd5b3..0000000 --- a/spec/test-app/app/assets/stylesheets/application.css +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, - * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the bottom of the - * compiled file so the styles you add here take precedence over styles defined in any styles - * defined in the other CSS/SCSS files in this directory. It is generally better to create a new - * file per style scope. - * - *= require_tree . - *= require_self - */ diff --git a/spec/test-app/app/controllers/application_controller.rb b/spec/test-app/app/controllers/application_controller.rb index d83690e..0d95db2 100644 --- a/spec/test-app/app/controllers/application_controller.rb +++ b/spec/test-app/app/controllers/application_controller.rb @@ -1,5 +1,4 @@ class ApplicationController < ActionController::Base - # Prevent CSRF attacks by raising an exception. - # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :exception + # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. + allow_browser versions: :modern end diff --git a/spec/test-app/app/controllers/concerns/.keep b/spec/test-app/app/controllers/concerns/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/app/helpers/application_helper.rb b/spec/test-app/app/helpers/application_helper.rb deleted file mode 100644 index de6be79..0000000 --- a/spec/test-app/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/spec/test-app/app/mailers/.keep b/spec/test-app/app/mailers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/app/models/.keep b/spec/test-app/app/models/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/app/models/application_record.rb b/spec/test-app/app/models/application_record.rb new file mode 100644 index 0000000..b63caeb --- /dev/null +++ b/spec/test-app/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + primary_abstract_class +end diff --git a/spec/test-app/app/models/company.rb b/spec/test-app/app/models/company.rb index 4ac174e..a149860 100644 --- a/spec/test-app/app/models/company.rb +++ b/spec/test-app/app/models/company.rb @@ -1,2 +1,2 @@ -class Company < ActiveRecord::Base +class Company < ApplicationRecord end diff --git a/spec/test-app/app/models/concerns/.keep b/spec/test-app/app/models/concerns/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/app/models/person.rb b/spec/test-app/app/models/person.rb index 2f2e286..a8b1b85 100644 --- a/spec/test-app/app/models/person.rb +++ b/spec/test-app/app/models/person.rb @@ -1,2 +1,2 @@ -class Person < ActiveRecord::Base +class Person < ApplicationRecord end diff --git a/spec/test-app/app/views/layouts/application.html.erb b/spec/test-app/app/views/layouts/application.html.erb deleted file mode 100644 index 797902d..0000000 --- a/spec/test-app/app/views/layouts/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - TestApp - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> - <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/spec/test-app/bin/rails b/spec/test-app/bin/rails index 0138d79..efc0377 100755 --- a/spec/test-app/bin/rails +++ b/spec/test-app/bin/rails @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end -APP_PATH = File.expand_path('../../config/application', __FILE__) -require_relative '../config/boot' -require 'rails/commands' +APP_PATH = File.expand_path("../config/application", __dir__) +require_relative "../config/boot" +require "rails/commands" diff --git a/spec/test-app/bin/rake b/spec/test-app/bin/rake index d87d5f5..4fbf10b 100755 --- a/spec/test-app/bin/rake +++ b/spec/test-app/bin/rake @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end -require_relative '../config/boot' -require 'rake' +require_relative "../config/boot" +require "rake" Rake.application.run diff --git a/spec/test-app/bin/setup b/spec/test-app/bin/setup index acdb2c1..be3db3c 100755 --- a/spec/test-app/bin/setup +++ b/spec/test-app/bin/setup @@ -1,29 +1,34 @@ #!/usr/bin/env ruby -require 'pathname' +require "fileutils" -# path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = File.expand_path("..", __dir__) -Dir.chdir APP_ROOT do - # This script is a starting point to setup your application. - # Add necessary setup steps to this file: +def system!(*args) + system(*args, exception: true) +end + +FileUtils.chdir APP_ROOT do + # This script is a way to set up or update your development environment automatically. + # This script is idempotent, so that you can run it at any time and get an expectable outcome. + # Add necessary setup steps to this file. puts "== Installing dependencies ==" - system "gem install bundler --conservative" - system "bundle check || bundle install" + system("bundle check") || system!("bundle install") # puts "\n== Copying sample files ==" # unless File.exist?("config/database.yml") - # system "cp config/database.yml.sample config/database.yml" + # FileUtils.cp "config/database.yml.sample", "config/database.yml" # end puts "\n== Preparing database ==" - system "bin/rake db:setup" + system! "bin/rails db:prepare" puts "\n== Removing old logs and tempfiles ==" - system "rm -f log/*" - system "rm -rf tmp/cache" + system! "bin/rails log:clear tmp:clear" - puts "\n== Restarting application server ==" - system "touch tmp/restart.txt" + unless ARGV.include?("--skip-server") + puts "\n== Starting development server ==" + STDOUT.flush # flush the output before exec(2) so that it displays + exec "bin/dev" + end end diff --git a/spec/test-app/bin/spring b/spec/test-app/bin/spring deleted file mode 100755 index 7fe232c..0000000 --- a/spec/test-app/bin/spring +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby - -# This file loads spring without using Bundler, in order to be fast. -# It gets overwritten when you run the `spring binstub` command. - -unless defined?(Spring) - require 'rubygems' - require 'bundler' - - if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) - Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) } - gem 'spring', match[1] - require 'spring/binstub' - end -end diff --git a/spec/test-app/config.ru b/spec/test-app/config.ru index bd83b25..4a3c09a 100644 --- a/spec/test-app/config.ru +++ b/spec/test-app/config.ru @@ -1,4 +1,6 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require_relative "config/environment" + run Rails.application +Rails.application.load_server diff --git a/spec/test-app/config/application.rb b/spec/test-app/config/application.rb index bb2521d..a6161bc 100644 --- a/spec/test-app/config/application.rb +++ b/spec/test-app/config/application.rb @@ -1,6 +1,18 @@ -require File.expand_path('../boot', __FILE__) +require_relative "boot" -require 'rails/all' +require "rails" +# Pick the frameworks you want: +require "active_model/railtie" +# require "active_job/railtie" +require "active_record/railtie" +# require "active_storage/engine" +require "action_controller/railtie" +# require "action_mailer/railtie" +# require "action_mailbox/engine" +# require "action_text/engine" +require "action_view/railtie" +# require "action_cable/engine" +require "rails/test_unit/railtie" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. @@ -8,19 +20,23 @@ module TestApp class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 8.0 - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' + # Please, add to the `ignore` list any other `lib` subdirectories that do + # not contain `.rb` files, or that should not be reloaded or eager loaded. + # Common ones are `templates`, `generators`, or `middleware`, for example. + config.autoload_lib(ignore: %w[assets tasks]) - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de + # Configuration for the application, engines, and railties goes here. + # + # These settings can be overridden in specific environments using the files + # in config/environments, which are processed later. + # + # config.time_zone = "Central Time (US & Canada)" + # config.eager_load_paths << Rails.root.join("extras") - # Do not swallow errors in after_commit/after_rollback callbacks. - config.active_record.raise_in_transactional_callbacks = true + # Don't generate system test files. + config.generators.system_tests = nil end end diff --git a/spec/test-app/config/boot.rb b/spec/test-app/config/boot.rb index 6b750f0..2820116 100644 --- a/spec/test-app/config/boot.rb +++ b/spec/test-app/config/boot.rb @@ -1,3 +1,3 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) -require 'bundler/setup' # Set up gems listed in the Gemfile. +require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/spec/test-app/config/database.yml b/spec/test-app/config/database.yml index 1c1a37c..01bebb5 100644 --- a/spec/test-app/config/database.yml +++ b/spec/test-app/config/database.yml @@ -1,25 +1,32 @@ -# SQLite version 3.x +# SQLite. Versions 3.8.0 and up are supported. # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' +# gem "sqlite3" # default: &default adapter: sqlite3 - pool: 5 + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 development: <<: *default - database: db/development.sqlite3 + database: storage/development.sqlite3 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default - database: db/test.sqlite3 + database: storage/test.sqlite3 + +# SQLite3 write its data on the local filesystem, as such it requires +# persistent disks. If you are deploying to a managed service, you should +# make sure it provides disk persistence, as many don't. +# +# Similarly, if you deploy your application as a Docker container, you must +# ensure the database is located in a persisted volume. production: <<: *default - database: db/production.sqlite3 + # database: path/to/persistent/storage/production.sqlite3 diff --git a/spec/test-app/config/environment.rb b/spec/test-app/config/environment.rb index ee8d90d..cac5315 100644 --- a/spec/test-app/config/environment.rb +++ b/spec/test-app/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) +require_relative "application" # Initialize the Rails application. Rails.application.initialize! diff --git a/spec/test-app/config/environments/development.rb b/spec/test-app/config/environments/development.rb index b55e214..ab2b0a8 100644 --- a/spec/test-app/config/environments/development.rb +++ b/spec/test-app/config/environments/development.rb @@ -1,20 +1,32 @@ +require "active_support/core_ext/integer/time" + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false + # Make code changes take effect immediately without server restart. + config.enable_reloading = true # Do not eager load code on boot. config.eager_load = false - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + # Show full error reports. + config.consider_all_requests_local = true + + # Enable server timing. + config.server_timing = true - # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = false + # Enable/disable Action Controller caching. By default Action Controller caching is disabled. + # Run rails dev:cache to toggle Action Controller caching. + if Rails.root.join("tmp/caching-dev.txt").exist? + config.action_controller.perform_caching = true + config.action_controller.enable_fragment_cache_logging = true + config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" } + else + config.action_controller.perform_caching = false + end + + # Change to :null_store to avoid any caching. + config.cache_store = :memory_store # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log @@ -22,20 +34,18 @@ # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large - # number of complex assets. - config.assets.debug = true + # Highlight code that triggered database queries in logs. + config.active_record.verbose_query_logs = true + + # Append comments with runtime information tags to SQL queries in logs. + config.active_record.query_log_tags_enabled = true - # Asset digests allow you to set far-future HTTP expiration dates on all assets, - # yet still be able to expire them through the digest params. - config.assets.digest = true + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true - # Adds additional error checking when serving assets at runtime. - # Checks for improperly declared sprockets dependencies. - # Raises helpful error messages. - config.assets.raise_runtime_errors = true + # Annotate rendered view with file names. + config.action_view.annotate_rendered_view_with_filenames = true - # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true + # Raise error when a before_action's only/except options reference missing actions. + config.action_controller.raise_on_missing_callback_actions = true end diff --git a/spec/test-app/config/environments/production.rb b/spec/test-app/config/environments/production.rb index 5c1b32e..4ea4599 100644 --- a/spec/test-app/config/environments/production.rb +++ b/spec/test-app/config/environments/production.rb @@ -1,79 +1,67 @@ +require "active_support/core_ext/integer/time" + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. - config.cache_classes = true + config.enable_reloading = false - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. + # Eager load code on boot for better performance and memory savings (ignored by Rake tasks). config.eager_load = true - # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Enable Rack::Cache to put a simple HTTP cache in front of your application - # Add `rack-cache` to your Gemfile before enabling this. - # For large-scale production use, consider using a caching reverse proxy like - # NGINX, varnish or squid. - # config.action_dispatch.rack_cache = true - - # Disable serving static files from the `/public` folder by default since - # Apache or NGINX already handles this. - config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + # Full error reports are disabled. + config.consider_all_requests_local = false - # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier - # config.assets.css_compressor = :sass - - # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false + # Turn on fragment caching in view templates. + config.action_controller.perform_caching = true - # Asset digests allow you to set far-future HTTP expiration dates on all assets, - # yet still be able to expire them through the digest params. - config.assets.digest = true + # Cache assets for far-future expiry since they are all digest stamped. + config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" } - # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.asset_host = "http://assets.example.com" - # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # Assume all access to the app is happening through a SSL-terminating reverse proxy. + config.assume_ssl = true # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true + config.force_ssl = true - # Use the lowest log level to ensure availability of diagnostic information - # when problems arise. - config.log_level = :debug + # Skip http-to-https redirect for the default health check endpoint. + # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } } - # Prepend all log lines with the following tags. - # config.log_tags = [ :subdomain, :uuid ] + # Log to STDOUT with the current request id as a default log tag. + config.log_tags = [ :request_id ] + config.logger = ActiveSupport::TaggedLogging.logger(STDOUT) - # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + # Change to "debug" to log everything (including potentially personally-identifiable information!) + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") - # Use a different cache store in production. - # config.cache_store = :mem_cache_store + # Prevent health checks from clogging up the logs. + config.silence_healthcheck_path = "/up" - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' + # Don't log any deprecations. + config.active_support.report_deprecations = false - # Ignore bad email addresses and do not raise email delivery errors. - # Set this to true and configure the email server for immediate delivery to raise delivery errors. - # config.action_mailer.raise_delivery_errors = false + # Replace the default in-process memory cache store with a durable alternative. + # config.cache_store = :mem_cache_store # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new - # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + # Only use :id for inspections in production. + config.active_record.attributes_for_inspect = [ :id ] + + # Enable DNS rebinding protection and other `Host` header attacks. + # config.hosts = [ + # "example.com", # Allow requests from example.com + # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` + # ] + # + # Skip DNS rebinding protection for the default health check endpoint. + # config.host_authorization = { exclude: ->(request) { request.path == "/up" } } end diff --git a/spec/test-app/config/environments/test.rb b/spec/test-app/config/environments/test.rb index 1c19f08..14bc29e 100644 --- a/spec/test-app/config/environments/test.rb +++ b/spec/test-app/config/environments/test.rb @@ -1,42 +1,42 @@ +# The test environment is used exclusively to run your application's +# test suite. You never need to work with it otherwise. Remember that +# your test database is "scratch space" for the test suite and is wiped +# and recreated between test runs. Don't rely on the data there! + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = true + # While tests run files are not watched, reloading is not necessary. + config.enable_reloading = false - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = false + # Eager loading loads your entire application. When running a single test locally, + # this is usually not necessary, and can slow down your test suite. However, it's + # recommended that you enable it in continuous integration systems to ensure eager + # loading is working properly before deploying your code. + config.eager_load = ENV["CI"].present? - # Configure static file server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = 'public, max-age=3600' + # Configure public file server for tests with cache-control for performance. + config.public_file_server.headers = { "cache-control" => "public, max-age=3600" } - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + # Show full error reports. + config.consider_all_requests_local = true + config.cache_store = :null_store - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + # Render exception templates for rescuable exceptions and raise for other exceptions. + config.action_dispatch.show_exceptions = :rescuable # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Randomize the order test cases are executed. - config.active_support.test_order = :random - # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions. + config.action_controller.raise_on_missing_callback_actions = true end diff --git a/spec/test-app/config/initializers/assets.rb b/spec/test-app/config/initializers/assets.rb deleted file mode 100644 index 01ef3e6..0000000 --- a/spec/test-app/config/initializers/assets.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' - -# Add additional assets to the asset load path -# Rails.application.config.assets.paths << Emoji.images_path - -# Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/spec/test-app/config/initializers/filter_parameter_logging.rb b/spec/test-app/config/initializers/filter_parameter_logging.rb index 4a994e1..c0b717f 100644 --- a/spec/test-app/config/initializers/filter_parameter_logging.rb +++ b/spec/test-app/config/initializers/filter_parameter_logging.rb @@ -1,4 +1,8 @@ # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] +# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. +# Use this to limit dissemination of sensitive information. +# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. +Rails.application.config.filter_parameters += [ + :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc +] diff --git a/spec/test-app/config/initializers/inflections.rb b/spec/test-app/config/initializers/inflections.rb index ac033bf..3860f65 100644 --- a/spec/test-app/config/initializers/inflections.rb +++ b/spec/test-app/config/initializers/inflections.rb @@ -4,13 +4,13 @@ # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' +# inflect.acronym "RESTful" # end diff --git a/spec/test-app/config/locales/en.yml b/spec/test-app/config/locales/en.yml index 0653957..6c349ae 100644 --- a/spec/test-app/config/locales/en.yml +++ b/spec/test-app/config/locales/en.yml @@ -1,14 +1,14 @@ -# Files in the config/locales directory are used for internationalization -# and are automatically loaded by Rails. If you want to use locales other -# than English, add the necessary files in this directory. +# Files in the config/locales directory are used for internationalization and +# are automatically loaded by Rails. If you want to use locales other than +# English, add the necessary files in this directory. # # To use the locales, use `I18n.t`: # -# I18n.t 'hello' +# I18n.t "hello" # # In views, this is aliased to just `t`: # -# <%= t('hello') %> +# <%= t("hello") %> # # To use a different locale, set it with `I18n.locale`: # @@ -16,8 +16,16 @@ # # This would use the information in config/locales/es.yml. # -# To learn more, please read the Rails Internationalization guide -# available at http://guides.rubyonrails.org/i18n.html. +# To learn more about the API, please read the Rails Internationalization guide +# at https://guides.rubyonrails.org/i18n.html. +# +# Be aware that YAML interprets the following case-insensitive strings as +# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings +# must be quoted to be interpreted as strings. For example: +# +# en: +# "yes": yup +# enabled: "ON" en: hello: "Hello world" diff --git a/spec/test-app/config/routes.rb b/spec/test-app/config/routes.rb index 3f66539..48254e8 100644 --- a/spec/test-app/config/routes.rb +++ b/spec/test-app/config/routes.rb @@ -1,56 +1,14 @@ Rails.application.routes.draw do - # The priority is based upon order of creation: first created -> highest priority. - # See how all your routes lay out with "rake routes". + # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html - # You can have the root of your site routed with "root" - # root 'welcome#index' + # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. + # Can be used by load balancers and uptime monitors to verify that the app is live. + get "up" => "rails/health#show", as: :rails_health_check - # Example of regular route: - # get 'products/:id' => 'catalog#view' + # Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb) + # get "manifest" => "rails/pwa#manifest", as: :pwa_manifest + # get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker - # Example of named route that can be invoked with purchase_url(id: product.id) - # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase - - # Example resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Example resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Example resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Example resource route with more complex sub-resources: - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', on: :collection - # end - # end - - # Example resource route with concerns: - # concern :toggleable do - # post 'toggle' - # end - # resources :posts, concerns: :toggleable - # resources :photos, concerns: :toggleable - - # Example resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end + # Defines the root path route ("/") + # root "posts#index" end diff --git a/spec/test-app/db/migrate/20160322223225_create_people.rb b/spec/test-app/db/migrate/20160322223225_create_people.rb index 74ab5a3..baeecea 100644 --- a/spec/test-app/db/migrate/20160322223225_create_people.rb +++ b/spec/test-app/db/migrate/20160322223225_create_people.rb @@ -1,4 +1,4 @@ -class CreatePeople < ActiveRecord::Migration +class CreatePeople < ActiveRecord::Migration[8.0] def change create_table :people do |t| t.string :first_name diff --git a/spec/test-app/db/migrate/20160322223258_create_companies.rb b/spec/test-app/db/migrate/20160322223258_create_companies.rb index b3d0de0..c291433 100644 --- a/spec/test-app/db/migrate/20160322223258_create_companies.rb +++ b/spec/test-app/db/migrate/20160322223258_create_companies.rb @@ -1,4 +1,4 @@ -class CreateCompanies < ActiveRecord::Migration +class CreateCompanies < ActiveRecord::Migration[8.0] def change create_table :companies do |t| t.string :name diff --git a/spec/test-app/db/schema.rb b/spec/test-app/db/schema.rb index d1311a0..b76ff9f 100644 --- a/spec/test-app/db/schema.rb +++ b/spec/test-app/db/schema.rb @@ -2,15 +2,15 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160322223258) do +ActiveRecord::Schema[8.0].define(version: 2016_03_22_223258) do create_table "companies", force: :cascade do |t| t.string "addr1" t.string "addr2" @@ -21,12 +21,11 @@ t.string "state" t.datetime "updated_at", null: false t.string "zip" + t.index ["city"], name: "index_companies_on_city" + t.index ["name"], name: "index_companies_on_name" + t.index ["state"], name: "index_companies_on_state" end - add_index "companies", ["city"], name: "index_companies_on_city" - add_index "companies", ["name"], name: "index_companies_on_name" - add_index "companies", ["state"], name: "index_companies_on_state" - create_table "people", force: :cascade do |t| t.integer "age" t.date "birthdate" diff --git a/spec/test-app/db/seeds.rb b/spec/test-app/db/seeds.rb index 4edb1e8..4fbd6ed 100644 --- a/spec/test-app/db/seeds.rb +++ b/spec/test-app/db/seeds.rb @@ -1,7 +1,9 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# This file should ensure the existence of records required to run the application in every environment (production, +# development, test). The code here should be idempotent so that it can be executed at any point in every environment. +# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). # -# Examples: +# Example: # -# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) -# Mayor.create(name: 'Emanuel', city: cities.first) +# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name| +# MovieGenre.find_or_create_by!(name: genre_name) +# end diff --git a/spec/test-app/lib/assets/.keep b/spec/test-app/lib/assets/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/lib/tasks/.keep b/spec/test-app/lib/tasks/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/log/.keep b/spec/test-app/log/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/public/404.html b/spec/test-app/public/404.html deleted file mode 100644 index b612547..0000000 --- a/spec/test-app/public/404.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - - -
-
-

The page you were looking for doesn't exist.

-

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

-
-

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

-
- - diff --git a/spec/test-app/public/422.html b/spec/test-app/public/422.html deleted file mode 100644 index a21f82b..0000000 --- a/spec/test-app/public/422.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - - -
-
-

The change you wanted was rejected.

-

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

-
-

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

-
- - diff --git a/spec/test-app/public/500.html b/spec/test-app/public/500.html deleted file mode 100644 index 061abc5..0000000 --- a/spec/test-app/public/500.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - - -
-
-

We're sorry, but something went wrong.

-
-

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

-
- - diff --git a/spec/test-app/public/favicon.ico b/spec/test-app/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/public/robots.txt b/spec/test-app/public/robots.txt deleted file mode 100644 index 3c9c7c0..0000000 --- a/spec/test-app/public/robots.txt +++ /dev/null @@ -1,5 +0,0 @@ -# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file -# -# To ban all spiders from the entire site uncomment the next two lines: -# User-agent: * -# Disallow: / diff --git a/spec/test-app/test/controllers/.keep b/spec/test-app/test/controllers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/test/fixtures/.keep b/spec/test-app/test/fixtures/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/test/fixtures/companies.yml b/spec/test-app/test/fixtures/companies.yml deleted file mode 100644 index b4147d1..0000000 --- a/spec/test-app/test/fixtures/companies.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -one: - name: MyString - addr1: MyString - addr2: MyString - city: MyString - state: MyString - zip: MyString - phone: MyString - -two: - name: MyString - addr1: MyString - addr2: MyString - city: MyString - state: MyString - zip: MyString - phone: MyString diff --git a/spec/test-app/test/fixtures/people.yml b/spec/test-app/test/fixtures/people.yml deleted file mode 100644 index 21be9fc..0000000 --- a/spec/test-app/test/fixtures/people.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -one: - first_name: MyString - last_name: MyString - age: 1 - birthdate: 2016-03-22 - -two: - first_name: MyString - last_name: MyString - age: 1 - birthdate: 2016-03-22 diff --git a/spec/test-app/test/helpers/.keep b/spec/test-app/test/helpers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/test/integration/.keep b/spec/test-app/test/integration/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/test/mailers/.keep b/spec/test-app/test/mailers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/test/models/.keep b/spec/test-app/test/models/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/test/models/company_test.rb b/spec/test-app/test/models/company_test.rb deleted file mode 100644 index 492faef..0000000 --- a/spec/test-app/test/models/company_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class CompanyTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/spec/test-app/test/models/person_test.rb b/spec/test-app/test/models/person_test.rb deleted file mode 100644 index ad04ed8..0000000 --- a/spec/test-app/test/models/person_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class PersonTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/spec/test-app/test/test_helper.rb b/spec/test-app/test/test_helper.rb deleted file mode 100644 index 92e39b2..0000000 --- a/spec/test-app/test/test_helper.rb +++ /dev/null @@ -1,10 +0,0 @@ -ENV['RAILS_ENV'] ||= 'test' -require File.expand_path('../../config/environment', __FILE__) -require 'rails/test_help' - -class ActiveSupport::TestCase - # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. - fixtures :all - - # Add more helper methods to be used by all tests here... -end diff --git a/spec/test-app/vendor/assets/javascripts/.keep b/spec/test-app/vendor/assets/javascripts/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/test-app/vendor/assets/stylesheets/.keep b/spec/test-app/vendor/assets/stylesheets/.keep deleted file mode 100644 index e69de29..0000000