Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #83 from envato/rails-5
Browse files Browse the repository at this point in the history
Rails 5 support
zubin authored Dec 13, 2017
2 parents e75a2e8 + 623fa06 commit 8272b18
Showing 47 changed files with 743 additions and 17 deletions.
17 changes: 16 additions & 1 deletion Appraisals
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# FIXME: 4.2.10 Must be last otherwise:
# Failure/Error: config.load_defaults 5.1
# NoMethodError:
# undefined method `load_defaults' for #<Rails::Application::Configuration:0x00007f853b582308>
# # ./vendor/bundle/ruby/2.4.0/gems/railties-4.2.10/lib/rails/railtie/configuration.rb:95:in `method_missing'
# # ./spec/test_apps/rails-5.1.4/config/application.rb:22:in `<class:Application>'
# # ./spec/test_apps/rails-5.1.4/config/application.rb:20:in `<module:TestApp>'
# # ./spec/test_apps/rails-5.1.4/config/application.rb:19:in `<top (required)>'
# # ./spec/test_apps/rails-5.1.4/config/environment.rb:2:in `require_relative'
# # ./spec/test_apps/rails-5.1.4/config/environment.rb:2:in `<top (required)>'
# # ./spec/rails_helper.rb:5:in `require'
%w[
5.1.4
4.2.10
].each do |rails_version|
ENV['APPRAISAL_RAILS_VERSION'] = rails_version
appraise("rails-#{rails_version}") { gem 'rails', rails_version }
appraise "rails-#{rails_version}" do
gem 'rails', rails_version
gem 'rails-controller-testing' if rails_version >= '5'
end
end
4 changes: 2 additions & 2 deletions app/controllers/guide/base_controller.rb
Original file line number Diff line number Diff line change
@@ -4,12 +4,12 @@ class Guide::BaseController < Guide.configuration.controller_class_to_inherit.co

private

around_filter :set_locale
around_action :set_locale
def set_locale
I18n.with_locale(diplomat.negotiate_locale) { yield }
end

around_filter :handle_known_errors
around_action :handle_known_errors
def handle_known_errors
begin
yield
8 changes: 8 additions & 0 deletions gemfiles/rails_5.1.4.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "5.1.4"
gem "rails-controller-testing"

gemspec path: "../"
2 changes: 1 addition & 1 deletion guide.gemspec
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|

s.files = Dir["{app,config,db,lib}/**/*", "LICENSE", "Rakefile", "README.rdoc"]

s.add_dependency "rails", ">= 3.1", "< 5"
s.add_dependency "rails", ">= 4", "< 6"
s.add_dependency "sass-rails", ">= 3.2"

s.add_development_dependency "appraisal"
2 changes: 1 addition & 1 deletion lib/guide/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Guide
VERSION = "0.3.2"
VERSION = "0.4.0"
end
12 changes: 10 additions & 2 deletions spec/controllers/guide/nodes_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -48,7 +48,11 @@
end

it "does not render the show template" do
expect(response).not_to render_template(:show)
if Rails.version < '5'
expect(response).not_to render_template(:show)
else
expect(response.body).to be_blank
end
end
end
end
@@ -75,7 +79,11 @@
end

it "does not render the show template" do
expect(response).not_to render_template(:show)
if Rails.version < '5'
expect(response).not_to render_template(:show)
else
expect(response.body).to be_blank
end
end
end
end
18 changes: 15 additions & 3 deletions spec/controllers/guide/scenarios_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -50,7 +50,11 @@
end

it "does not render the show template" do
expect(response).not_to render_template(:show)
if Rails.version < '5'
expect(response).not_to render_template(:show)
else
expect(response.body).to be_blank
end
end
end
end
@@ -79,7 +83,11 @@
end

it "does not render the show template" do
expect(response).not_to render_template(:show)
if Rails.version < '5'
expect(response).not_to render_template(:show)
else
expect(response.body).to be_blank
end
end
end
end
@@ -113,7 +121,11 @@
end

it "does not render the show template" do
expect(response).not_to render_template(:show)
if Rails.version < '5'
expect(response).not_to render_template(:show)
else
expect(response.body).to be_blank
end
end
end
end
4 changes: 2 additions & 2 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -30,11 +30,11 @@

# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!
# ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# config.fixture_path = "#{::Rails.root}/spec/fixtures"

# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
11 changes: 11 additions & 0 deletions spec/support/guide/rails_5_controller_compatibility.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if Rails.version >= '5'
module Rails5ControllerCompatibility
def get(action, params = {})
super action, params: params
end
end

RSpec.configure do |config|
config.include Rails5ControllerCompatibility, type: :controller
end
end
2 changes: 1 addition & 1 deletion spec/test_apps/rails-4.2.10/config/application.rb
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ class Application < Rails::Application
# config.i18n.default_locale = :de

# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
# config.active_record.raise_in_transactional_callbacks = true
end
end

24 changes: 24 additions & 0 deletions spec/test_apps/rails-5.1.4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# README

This README would normally document whatever steps are necessary to get the
application up and running.

Things you may want to cover:

* Ruby version

* System dependencies

* Configuration

* Database creation

* Database initialization

* How to run the test suite

* Services (job queues, cache servers, search engines, etc.)

* Deployment instructions

* ...
6 changes: 6 additions & 0 deletions spec/test_apps/rails-5.1.4/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +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_relative 'config/application'

Rails.application.load_tasks
1 change: 1 addition & 0 deletions spec/test_apps/rails-5.1.4/app
3 changes: 3 additions & 0 deletions spec/test_apps/rails-5.1.4/bin/bundle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')
4 changes: 4 additions & 0 deletions spec/test_apps/rails-5.1.4/bin/rails
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
4 changes: 4 additions & 0 deletions spec/test_apps/rails-5.1.4/bin/rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run
35 changes: 35 additions & 0 deletions spec/test_apps/rails-5.1.4/bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils

# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end

chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file.

puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')


# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'
# end

puts "\n== Preparing database =="
system! 'bin/rails db:setup'

puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'

puts "\n== Restarting application server =="
system! 'bin/rails restart'
end
29 changes: 29 additions & 0 deletions spec/test_apps/rails-5.1.4/bin/update
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils

# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end

chdir APP_ROOT do
# This script is a way to update your development environment automatically.
# Add necessary update steps to this file.

puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')

puts "\n== Updating database =="
system! 'bin/rails db:migrate'

puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'

puts "\n== Restarting application server =="
system! 'bin/rails restart'
end
5 changes: 5 additions & 0 deletions spec/test_apps/rails-5.1.4/config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is used by Rack-based servers to start the application.

require_relative 'config/environment'

run Rails.application
31 changes: 31 additions & 0 deletions spec/test_apps/rails-5.1.4/config/application.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require_relative 'boot'

require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
# require "action_mailer/railtie"
require "action_view/railtie"
# require "action_cable/engine"
require "sprockets/railtie"
# require "rails/test_unit/railtie"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module TestApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1

# 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.

# Don't generate system test files.
config.generators.system_tests = nil
end
end
3 changes: 3 additions & 0 deletions spec/test_apps/rails-5.1.4/config/boot.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
1 change: 1 addition & 0 deletions spec/test_apps/rails-5.1.4/config/database.yml
5 changes: 5 additions & 0 deletions spec/test_apps/rails-5.1.4/config/environment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Load the Rails application.
require_relative 'application'

# Initialize the Rails application.
Rails.application.initialize!
49 changes: 49 additions & 0 deletions spec/test_apps/rails-5.1.4/config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false

# Do not eager load code on boot.
config.eager_load = false

# Show full error reports.
config.consider_all_requests_local = true

# Enable/disable caching. By default caching is disabled.
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=#{2.days.seconds.to_i}"
}
else
config.action_controller.perform_caching = false

config.cache_store = :null_store
end

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load

# 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

# 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
82 changes: 82 additions & 0 deletions spec/test_apps/rails-5.1.4/config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# Code is not reloaded between requests.
config.cache_classes = true

# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true

# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true

# Attempt to read encrypted secrets from `config/secrets.yml.enc`.
# Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
# `config/secrets.yml.key`.
config.read_encrypted_secrets = true

# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

# 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

# `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


# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug

# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]

# Use a different cache store in production.
# config.cache_store = :mem_cache_store

# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "test_app_#{Rails.env}"

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true

# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify

# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new

# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')

if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
36 changes: 36 additions & 0 deletions spec/test_apps/rails-5.1.4/config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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

# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false

# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
}

# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false

# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false

# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false

# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Be sure to restart your server when you modify this file.

# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
12 changes: 12 additions & 0 deletions spec/test_apps/rails-5.1.4/config/initializers/assets.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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 the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.

# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }

# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.

# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Be sure to restart your server when you modify this file.

# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
1 change: 1 addition & 0 deletions spec/test_apps/rails-5.1.4/config/initializers/i18n.rb
16 changes: 16 additions & 0 deletions spec/test_apps/rails-5.1.4/config/initializers/inflections.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Be sure to restart your server when you modify this file.

# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end

# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
4 changes: 4 additions & 0 deletions spec/test_apps/rails-5.1.4/config/initializers/mime_types.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Be sure to restart your server when you modify this file.

# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
14 changes: 14 additions & 0 deletions spec/test_apps/rails-5.1.4/config/initializers/wrap_parameters.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Be sure to restart your server when you modify this file.

# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.

# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end

# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end
33 changes: 33 additions & 0 deletions spec/test_apps/rails-5.1.4/config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# The following keys must be escaped otherwise they will not be retrieved by
# the default I18n backend:
#
# true, false, on, off, yes, no
#
# Instead, surround them with single quotes.
#
# en:
# 'true': 'foo'
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.

en:
hello: "Hello world"
3 changes: 3 additions & 0 deletions spec/test_apps/rails-5.1.4/config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
32 changes: 32 additions & 0 deletions spec/test_apps/rails-5.1.4/config/secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Be sure to restart your server when you modify this file.

# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!

# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rails secret` to generate a secure secret key.

# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.

# Shared secrets are available across all environments.

# shared:
# api_key: a1B2c3D4e5F6

# Environmental secrets are only available for that specific environment.

development:
secret_key_base: 9f2c868db12e6fc4880c4645e4599b3980a10a5c8a0dde51f06285f24da209e8ccd4d43d69231ac37aa6f9e083e3d7a534b0b104de3292a0e84665572b8abfed

test:
secret_key_base: ad6952e4ac89345dd6d3424f2f6f6dbaa12a46e79732251fc55c25b858b3a013597d0bca7c2a7eaad2c74d2328eb90fec24b72ecf735bceb33c40bb5293f2e04

# Do not keep production secrets in the unencrypted secrets file.
# Instead, either read values from the environment.
# Or, use `bin/rails secrets:setup` to configure encrypted secrets
# and move the `production:` environment over there.

production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
7 changes: 7 additions & 0 deletions spec/test_apps/rails-5.1.4/db/seeds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
67 changes: 67 additions & 0 deletions spec/test_apps/rails-5.1.4/public/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
.rails-default-error-page {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}

.rails-default-error-page div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}

.rails-default-error-page div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}

.rails-default-error-page h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}

.rails-default-error-page div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>

<body class="rails-default-error-page">
<!-- This file lives in public/404.html -->
<div class="dialog">
<div>
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>
67 changes: 67 additions & 0 deletions spec/test_apps/rails-5.1.4/public/422.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<title>The change you wanted was rejected (422)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
.rails-default-error-page {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}

.rails-default-error-page div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}

.rails-default-error-page div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}

.rails-default-error-page h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}

.rails-default-error-page div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>

<body class="rails-default-error-page">
<!-- This file lives in public/422.html -->
<div class="dialog">
<div>
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>
66 changes: 66 additions & 0 deletions spec/test_apps/rails-5.1.4/public/500.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
.rails-default-error-page {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}

.rails-default-error-page div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}

.rails-default-error-page div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}

.rails-default-error-page h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}

.rails-default-error-page div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>

<body class="rails-default-error-page">
<!-- This file lives in public/500.html -->
<div class="dialog">
<div>
<h1>We're sorry, but something went wrong.</h1>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
1 change: 1 addition & 0 deletions spec/test_apps/rails-5.1.4/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
15 changes: 11 additions & 4 deletions spec/test_apps/setup.rb
Original file line number Diff line number Diff line change
@@ -90,10 +90,17 @@ def gem_root
end

def add_symlinks
symlink_sources.all? do |source|
dest = symlink_dest(source)
FileUtils.mkdir_p File.dirname(dest)
FileUtils.ln_sf source, dest
[
'app',
'config/database.yml',
'config/initializers/i18n.rb',
].each do |path|
dest = File.join(root, path)
target_dir = File.dirname(dest)
FileUtils.mkdir_p(target_dir)
FileUtils.cd(target_dir)
relative_source = ['../' * path.count('/'), '../shared/', path].join
FileUtils.ln_sf relative_source, dest
end
end
end

0 comments on commit 8272b18

Please sign in to comment.