From d803cd1a020df7ff79f7d6b47f3775e03cc4168f Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Sun, 5 Mar 2017 23:00:35 -1000 Subject: [PATCH] Updated spec/dummy to Rails 5 * Upgraded all dependencies of spec/dummy * Changed default to Turbolinks 5.0.1 * Removed support for capybara-webkit * Remove 2.1 from travis => Rails 5 requires 2.2 --- .eslintignore | 1 + .travis.yml | 4 +- CONTRIBUTING.md | 2 +- Gemfile | 9 +- rakelib/dummy_apps.rake | 4 +- rakelib/run_rspec.rake | 8 +- rakelib/task_helpers.rb | 4 +- spec/dummy/Gemfile | 18 +- spec/dummy/Gemfile.lock | 191 +++++++++--------- spec/dummy/config/application.rb | 11 - spec/dummy/config/environments/development.rb | 36 ++-- spec/dummy/config/environments/production.rb | 41 ++-- spec/dummy/config/environments/test.rb | 9 +- spec/dummy/spec/rails_helper.rb | 5 +- spec/dummy/spec/support/capybara_utils.rb | 7 +- 15 files changed, 185 insertions(+), 165 deletions(-) diff --git a/.eslintignore b/.eslintignore index 837991e7f..e0b10d03b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -10,3 +10,4 @@ node_package/webpack.config.js **/generated/** **/app/assets/javascripts/application.js **/coverage/** +**/cable.js diff --git a/.travis.yml b/.travis.yml index 1c2036555..8e22633b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,8 @@ language: ruby rvm: # Ruby 2.0.0 fails due to newer Nokogir # nokogiri-1.7.0.1 requires ruby version >= 2.1.0, which is incompatible with the current version, ruby 2.0.0p648 - - 2.1.10 + # Rails 5 requires 2.2 + # - 2.1.10 - 2.2.6 - 2.3.1 services: @@ -25,7 +26,6 @@ env: - RAILS_ENV=test - DRIVER=selenium_chrome - CHROME_BIN=/usr/bin/google-chrome - - ENABLE_TURBOLINKS_5=TRUE - USE_COVERALLS=TRUE before_install: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6a2db43ce..acf222d88 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -195,7 +195,7 @@ If you run `rspec` at the top level, you'll see this message: `require': cannot After running a test, you can view the coverage results SimpleCov reports by opening `coverage/index.html`. -To test `spec/dummy` against Turbolinks 5, install the gem by running `ENABLE_TURBOLINKS_5=TRUE bundle install` in the `spec/dummy` directory before running `rake`. +To test `spec/dummy` against Turbolinks 2, install the gem by running `ENABLE_TURBOLINKS_2=TRUE bundle install` in the `spec/dummy` directory before running `rake`. Turbolinks 5 is the default. Run `rake -T` or `rake -D` to see testing options. diff --git a/Gemfile b/Gemfile index 8ee7caead..ed60189b5 100644 --- a/Gemfile +++ b/Gemfile @@ -22,10 +22,10 @@ gem "sdoc", "~> 0.4.0", group: :doc gem "spring" gem "sqlite3" gem "mini_racer" -if ENV["ENABLE_TURBOLINKS_5"].nil? || ENV["ENABLE_TURBOLINKS_5"].strip.empty? - gem "turbolinks", "2.5.3" -else +if ENV["ENABLE_TURBOLINKS_2"].nil? || ENV["ENABLE_TURBOLINKS_2"].strip.empty? gem "turbolinks", "~> 5.0" +else + gem "turbolinks", "2.5.3" end gem "uglifier", ">= 2.7.2" gem "web-console", "~> 2.0", group: :development @@ -35,7 +35,8 @@ gem "rspec-rails" gem "rspec-retry" gem "capybara" gem "capybara-screenshot" -gem "capybara-webkit" +# Trouble installing on Sierra +# gem "capybara-webkit" gem "chromedriver-helper" gem "launchy" gem "poltergeist" diff --git a/rakelib/dummy_apps.rake b/rakelib/dummy_apps.rake index 5c14bc6fc..827f39601 100644 --- a/rakelib/dummy_apps.rake +++ b/rakelib/dummy_apps.rake @@ -8,9 +8,9 @@ namespace :dummy_apps do sh_in_dir(dummy_app_dir, "yarn install --mutex network") end - task :dummy_app_with_turbolinks_5 do + task :dummy_app_with_turbolinks_2 do dummy_app_dir = File.join(gem_root, "spec/dummy") - bundle_install_with_turbolinks_5_in(dummy_app_dir) + bundle_install_with_turbolinks_2_in(dummy_app_dir) sh_in_dir(dummy_app_dir, "yarn install --mutex network") end diff --git a/rakelib/run_rspec.rake b/rakelib/run_rspec.rake index 2a9abb09e..63c998406 100644 --- a/rakelib/run_rspec.rake +++ b/rakelib/run_rspec.rake @@ -32,11 +32,11 @@ namespace :run_rspec do bundle_install_in(dummy_app_dir) end - desc "Runs dummy respec with turbolinks 5" - task dummy_turbolinks_5: ["dummy_apps:dummy_app_with_turbolinks_5"] do + desc "Runs dummy respec with turbolinks 2" + task dummy_turbolinks_2: ["dummy_apps:dummy_app_with_turbolinks_2"] do clean_gen_assets(spec_dummy_dir) run_tests_in(spec_dummy_dir, env_vars: - "ENABLE_TURBOLINKS_5=TRUE BUNDLE_GEMFILE=#{dummy_app_dir}/Gemfile") + "ENABLE_TURBOLINKS_2=TRUE BUNDLE_GEMFILE=#{dummy_app_dir}/Gemfile") end # Dynamically define Rake tasks for each example app found in the examples directory @@ -62,7 +62,7 @@ namespace :run_rspec do end desc "run all tests no examples" - task all_but_examples: [:gem, :dummy, :dummy_no_turbolinks, :dummy_turbolinks_5, :empty, :js_tests] do + task all_but_examples: [:gem, :dummy, :dummy_no_turbolinks, :dummy_turbolinks_2, :empty, :js_tests] do puts "Completed all RSpec tests" end diff --git a/rakelib/task_helpers.rb b/rakelib/task_helpers.rb index 21fc85188..7d8d29a00 100644 --- a/rakelib/task_helpers.rb +++ b/rakelib/task_helpers.rb @@ -28,8 +28,8 @@ def bundle_install_in_no_turbolinks(dir) sh_in_dir(dir, "DISABLE_TURBOLINKS=TRUE bundle install") end - def bundle_install_with_turbolinks_5_in(dir) - sh_in_dir(dir, "ENABLE_TURBOLINKS_5=TRUE BUNDLE_GEMFILE=#{dir}/Gemfile bundle install") + def bundle_install_with_turbolinks_2_in(dir) + sh_in_dir(dir, "ENABLE_TURBOLINKS_2=TRUE BUNDLE_GEMFILE=#{dir}/Gemfile bundle install") end # Runs bundle exec using that directory's Gemfile diff --git a/spec/dummy/Gemfile b/spec/dummy/Gemfile index 078535a47..81c4a2bb0 100644 --- a/spec/dummy/Gemfile +++ b/spec/dummy/Gemfile @@ -3,15 +3,15 @@ source 'https://rubygems.org' eval_gemfile File.expand_path("../../../react_on_rails.gemspec", __FILE__) # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.2.8' +gem 'rails' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use SCSS for stylesheets -gem 'sass-rails', '~> 5.0' +gem 'sass-rails' # Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 2.7.2' +gem 'uglifier' # Use CoffeeScript for .coffee assets and views -gem 'coffee-rails', '~> 4.1.0' +gem 'coffee-rails' # Use jquery as the JavaScript library gem 'jquery-rails' @@ -20,10 +20,10 @@ gem 'puma' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks if ENV["DISABLE_TURBOLINKS"].nil? || ENV["DISABLE_TURBOLINKS"].strip.empty? - if ENV["ENABLE_TURBOLINKS_5"].nil? || ENV["ENABLE_TURBOLINKS_5"].strip.empty? - gem 'turbolinks', '2.5.3' - else + if ENV["ENABLE_TURBOLINKS_2"].nil? || ENV["ENABLE_TURBOLINKS_2"].strip.empty? gem 'turbolinks', '~> 5.0' + else + gem 'turbolinks', '2.5.3' end end @@ -66,7 +66,9 @@ group :test do gem "coveralls", require: false gem "capybara" gem "capybara-screenshot" - gem "capybara-webkit" + gem "rails-controller-testing" + # install trouble with updated + # gem "capybara-webkit" gem "chromedriver-helper" gem "generator_spec" gem "launchy" diff --git a/spec/dummy/Gemfile.lock b/spec/dummy/Gemfile.lock index 89ac15f5a..0783e07af 100644 --- a/spec/dummy/Gemfile.lock +++ b/spec/dummy/Gemfile.lock @@ -11,52 +11,55 @@ PATH GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.8) - actionpack (= 4.2.8) - actionview (= 4.2.8) - activejob (= 4.2.8) + actioncable (5.0.2) + actionpack (= 5.0.2) + nio4r (>= 1.2, < 3.0) + websocket-driver (~> 0.6.1) + actionmailer (5.0.2) + actionpack (= 5.0.2) + actionview (= 5.0.2) + activejob (= 5.0.2) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.8) - actionview (= 4.2.8) - activesupport (= 4.2.8) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.0.2) + actionview (= 5.0.2) + activesupport (= 5.0.2) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.8) - activesupport (= 4.2.8) + actionview (5.0.2) + activesupport (= 5.0.2) builder (~> 3.1) erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.8) - activesupport (= 4.2.8) - globalid (>= 0.3.0) - activemodel (4.2.8) - activesupport (= 4.2.8) - builder (~> 3.1) - activerecord (4.2.8) - activemodel (= 4.2.8) - activesupport (= 4.2.8) - arel (~> 6.0) - activesupport (4.2.8) + activejob (5.0.2) + activesupport (= 5.0.2) + globalid (>= 0.3.6) + activemodel (5.0.2) + activesupport (= 5.0.2) + activerecord (5.0.2) + activemodel (= 5.0.2) + activesupport (= 5.0.2) + arel (~> 7.0) + activesupport (5.0.2) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.5.0) public_suffix (~> 2.0, >= 2.0.2) archive-zip (0.7.0) io-like (~> 0.3.0) - arel (6.0.4) + arel (7.1.4) ast (2.3.0) awesome_print (1.7.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) builder (3.2.3) byebug (9.0.6) - capybara (2.7.1) + capybara (2.12.1) addressable mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -66,37 +69,34 @@ GEM capybara-screenshot (1.0.14) capybara (>= 1.0, < 3) launchy - capybara-webkit (1.11.1) - capybara (>= 2.3.0, < 2.8.0) - json - childprocess (0.5.9) + childprocess (0.6.2) ffi (~> 1.0, >= 1.0.11) chromedriver-helper (1.0.0) archive-zip (~> 0.7.0) nokogiri (~> 1.6) cliver (0.3.2) coderay (1.1.1) - coffee-rails (4.1.1) + coffee-rails (4.2.1) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) + railties (>= 4.0.0, < 5.2.x) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.0.4) + concurrent-ruby (1.0.5) connection_pool (2.2.1) - coveralls (0.8.17) + coveralls (0.8.19) json (>= 1.8, < 3) simplecov (~> 0.12.0) term-ansicolor (~> 1.3) thor (~> 0.19.1) tins (~> 1.6) debug_inspector (0.0.2) - diff-lcs (1.2.5) + diff-lcs (1.3) docile (1.1.5) erubis (2.7.0) execjs (2.7.0) - ffi (1.9.14) + ffi (1.9.18) generator_spec (0.9.3) activesupport (>= 3.0.0) railties (>= 3.0.0) @@ -105,10 +105,10 @@ GEM i18n (0.8.1) interception (0.5) io-like (0.3.0) - jbuilder (2.6.1) - activesupport (>= 3.0.0, < 5.1) + jbuilder (2.6.3) + activesupport (>= 3.0.0, < 5.2) multi_json (~> 1.2) - jquery-rails (4.2.1) + jquery-rails (4.2.2) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -125,15 +125,16 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mini_portile2 (2.1.0) - mini_racer (0.1.7) + mini_racer (0.1.8) libv8 (~> 5.3) minitest (5.10.1) multi_json (1.12.1) + nio4r (2.0.0) nokogiri (1.7.0.1) mini_portile2 (~> 2.1.0) - parser (2.3.3.1) + parser (2.4.0.0) ast (~> 2.2) - poltergeist (1.12.0) + poltergeist (1.13.0) capybara (~> 2.1) cliver (~> 0.3.1) websocket-driver (>= 0.2.0) @@ -145,47 +146,50 @@ GEM pry-byebug (3.4.2) byebug (~> 9.0) pry (~> 0.10) - pry-doc (0.9.0) + pry-doc (0.10.0) pry (~> 0.9) - yard (~> 0.8) - pry-rails (0.3.4) + yard (~> 0.9) + pry-rails (0.3.5) pry (>= 0.9.10) - pry-rescue (1.4.4) + pry-rescue (1.4.5) interception (>= 0.5) pry pry-stack_explorer (0.4.9.2) binding_of_caller (>= 0.7) pry (>= 0.9.11) - public_suffix (2.0.4) - puma (3.6.2) - rack (1.6.5) + public_suffix (2.0.5) + puma (3.7.1) + rack (2.0.1) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.8) - actionmailer (= 4.2.8) - actionpack (= 4.2.8) - actionview (= 4.2.8) - activejob (= 4.2.8) - activemodel (= 4.2.8) - activerecord (= 4.2.8) - activesupport (= 4.2.8) + rails (5.0.2) + actioncable (= 5.0.2) + actionmailer (= 5.0.2) + actionpack (= 5.0.2) + actionview (= 5.0.2) + activejob (= 5.0.2) + activemodel (= 5.0.2) + activerecord (= 5.0.2) + activesupport (= 5.0.2) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.8) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.8) - activesupport (>= 4.2.0.beta, < 5.0) + railties (= 5.0.2) + sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.1) + actionpack (~> 5.x) + actionview (~> 5.x) + activesupport (~> 5.x) + rails-dom-testing (2.0.2) + activesupport (>= 4.2.0, < 6.0) nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (4.2.8) - actionpack (= 4.2.8) - activesupport (= 4.2.8) + railties (5.0.2) + actionpack (= 5.0.2) + activesupport (= 5.0.2) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rainbow (2.1.0) + rainbow (2.2.1) rake (12.0.0) rdoc (4.3.0) rspec-core (3.5.4) @@ -204,11 +208,11 @@ GEM rspec-expectations (~> 3.5.0) rspec-mocks (~> 3.5.0) rspec-support (~> 3.5.0) - rspec-retry (0.5.2) + rspec-retry (0.5.3) rspec-core (> 3.3, < 3.6) rspec-support (3.5.0) - rubocop (0.46.0) - parser (>= 2.3.1.1, < 3.0) + rubocop (0.47.1) + parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.7) @@ -217,7 +221,7 @@ GEM parser (~> 2.2) slop (~> 3.4, >= 3.4.7) ruby-progressbar (1.8.1) - rubyzip (1.2.0) + rubyzip (1.2.1) sass (3.4.23) sass-rails (5.0.6) railties (>= 4.0.0, < 6) @@ -225,13 +229,13 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - scss_lint (0.51.0) + scss_lint (0.52.0) rake (>= 0.9, < 13) sass (~> 3.4.20) sdoc (0.4.2) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) - selenium-webdriver (3.0.4) + selenium-webdriver (3.2.2) childprocess (~> 0.5) rubyzip (~> 1.0) websocket (~> 1.0) @@ -241,7 +245,7 @@ GEM simplecov-html (~> 0.10.0) simplecov-html (0.10.0) slop (3.6.0) - spring (2.0.0) + spring (2.0.1) activesupport (>= 4.2) sprockets (3.7.1) concurrent-ruby (~> 1.0) @@ -250,27 +254,28 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.3.12) + sqlite3 (1.3.13) term-ansicolor (1.4.0) tins (~> 1.0) thor (0.19.4) thread_safe (0.3.6) - tilt (2.0.5) - tins (1.13.0) - turbolinks (2.5.3) - coffee-rails + tilt (2.0.6) + tins (1.13.2) + turbolinks (5.0.1) + turbolinks-source (~> 5) + turbolinks-source (5.0.0) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (3.0.4) + uglifier (3.1.4) execjs (>= 0.3.0, < 3) - unicode-display_width (1.1.2) - websocket (1.2.3) - websocket-driver (0.6.4) + unicode-display_width (1.1.3) + websocket (1.2.4) + websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) xpath (2.0.0) nokogiri (~> 1.3) - yard (0.9.5) + yard (0.9.8) PLATFORMS ruby @@ -279,9 +284,8 @@ DEPENDENCIES awesome_print capybara capybara-screenshot - capybara-webkit chromedriver-helper - coffee-rails (~> 4.1.0) + coffee-rails coveralls generator_spec jbuilder (~> 2.0) @@ -296,20 +300,21 @@ DEPENDENCIES pry-rescue pry-stack_explorer puma - rails (= 4.2.8) + rails + rails-controller-testing react_on_rails! rspec-rails rspec-retry rubocop ruby-lint - sass-rails (~> 5.0) + sass-rails scss_lint sdoc (~> 0.4.0) selenium-webdriver spring sqlite3 - turbolinks (= 2.5.3) - uglifier (>= 2.7.2) + turbolinks (~> 5.0) + uglifier BUNDLED WITH 1.14.5 diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index 20e7b10f9..f1cf40e8c 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -11,16 +11,5 @@ 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. - - # 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)' - - # 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 - - # Do not swallow errors in after_commit/after_rollback callbacks. - config.active_record.raise_in_transactional_callbacks = true end end diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb index b50a10c35..8cda9b796 100644 --- a/spec/dummy/config/environments/development.rb +++ b/spec/dummy/config/environments/development.rb @@ -9,18 +9,28 @@ # Do not eager load code on boot. config.eager_load = false - # Show full error reports and disable caching. + # Show full error reports. config.consider_all_requests_local = true - $rails_perform_caching = ENV["RAILS_USE_CACHE"] == "YES" - puts "=" * 80 - puts "Using caching = #{$rails_perform_caching}" - puts "=" * 80 - config.action_controller.perform_caching = $rails_perform_caching + # Enable/disable caching. By default caching is disabled. + if Rails.root.join("tmp/caching-dev.txt").exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + "Cache-Control" => "public, max-age=172800" + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false + config.action_mailer.perform_caching = false + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log @@ -32,15 +42,13 @@ # number of complex assets. config.assets.debug = 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 - - # 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 + # Suppress logger output for asset requests. + config.assets.quiet = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + config.file_watcher = ActiveSupport::EventedFileUpdateChecker end diff --git a/spec/dummy/config/environments/production.rb b/spec/dummy/config/environments/production.rb index a09a2a196..e2be6a535 100644 --- a/spec/dummy/config/environments/production.rb +++ b/spec/dummy/config/environments/production.rb @@ -14,15 +14,9 @@ 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 = true + config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -31,16 +25,20 @@ # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # 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 - # `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.action_controller.asset_host = 'http://assets.example.com' + # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true @@ -49,16 +47,15 @@ config.log_level = :debug # Prepend all log lines with the following tags. - # config.log_tags = [ :subdomain, :uuid ] - - # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + config.log_tags = [:request_id] # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "test-new-redux-generation_#{Rails.env}" + config.action_mailer.perform_caching = 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. @@ -74,6 +71,16 @@ # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false end diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb index ab4b82202..f39e6b8ea 100644 --- a/spec/dummy/config/environments/test.rb +++ b/spec/dummy/config/environments/test.rb @@ -12,9 +12,11 @@ # preloads Rails for running tests, you may have to set it to true. config.eager_load = false - # 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.enabled = true + config.public_file_server.headers = { + "Cache-Control" => "public, max-age=3600" + } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -25,6 +27,7 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the diff --git a/spec/dummy/spec/rails_helper.rb b/spec/dummy/spec/rails_helper.rb index ceca78d46..bd09230aa 100644 --- a/spec/dummy/spec/rails_helper.rb +++ b/spec/dummy/spec/rails_helper.rb @@ -66,7 +66,7 @@ # selenium_firefox webdriver only works for Travis-CI builds. default_driver = :poltergeist - supported_drivers = %i( poltergeist poltergeist_errors_ok webkit + supported_drivers = %i( poltergeist poltergeist_errors_ok selenium_chrome selenium_firefox selenium) driver = ENV["DRIVER"].try(:to_sym) || default_driver @@ -80,6 +80,9 @@ Capybara.register_driver :poltergeist_errors_ok do |app| Capybara::Poltergeist::Driver.new(app, js_errors: false) end + config.after :each do |_example| + page.driver.restart if defined?(page.driver.restart) + end when :selenium_chrome Capybara.register_driver :selenium_chrome do |app| Capybara::Selenium::Driver.new(app, browser: :chrome) diff --git a/spec/dummy/spec/support/capybara_utils.rb b/spec/dummy/spec/support/capybara_utils.rb index 768073459..0be2c7892 100644 --- a/spec/dummy/spec/support/capybara_utils.rb +++ b/spec/dummy/spec/support/capybara_utils.rb @@ -5,9 +5,10 @@ def set_driver_header(key, value) case Capybara.javascript_driver when :poltergeist, :poltergeist_errors_ok page.driver.headers = { key => value } - when :webkit - page.driver.header(key, value) - # else no possibe action for selenium + # Skip webkit for now due to install trouble on Sierra + # when :webkit + # page.driver.header(key, value) + # # else no possibe action for selenium end end end