From 5904e0a1a115adccbef8877c6a7277436b11523f Mon Sep 17 00:00:00 2001 From: Michi Huber Date: Wed, 16 Mar 2016 14:36:43 +0100 Subject: [PATCH 1/3] Add support for Rails 5 Drops support for Rails 3.2 and Rails 4.1. --- README.md | 7 +- lib/postamt.rb | 12 +-- lib/postamt/connection_handler.rb | 14 +-- lib/postamt/version.rb | 2 +- postamt.gemspec | 6 +- testapp50/.gitignore | 21 +++++ testapp50/Gemfile | 7 ++ testapp50/README.md | 24 +++++ testapp50/Rakefile | 6 ++ testapp50/app/assets/images/.gitkeep | 0 .../app/assets/javascripts/application.js | 13 +++ .../app/assets/stylesheets/application.css | 13 +++ .../app/controllers/application_controller.rb | 5 + testapp50/app/controllers/concerns/.keep | 0 testapp50/app/helpers/application_helper.rb | 2 + testapp50/app/mailers/.keep | 0 testapp50/app/models/.keep | 0 testapp50/app/models/bar.rb | 3 + testapp50/app/models/concerns/.keep | 0 testapp50/app/models/foo.rb | 5 + .../app/views/layouts/application.html.erb | 14 +++ testapp50/bin/bundle | 3 + testapp50/bin/rails | 9 ++ testapp50/bin/rake | 9 ++ testapp50/bin/setup | 34 +++++++ testapp50/bin/spring | 15 +++ testapp50/bin/update | 29 ++++++ testapp50/config.ru | 8 ++ testapp50/config/application.rb | 15 +++ testapp50/config/boot.rb | 3 + testapp50/config/cable.yml | 10 ++ testapp50/config/database.yml | 15 +++ testapp50/config/environment.rb | 5 + testapp50/config/environments/development.rb | 62 +++++++++++++ testapp50/config/environments/production.rb | 87 +++++++++++++++++ testapp50/config/environments/test.rb | 42 +++++++++ ...e_record_belongs_to_required_by_default.rb | 6 ++ .../application_controller_renderer.rb | 6 ++ testapp50/config/initializers/assets.rb | 11 +++ .../initializers/backtrace_silencers.rb | 7 ++ .../initializers/callback_terminator.rb | 6 ++ .../config/initializers/cookies_serializer.rb | 5 + .../initializers/filter_parameter_logging.rb | 4 + testapp50/config/initializers/inflections.rb | 16 ++++ testapp50/config/initializers/mime_types.rb | 4 + .../initializers/per_form_csrf_tokens.rb | 4 + .../request_forgery_protection.rb | 4 + .../config/initializers/session_store.rb | 3 + .../config/initializers/wrap_parameters.rb | 14 +++ testapp50/config/locales/en.yml | 23 +++++ testapp50/config/puma.rb | 47 ++++++++++ testapp50/config/routes.rb | 6 ++ testapp50/config/secrets.yml | 22 +++++ .../db/migrate/20130408112524_create_foos.rb | 9 ++ .../db/migrate/20130408112535_create_bars.rb | 9 ++ testapp50/db/schema.rb | 31 +++++++ testapp50/db/seeds.rb | 7 ++ testapp50/lib/assets/.keep | 0 testapp50/lib/tasks/.keep | 0 testapp50/log/.keep | 0 testapp50/public/404.html | 67 +++++++++++++ testapp50/public/422.html | 67 +++++++++++++ testapp50/public/500.html | 66 +++++++++++++ .../public/apple-touch-icon-precomposed.png | 0 testapp50/public/apple-touch-icon.png | 0 testapp50/public/favicon.ico | 0 testapp50/public/robots.txt | 5 + testapp50/test/controllers/.keep | 0 testapp50/test/fixtures/.keep | 0 testapp50/test/fixtures/bars.yml | 7 ++ testapp50/test/fixtures/foos.yml | 7 ++ testapp50/test/helpers/.keep | 0 testapp50/test/integration/.keep | 0 testapp50/test/integration/postamt_test.rb | 93 +++++++++++++++++++ testapp50/test/mailers/.keep | 0 testapp50/test/models/.keep | 0 testapp50/test/models/bar_test.rb | 7 ++ testapp50/test/models/foo_test.rb | 7 ++ testapp50/test/test_helper.rb | 17 ++++ testapp50/vendor/assets/javascripts/.keep | 0 testapp50/vendor/assets/stylesheets/.keep | 0 81 files changed, 1059 insertions(+), 28 deletions(-) create mode 100644 testapp50/.gitignore create mode 100644 testapp50/Gemfile create mode 100644 testapp50/README.md create mode 100644 testapp50/Rakefile create mode 100644 testapp50/app/assets/images/.gitkeep create mode 100644 testapp50/app/assets/javascripts/application.js create mode 100644 testapp50/app/assets/stylesheets/application.css create mode 100644 testapp50/app/controllers/application_controller.rb create mode 100644 testapp50/app/controllers/concerns/.keep create mode 100644 testapp50/app/helpers/application_helper.rb create mode 100644 testapp50/app/mailers/.keep create mode 100644 testapp50/app/models/.keep create mode 100644 testapp50/app/models/bar.rb create mode 100644 testapp50/app/models/concerns/.keep create mode 100644 testapp50/app/models/foo.rb create mode 100644 testapp50/app/views/layouts/application.html.erb create mode 100755 testapp50/bin/bundle create mode 100755 testapp50/bin/rails create mode 100755 testapp50/bin/rake create mode 100755 testapp50/bin/setup create mode 100755 testapp50/bin/spring create mode 100755 testapp50/bin/update create mode 100644 testapp50/config.ru create mode 100644 testapp50/config/application.rb create mode 100644 testapp50/config/boot.rb create mode 100644 testapp50/config/cable.yml create mode 100644 testapp50/config/database.yml create mode 100644 testapp50/config/environment.rb create mode 100644 testapp50/config/environments/development.rb create mode 100644 testapp50/config/environments/production.rb create mode 100644 testapp50/config/environments/test.rb create mode 100644 testapp50/config/initializers/active_record_belongs_to_required_by_default.rb create mode 100644 testapp50/config/initializers/application_controller_renderer.rb create mode 100644 testapp50/config/initializers/assets.rb create mode 100644 testapp50/config/initializers/backtrace_silencers.rb create mode 100644 testapp50/config/initializers/callback_terminator.rb create mode 100644 testapp50/config/initializers/cookies_serializer.rb create mode 100644 testapp50/config/initializers/filter_parameter_logging.rb create mode 100644 testapp50/config/initializers/inflections.rb create mode 100644 testapp50/config/initializers/mime_types.rb create mode 100644 testapp50/config/initializers/per_form_csrf_tokens.rb create mode 100644 testapp50/config/initializers/request_forgery_protection.rb create mode 100644 testapp50/config/initializers/session_store.rb create mode 100644 testapp50/config/initializers/wrap_parameters.rb create mode 100644 testapp50/config/locales/en.yml create mode 100644 testapp50/config/puma.rb create mode 100644 testapp50/config/routes.rb create mode 100644 testapp50/config/secrets.yml create mode 100644 testapp50/db/migrate/20130408112524_create_foos.rb create mode 100644 testapp50/db/migrate/20130408112535_create_bars.rb create mode 100644 testapp50/db/schema.rb create mode 100644 testapp50/db/seeds.rb create mode 100644 testapp50/lib/assets/.keep create mode 100644 testapp50/lib/tasks/.keep create mode 100644 testapp50/log/.keep create mode 100644 testapp50/public/404.html create mode 100644 testapp50/public/422.html create mode 100644 testapp50/public/500.html create mode 100644 testapp50/public/apple-touch-icon-precomposed.png create mode 100644 testapp50/public/apple-touch-icon.png create mode 100644 testapp50/public/favicon.ico create mode 100644 testapp50/public/robots.txt create mode 100644 testapp50/test/controllers/.keep create mode 100644 testapp50/test/fixtures/.keep create mode 100644 testapp50/test/fixtures/bars.yml create mode 100644 testapp50/test/fixtures/foos.yml create mode 100644 testapp50/test/helpers/.keep create mode 100644 testapp50/test/integration/.keep create mode 100644 testapp50/test/integration/postamt_test.rb create mode 100644 testapp50/test/mailers/.keep create mode 100644 testapp50/test/models/.keep create mode 100644 testapp50/test/models/bar_test.rb create mode 100644 testapp50/test/models/foo_test.rb create mode 100644 testapp50/test/test_helper.rb create mode 100644 testapp50/vendor/assets/javascripts/.keep create mode 100644 testapp50/vendor/assets/stylesheets/.keep diff --git a/README.md b/README.md index 5cc73b7..d4d3fbf 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,10 @@ [![Gem Version](https://badge.fury.io/rb/postamt.png)](http://rubygems.org/gems/postamt) -Postamt is a sane, solution for performing database reads against a hot standby server with Rails 4.1 and 4.2. +Postamt is a sane solution for performing database reads against a hot standby server with Rails. -If you use Rails 3.2 or 4.0, use Postamt version 0.9.2. +For Rails 4.1 and above, the current Postamt version is `0.10.0`. +If you use Rails 3.2 or 4.0, use Postamt version `0.9.2`. Choose per model and/or controller&action whether a read-only query should be sent to master or a hot standby.
@@ -20,8 +21,6 @@ through [officially-supported Rails APIs](https://github.com/rails/rails/commit/ba1544d71628abff2777c9c514142d7e9a159111#commitcomment-2106059). That's why there's so little code compared to similar gems. -Postamt requires Rails 3.2+ and works with Rails 4. - ## Installation Add this line to your application's Gemfile: diff --git a/lib/postamt.rb b/lib/postamt.rb index 1e392e9..7849603 100644 --- a/lib/postamt.rb +++ b/lib/postamt.rb @@ -44,11 +44,7 @@ def self.overwritten_default_connections # Called by Postamt::Railtie def self.hook! - if Rails::VERSION::MAJOR == 4 and Rails::VERSION::MINOR <= 2 - ActiveRecord::Base.default_connection_handler = Postamt::ConnectionHandler.new - elsif Rails::VERSION::MAJOR == 3 and Rails::VERSION::MINOR == 2 - ActiveRecord::Base.connection_handler = Postamt::ConnectionHandler.new - end + ActiveRecord::Base.default_connection_handler = Postamt::ConnectionHandler.new ActiveRecord::Base.instance_eval do class_attribute :default_connection @@ -73,7 +69,7 @@ def transaction(options = {}, &block) def use_db_connection(connection, args) klass_names = args.delete(:for) if klass_names == :all - around_filter(args) do |controller| + around_action(args) do |controller| Postamt.on(connection) { yield } end else @@ -82,13 +78,13 @@ def use_db_connection(connection, args) default_connections[klass_name] = connection end - before_filter(args) do |controller| + before_action(args) do |controller| Postamt.overwritten_default_connections.merge!(default_connections) end end end - after_filter do + after_action do Postamt.overwritten_default_connections.clear end end diff --git a/lib/postamt/connection_handler.rb b/lib/postamt/connection_handler.rb index ab52ffd..0c03e73 100644 --- a/lib/postamt/connection_handler.rb +++ b/lib/postamt/connection_handler.rb @@ -110,18 +110,8 @@ def pool_for(klass) @pools[connection] ||= begin Postamt.configurations[connection.to_s] ||= Postamt.configurations['master'] - spec = if Rails::VERSION::MAJOR == 4 and Rails::VERSION::MINOR <= 2 - resolver = ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.new Postamt.configurations - resolver.spec(connection) - elsif Rails::VERSION::MAJOR == 4 and Rails::VERSION::MINOR == 0 - resolver = ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.new connection, Postamt.configurations - resolver.spec - elsif Rails::VERSION::MAJOR == 3 and Rails::VERSION::MINOR == 2 - resolver = ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.new connection, Postamt.configurations - resolver.spec - else - abort "Postamt doesn't support Rails version #{Rails.version}" - end + resolver = ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.new(Postamt.configurations) + spec = resolver.spec(connection) unless ActiveRecord::Base.respond_to?(spec.adapter_method) raise ActiveRecord::AdapterNotFound, "database configuration specifies nonexistent #{spec.config[:adapter]} adapter" diff --git a/lib/postamt/version.rb b/lib/postamt/version.rb index c3753db..875de13 100644 --- a/lib/postamt/version.rb +++ b/lib/postamt/version.rb @@ -1,3 +1,3 @@ module Postamt - VERSION = "0.9.7" + VERSION = "0.10.0" end diff --git a/postamt.gemspec b/postamt.gemspec index c858549..dccc499 100644 --- a/postamt.gemspec +++ b/postamt.gemspec @@ -18,9 +18,9 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.required_ruby_version = '>= 2.1.1' - spec.add_dependency "railties", ["~> 4.1", "< 4.3"] - spec.add_dependency "activerecord", ["~> 4.1", "< 4.3"] + spec.required_ruby_version = '>= 2.2.0' + spec.add_dependency "railties", [">= 4.1", "< 5.1"] + spec.add_dependency "activerecord", [">= 4.1", "< 5.1"] spec.add_dependency "thread_safe", [">= 0.3.3"] spec.add_development_dependency "bundler" spec.add_development_dependency "rake" diff --git a/testapp50/.gitignore b/testapp50/.gitignore new file mode 100644 index 0000000..bab620d --- /dev/null +++ b/testapp50/.gitignore @@ -0,0 +1,21 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal + +# Ignore all logfiles and tempfiles. +/log/* +/tmp/* +!/log/.keep +!/tmp/.keep + +# Ignore Byebug command history file. +.byebug_history diff --git a/testapp50/Gemfile b/testapp50/Gemfile new file mode 100644 index 0000000..c8574be --- /dev/null +++ b/testapp50/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +gem 'rails', '>= 5.0.0.beta3', '< 5.1' +gem 'pg' +gem 'pry-rails' + +gem 'postamt', path: '..' diff --git a/testapp50/README.md b/testapp50/README.md new file mode 100644 index 0000000..55e144d --- /dev/null +++ b/testapp50/README.md @@ -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 + +* ... diff --git a/testapp50/Rakefile b/testapp50/Rakefile new file mode 100644 index 0000000..ba6b733 --- /dev/null +++ b/testapp50/Rakefile @@ -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 File.expand_path('../config/application', __FILE__) + +Rails.application.load_tasks diff --git a/testapp50/app/assets/images/.gitkeep b/testapp50/app/assets/images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/app/assets/javascripts/application.js b/testapp50/app/assets/javascripts/application.js new file mode 100644 index 0000000..084d5d1 --- /dev/null +++ b/testapp50/app/assets/javascripts/application.js @@ -0,0 +1,13 @@ +// 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 vendor/assets/javascripts of plugins, if any, 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. +// +// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD +// GO AFTER THE REQUIRES BELOW. +// +//= require_tree . diff --git a/testapp50/app/assets/stylesheets/application.css b/testapp50/app/assets/stylesheets/application.css new file mode 100644 index 0000000..3192ec8 --- /dev/null +++ b/testapp50/app/assets/stylesheets/application.css @@ -0,0 +1,13 @@ +/* + * 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 vendor/assets/stylesheets of plugins, if any, 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 top of the + * compiled file, but it's generally better to create a new file per style scope. + * + *= require_self + *= require_tree . + */ diff --git a/testapp50/app/controllers/application_controller.rb b/testapp50/app/controllers/application_controller.rb new file mode 100644 index 0000000..d83690e --- /dev/null +++ b/testapp50/app/controllers/application_controller.rb @@ -0,0 +1,5 @@ +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 +end diff --git a/testapp50/app/controllers/concerns/.keep b/testapp50/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/app/helpers/application_helper.rb b/testapp50/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/testapp50/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/testapp50/app/mailers/.keep b/testapp50/app/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/app/models/.keep b/testapp50/app/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/app/models/bar.rb b/testapp50/app/models/bar.rb new file mode 100644 index 0000000..d094aed --- /dev/null +++ b/testapp50/app/models/bar.rb @@ -0,0 +1,3 @@ +class Bar < ActiveRecord::Base + has_many :foos +end diff --git a/testapp50/app/models/concerns/.keep b/testapp50/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/app/models/foo.rb b/testapp50/app/models/foo.rb new file mode 100644 index 0000000..0f518e4 --- /dev/null +++ b/testapp50/app/models/foo.rb @@ -0,0 +1,5 @@ +class Foo < ActiveRecord::Base + self.default_connection = :slave + + belongs_to :bar +end diff --git a/testapp50/app/views/layouts/application.html.erb b/testapp50/app/views/layouts/application.html.erb new file mode 100644 index 0000000..046551c --- /dev/null +++ b/testapp50/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + Pgcharmer + <%= stylesheet_link_tag "application", media: "all" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/testapp50/bin/bundle b/testapp50/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/testapp50/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/testapp50/bin/rails b/testapp50/bin/rails new file mode 100755 index 0000000..0138d79 --- /dev/null +++ b/testapp50/bin/rails @@ -0,0 +1,9 @@ +#!/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' diff --git a/testapp50/bin/rake b/testapp50/bin/rake new file mode 100755 index 0000000..d87d5f5 --- /dev/null +++ b/testapp50/bin/rake @@ -0,0 +1,9 @@ +#!/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' +Rake.application.run diff --git a/testapp50/bin/setup b/testapp50/bin/setup new file mode 100755 index 0000000..589bee8 --- /dev/null +++ b/testapp50/bin/setup @@ -0,0 +1,34 @@ +#!/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') or 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 diff --git a/testapp50/bin/spring b/testapp50/bin/spring new file mode 100755 index 0000000..7fe232c --- /dev/null +++ b/testapp50/bin/spring @@ -0,0 +1,15 @@ +#!/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/testapp50/bin/update b/testapp50/bin/update new file mode 100755 index 0000000..9851923 --- /dev/null +++ b/testapp50/bin/update @@ -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' or 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 diff --git a/testapp50/config.ru b/testapp50/config.ru new file mode 100644 index 0000000..584d039 --- /dev/null +++ b/testapp50/config.ru @@ -0,0 +1,8 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) + +# Action Cable requires that all classes are loaded in advance +Rails.application.eager_load! + +run Rails.application diff --git a/testapp50/config/application.rb b/testapp50/config/application.rb new file mode 100644 index 0000000..d673c01 --- /dev/null +++ b/testapp50/config/application.rb @@ -0,0 +1,15 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Testapp50 + 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. + end +end diff --git a/testapp50/config/boot.rb b/testapp50/config/boot.rb new file mode 100644 index 0000000..6b750f0 --- /dev/null +++ b/testapp50/config/boot.rb @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/testapp50/config/cable.yml b/testapp50/config/cable.yml new file mode 100644 index 0000000..aa4e832 --- /dev/null +++ b/testapp50/config/cable.yml @@ -0,0 +1,10 @@ +# Action Cable uses Redis by default to administer connections, channels, and sending/receiving messages over the WebSocket. +production: + adapter: redis + url: redis://localhost:6379/1 + +development: + adapter: async + +test: + adapter: async diff --git a/testapp50/config/database.yml b/testapp50/config/database.yml new file mode 100644 index 0000000..f99b8f1 --- /dev/null +++ b/testapp50/config/database.yml @@ -0,0 +1,15 @@ +development: + adapter: postgresql + database: postamt + username: master + encoding: utf8 + slave: + username: slave + +test: + adapter: postgresql + database: postamt_test + username: master + encoding: utf8 + slave: + username: slave diff --git a/testapp50/config/environment.rb b/testapp50/config/environment.rb new file mode 100644 index 0000000..ee8d90d --- /dev/null +++ b/testapp50/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/testapp50/config/environments/development.rb b/testapp50/config/environments/development.rb new file mode 100644 index 0000000..0db07e7 --- /dev/null +++ b/testapp50/config/environments/development.rb @@ -0,0 +1,62 @@ +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.action_mailer.perform_caching = false + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=172800' + } + else + config.action_controller.perform_caching = false + + config.action_mailer.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 + + # 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 + + # 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 + + # 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/testapp50/config/environments/production.rb b/testapp50/config/environments/production.rb new file mode 100644 index 0000000..b54fd88 --- /dev/null +++ b/testapp50/config/environments/production.rb @@ -0,0 +1,87 @@ +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 + + # 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 + + # 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 + + # Action Cable endpoint configuration + # 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 + + # 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 logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + config.logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) + end + + # 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 = "testapp50_#{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. + # config.action_mailer.raise_delivery_errors = false + + # 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 +end diff --git a/testapp50/config/environments/test.rb b/testapp50/config/environments/test.rb new file mode 100644 index 0000000..30587ef --- /dev/null +++ b/testapp50/config/environments/test.rb @@ -0,0 +1,42 @@ +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=3600' + } + + # 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 + 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 + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # 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 diff --git a/testapp50/config/initializers/active_record_belongs_to_required_by_default.rb b/testapp50/config/initializers/active_record_belongs_to_required_by_default.rb new file mode 100644 index 0000000..f613b40 --- /dev/null +++ b/testapp50/config/initializers/active_record_belongs_to_required_by_default.rb @@ -0,0 +1,6 @@ +# Be sure to restart your server when you modify this file. + +# Require `belongs_to` associations by default. This is a new Rails 5.0 +# default, so it is introduced as a configuration option to ensure that apps +# made on earlier versions of Rails are not affected when upgrading. +Rails.application.config.active_record.belongs_to_required_by_default = true diff --git a/testapp50/config/initializers/application_controller_renderer.rb b/testapp50/config/initializers/application_controller_renderer.rb new file mode 100644 index 0000000..51639b6 --- /dev/null +++ b/testapp50/config/initializers/application_controller_renderer.rb @@ -0,0 +1,6 @@ +# Be sure to restart your server when you modify this file. + +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) diff --git a/testapp50/config/initializers/assets.rb b/testapp50/config/initializers/assets.rb new file mode 100644 index 0000000..01ef3e6 --- /dev/null +++ b/testapp50/config/initializers/assets.rb @@ -0,0 +1,11 @@ +# 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/testapp50/config/initializers/backtrace_silencers.rb b/testapp50/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/testapp50/config/initializers/backtrace_silencers.rb @@ -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! diff --git a/testapp50/config/initializers/callback_terminator.rb b/testapp50/config/initializers/callback_terminator.rb new file mode 100644 index 0000000..649e822 --- /dev/null +++ b/testapp50/config/initializers/callback_terminator.rb @@ -0,0 +1,6 @@ +# Be sure to restart your server when you modify this file. + +# Do not halt callback chains when a callback returns false. This is a new +# Rails 5.0 default, so it is introduced as a configuration option to ensure +# that apps made with earlier versions of Rails are not affected when upgrading. +ActiveSupport.halt_callback_chains_on_return_false = false diff --git a/testapp50/config/initializers/cookies_serializer.rb b/testapp50/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..5a6a32d --- /dev/null +++ b/testapp50/config/initializers/cookies_serializer.rb @@ -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 diff --git a/testapp50/config/initializers/filter_parameter_logging.rb b/testapp50/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/testapp50/config/initializers/filter_parameter_logging.rb @@ -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] diff --git a/testapp50/config/initializers/inflections.rb b/testapp50/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/testapp50/config/initializers/inflections.rb @@ -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 diff --git a/testapp50/config/initializers/mime_types.rb b/testapp50/config/initializers/mime_types.rb new file mode 100644 index 0000000..dc18996 --- /dev/null +++ b/testapp50/config/initializers/mime_types.rb @@ -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 diff --git a/testapp50/config/initializers/per_form_csrf_tokens.rb b/testapp50/config/initializers/per_form_csrf_tokens.rb new file mode 100644 index 0000000..1f569de --- /dev/null +++ b/testapp50/config/initializers/per_form_csrf_tokens.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Enable per-form CSRF tokens. +Rails.application.config.action_controller.per_form_csrf_tokens = true diff --git a/testapp50/config/initializers/request_forgery_protection.rb b/testapp50/config/initializers/request_forgery_protection.rb new file mode 100644 index 0000000..3eab78a --- /dev/null +++ b/testapp50/config/initializers/request_forgery_protection.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Enable origin-checking CSRF mitigation. +Rails.application.config.action_controller.forgery_protection_origin_check = true diff --git a/testapp50/config/initializers/session_store.rb b/testapp50/config/initializers/session_store.rb new file mode 100644 index 0000000..034cfbc --- /dev/null +++ b/testapp50/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.session_store :cookie_store, key: '_testapp50_session' diff --git a/testapp50/config/initializers/wrap_parameters.rb b/testapp50/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..bbfc396 --- /dev/null +++ b/testapp50/config/initializers/wrap_parameters.rb @@ -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 diff --git a/testapp50/config/locales/en.yml b/testapp50/config/locales/en.yml new file mode 100644 index 0000000..0653957 --- /dev/null +++ b/testapp50/config/locales/en.yml @@ -0,0 +1,23 @@ +# 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. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/testapp50/config/puma.rb b/testapp50/config/puma.rb new file mode 100644 index 0000000..c7f311f --- /dev/null +++ b/testapp50/config/puma.rb @@ -0,0 +1,47 @@ +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum, this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted this block will be run, if you are using `preload_app!` +# option you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart diff --git a/testapp50/config/routes.rb b/testapp50/config/routes.rb new file mode 100644 index 0000000..8293c8a --- /dev/null +++ b/testapp50/config/routes.rb @@ -0,0 +1,6 @@ +Rails.application.routes.draw do + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html + + # Serve websocket cable requests in-process + # mount ActionCable.server => '/cable' +end diff --git a/testapp50/config/secrets.yml b/testapp50/config/secrets.yml new file mode 100644 index 0000000..4ecea0a --- /dev/null +++ b/testapp50/config/secrets.yml @@ -0,0 +1,22 @@ +# 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. + +development: + secret_key_base: a9baec01aace34be945dcaa37b590c7c1a793bd62cac99e8f3f9b29e93f50fb7a39c89c39898a5ab6a720d26de62bee00eaf5bd1d91e739386e17c5ee6153cad + +test: + secret_key_base: 3f648cdd385bf1b61ddcc840e7774dbf5c7c250f59041f8d3081122b2fb0097f617532a9a4acc48728ad061da1aefcfdc6b6155cc1cf999a05d12f010ac569ce + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/testapp50/db/migrate/20130408112524_create_foos.rb b/testapp50/db/migrate/20130408112524_create_foos.rb new file mode 100644 index 0000000..014ef72 --- /dev/null +++ b/testapp50/db/migrate/20130408112524_create_foos.rb @@ -0,0 +1,9 @@ +class CreateFoos < ActiveRecord::Migration[5.0] + def change + create_table :foos do |t| + t.integer :bar_id + + t.timestamps + end + end +end diff --git a/testapp50/db/migrate/20130408112535_create_bars.rb b/testapp50/db/migrate/20130408112535_create_bars.rb new file mode 100644 index 0000000..f141995 --- /dev/null +++ b/testapp50/db/migrate/20130408112535_create_bars.rb @@ -0,0 +1,9 @@ +class CreateBars < ActiveRecord::Migration[5.0] + def change + create_table :bars do |t| + t.text :message + + t.timestamps + end + end +end diff --git a/testapp50/db/schema.rb b/testapp50/db/schema.rb new file mode 100644 index 0000000..d3694df --- /dev/null +++ b/testapp50/db/schema.rb @@ -0,0 +1,31 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# 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). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20130408112535) do + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "bars", force: :cascade do |t| + t.text "message" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "foos", force: :cascade do |t| + t.integer "bar_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/testapp50/db/seeds.rb b/testapp50/db/seeds.rb new file mode 100644 index 0000000..1beea2a --- /dev/null +++ b/testapp50/db/seeds.rb @@ -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) diff --git a/testapp50/lib/assets/.keep b/testapp50/lib/assets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/lib/tasks/.keep b/testapp50/lib/tasks/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/log/.keep b/testapp50/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/public/404.html b/testapp50/public/404.html new file mode 100644 index 0000000..b612547 --- /dev/null +++ b/testapp50/public/404.html @@ -0,0 +1,67 @@ + + + + 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/testapp50/public/422.html b/testapp50/public/422.html new file mode 100644 index 0000000..a21f82b --- /dev/null +++ b/testapp50/public/422.html @@ -0,0 +1,67 @@ + + + + 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/testapp50/public/500.html b/testapp50/public/500.html new file mode 100644 index 0000000..061abc5 --- /dev/null +++ b/testapp50/public/500.html @@ -0,0 +1,66 @@ + + + + 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/testapp50/public/apple-touch-icon-precomposed.png b/testapp50/public/apple-touch-icon-precomposed.png new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/public/apple-touch-icon.png b/testapp50/public/apple-touch-icon.png new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/public/favicon.ico b/testapp50/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/public/robots.txt b/testapp50/public/robots.txt new file mode 100644 index 0000000..3c9c7c0 --- /dev/null +++ b/testapp50/public/robots.txt @@ -0,0 +1,5 @@ +# 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/testapp50/test/controllers/.keep b/testapp50/test/controllers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/test/fixtures/.keep b/testapp50/test/fixtures/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/test/fixtures/bars.yml b/testapp50/test/fixtures/bars.yml new file mode 100644 index 0000000..9590c9d --- /dev/null +++ b/testapp50/test/fixtures/bars.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + message: MyText + +two: + message: MyText diff --git a/testapp50/test/fixtures/foos.yml b/testapp50/test/fixtures/foos.yml new file mode 100644 index 0000000..cdd8bf4 --- /dev/null +++ b/testapp50/test/fixtures/foos.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + bar_id: 1 + +two: + bar_id: 1 diff --git a/testapp50/test/helpers/.keep b/testapp50/test/helpers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/test/integration/.keep b/testapp50/test/integration/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/test/integration/postamt_test.rb b/testapp50/test/integration/postamt_test.rb new file mode 100644 index 0000000..3d4da88 --- /dev/null +++ b/testapp50/test/integration/postamt_test.rb @@ -0,0 +1,93 @@ +require 'test_helper' + +class PostamtTest < ActionDispatch::IntegrationTest + def username_for(model_klass) + model_klass.connection.pool.spec.config[:username] + end + + def transaction_open?(model_klass) + model_klass.connection.transaction_open? + end + + teardown do + Bar.delete_all + Foo.delete_all + end + + test "self.default_connection" do + assert_equal "master", username_for(Bar) + assert_equal "slave", username_for(Foo) + end + + test "Postamt.on(...) overwrites default_connection" do + Postamt.on(:slave) do + assert_equal "slave", username_for(Bar) + assert_equal "slave", username_for(Foo) + end + + Postamt.on(:master) do + assert_equal "master", username_for(Bar) + assert_equal "master", username_for(Foo) + end + end + + test "transaction overwrites default_connection" do + assert_equal "master", username_for(Bar) + assert_equal "slave", username_for(Foo) + + ActiveRecord::Base.transaction do + assert_equal "master", username_for(Bar) + assert_equal "master", username_for(Foo) + end + + assert_equal "master", username_for(Bar) + assert_equal "slave", username_for(Foo) + end + + test "Postamt.on(..) overwrites transaction" do + assert_equal "master", username_for(Bar) + assert_equal "slave", username_for(Foo) + + ActiveRecord::Base.transaction do + assert_equal "master", username_for(Bar) + assert_equal "master", username_for(Foo) + + Postamt.on(:slave) do + assert_equal "slave", username_for(Bar) + assert_equal "slave", username_for(Foo) + end + + assert_equal "master", username_for(Bar) + assert_equal "master", username_for(Foo) + end + + assert_equal "master", username_for(Bar) + assert_equal "slave", username_for(Foo) + end + + test "master and slave are actually different connections" do + # We test this by checking if transaction isolation between master and slave works + bar = nil + + ActiveRecord::Base.transaction do + bar = Bar.create!(message: 'random') + + Postamt.on(:slave) do + assert_nil Bar.where(id: bar.id).first + end + + Postamt.on(:master) do + assert_not_nil Bar.where(id: bar.id).first + end + + assert transaction_open?(Bar) # still in transaction? + end + assert !transaction_open?(Bar) # outside transaction? + + # After the transaction commits Bar becomes visible on the slave too + Postamt.on(:slave) do + assert_not_nil Bar.where(id: bar.id).first + end + end + +end diff --git a/testapp50/test/mailers/.keep b/testapp50/test/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/test/models/.keep b/testapp50/test/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/test/models/bar_test.rb b/testapp50/test/models/bar_test.rb new file mode 100644 index 0000000..372fcec --- /dev/null +++ b/testapp50/test/models/bar_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class BarTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/testapp50/test/models/foo_test.rb b/testapp50/test/models/foo_test.rb new file mode 100644 index 0000000..25e4366 --- /dev/null +++ b/testapp50/test/models/foo_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class FooTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/testapp50/test/test_helper.rb b/testapp50/test/test_helper.rb new file mode 100644 index 0000000..5253fb4 --- /dev/null +++ b/testapp50/test/test_helper.rb @@ -0,0 +1,17 @@ +ENV["RAILS_ENV"] = "test" +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + ActiveRecord::Migration.check_pending! if Rails::VERSION::MAJOR == 4 + + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + # + # Note: You'll currently still have to declare fixtures explicitly in integration tests + # -- they do not yet inherit this setting + fixtures :all + + self.use_transactional_tests = false + + # Add more helper methods to be used by all tests here... +end diff --git a/testapp50/vendor/assets/javascripts/.keep b/testapp50/vendor/assets/javascripts/.keep new file mode 100644 index 0000000..e69de29 diff --git a/testapp50/vendor/assets/stylesheets/.keep b/testapp50/vendor/assets/stylesheets/.keep new file mode 100644 index 0000000..e69de29 From 7017648ae53dc98881536b2ab94b0974dc42dcaf Mon Sep 17 00:00:00 2001 From: Michi Huber Date: Wed, 16 Mar 2016 15:19:28 +0100 Subject: [PATCH 2/3] Add controller spec to test before/after hooks --- testapp50/app/controllers/postamt_controller.rb | 15 +++++++++++++++ testapp50/config/routes.rb | 6 ++---- .../test/controllers/postamt_controller_test.rb | 11 +++++++++++ testapp50/test/helpers/.keep | 0 testapp50/test/mailers/.keep | 0 testapp50/test/models/.keep | 0 testapp50/test/models/bar_test.rb | 7 ------- testapp50/test/models/foo_test.rb | 7 ------- 8 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 testapp50/app/controllers/postamt_controller.rb create mode 100644 testapp50/test/controllers/postamt_controller_test.rb delete mode 100644 testapp50/test/helpers/.keep delete mode 100644 testapp50/test/mailers/.keep delete mode 100644 testapp50/test/models/.keep delete mode 100644 testapp50/test/models/bar_test.rb delete mode 100644 testapp50/test/models/foo_test.rb diff --git a/testapp50/app/controllers/postamt_controller.rb b/testapp50/app/controllers/postamt_controller.rb new file mode 100644 index 0000000..3923c20 --- /dev/null +++ b/testapp50/app/controllers/postamt_controller.rb @@ -0,0 +1,15 @@ +class PostamtController < ApplicationController + use_db_connection(:slave, for: [Bar], only: [:slave]) + + def slave + render_connection + end + + def master + render_connection + end + + def render_connection + render plain: Postamt.overwritten_default_connections[Bar].to_s + end +end diff --git a/testapp50/config/routes.rb b/testapp50/config/routes.rb index 8293c8a..591ba38 100644 --- a/testapp50/config/routes.rb +++ b/testapp50/config/routes.rb @@ -1,6 +1,4 @@ Rails.application.routes.draw do - # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html - - # Serve websocket cable requests in-process - # mount ActionCable.server => '/cable' + get "slave" => "postamt#slave" + get "master" => "postamt#master" end diff --git a/testapp50/test/controllers/postamt_controller_test.rb b/testapp50/test/controllers/postamt_controller_test.rb new file mode 100644 index 0000000..6b74f08 --- /dev/null +++ b/testapp50/test/controllers/postamt_controller_test.rb @@ -0,0 +1,11 @@ +require 'test_helper' + +class PostamtControllerTest < ActionController::TestCase + test "allows overriding the connection at the controller level" do + get :slave + assert_equal "slave", response.body + assert_equal Postamt.overwritten_default_connections, {} + get :master + assert_equal "", response.body + end +end diff --git a/testapp50/test/helpers/.keep b/testapp50/test/helpers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp50/test/mailers/.keep b/testapp50/test/mailers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp50/test/models/.keep b/testapp50/test/models/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp50/test/models/bar_test.rb b/testapp50/test/models/bar_test.rb deleted file mode 100644 index 372fcec..0000000 --- a/testapp50/test/models/bar_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class BarTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/testapp50/test/models/foo_test.rb b/testapp50/test/models/foo_test.rb deleted file mode 100644 index 25e4366..0000000 --- a/testapp50/test/models/foo_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class FooTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end From d4ac81440aab7cb57ed5471f5a2254ca5c246823 Mon Sep 17 00:00:00 2001 From: Michi Huber Date: Wed, 16 Mar 2016 15:21:21 +0100 Subject: [PATCH 3/3] Remove 4.2 testapp --- testapp42/.gitignore | 12 --- testapp42/Gemfile | 16 --- testapp42/README.rdoc | 28 ------ testapp42/Rakefile | 6 -- testapp42/app/assets/images/.gitkeep | 0 .../app/assets/javascripts/application.js | 13 --- .../app/assets/stylesheets/application.css | 13 --- .../app/controllers/application_controller.rb | 5 - testapp42/app/controllers/concerns/.keep | 0 testapp42/app/helpers/application_helper.rb | 2 - testapp42/app/mailers/.keep | 0 testapp42/app/models/.keep | 0 testapp42/app/models/bar.rb | 3 - testapp42/app/models/concerns/.keep | 0 testapp42/app/models/foo.rb | 5 - .../app/views/layouts/application.html.erb | 14 --- testapp42/bin/bundle | 3 - testapp42/bin/rails | 4 - testapp42/bin/rake | 4 - testapp42/config.ru | 4 - testapp42/config/application.rb | 24 ----- testapp42/config/boot.rb | 4 - testapp42/config/database.yml | 15 --- testapp42/config/environment.rb | 5 - testapp42/config/environments/development.rb | 27 ------ testapp42/config/environments/production.rb | 80 --------------- testapp42/config/environments/test.rb | 36 ------- .../initializers/backtrace_silencers.rb | 7 -- .../initializers/filter_parameter_logging.rb | 4 - testapp42/config/initializers/inflections.rb | 16 --- testapp42/config/initializers/mime_types.rb | 5 - testapp42/config/initializers/secret_token.rb | 12 --- .../config/initializers/session_store.rb | 4 - .../config/initializers/wrap_parameters.rb | 14 --- testapp42/config/locales/en.yml | 23 ----- testapp42/config/routes.rb | 49 ---------- .../db/migrate/20130408112524_create_foos.rb | 9 -- .../db/migrate/20130408112535_create_bars.rb | 9 -- testapp42/db/schema.rb | 31 ------ testapp42/db/seeds.rb | 10 -- testapp42/lib/assets/.keep | 0 testapp42/lib/tasks/.keep | 0 testapp42/log/.keep | 0 testapp42/public/404.html | 27 ------ testapp42/public/422.html | 26 ----- testapp42/public/500.html | 26 ----- testapp42/public/favicon.ico | 0 testapp42/public/robots.txt | 5 - testapp42/test/controllers/.keep | 0 testapp42/test/fixtures/.keep | 0 testapp42/test/fixtures/bars.yml | 7 -- testapp42/test/fixtures/foos.yml | 7 -- testapp42/test/helpers/.keep | 0 testapp42/test/integration/.keep | 0 testapp42/test/integration/postamt_test.rb | 97 ------------------- testapp42/test/mailers/.keep | 0 testapp42/test/models/.keep | 0 testapp42/test/models/bar_test.rb | 7 -- testapp42/test/models/foo_test.rb | 7 -- testapp42/test/test_helper.rb | 17 ---- testapp42/vendor/assets/javascripts/.keep | 0 testapp42/vendor/assets/stylesheets/.keep | 0 62 files changed, 742 deletions(-) delete mode 100644 testapp42/.gitignore delete mode 100644 testapp42/Gemfile delete mode 100644 testapp42/README.rdoc delete mode 100644 testapp42/Rakefile delete mode 100644 testapp42/app/assets/images/.gitkeep delete mode 100644 testapp42/app/assets/javascripts/application.js delete mode 100644 testapp42/app/assets/stylesheets/application.css delete mode 100644 testapp42/app/controllers/application_controller.rb delete mode 100644 testapp42/app/controllers/concerns/.keep delete mode 100644 testapp42/app/helpers/application_helper.rb delete mode 100644 testapp42/app/mailers/.keep delete mode 100644 testapp42/app/models/.keep delete mode 100644 testapp42/app/models/bar.rb delete mode 100644 testapp42/app/models/concerns/.keep delete mode 100644 testapp42/app/models/foo.rb delete mode 100644 testapp42/app/views/layouts/application.html.erb delete mode 100755 testapp42/bin/bundle delete mode 100755 testapp42/bin/rails delete mode 100755 testapp42/bin/rake delete mode 100644 testapp42/config.ru delete mode 100644 testapp42/config/application.rb delete mode 100644 testapp42/config/boot.rb delete mode 100644 testapp42/config/database.yml delete mode 100644 testapp42/config/environment.rb delete mode 100644 testapp42/config/environments/development.rb delete mode 100644 testapp42/config/environments/production.rb delete mode 100644 testapp42/config/environments/test.rb delete mode 100644 testapp42/config/initializers/backtrace_silencers.rb delete mode 100644 testapp42/config/initializers/filter_parameter_logging.rb delete mode 100644 testapp42/config/initializers/inflections.rb delete mode 100644 testapp42/config/initializers/mime_types.rb delete mode 100644 testapp42/config/initializers/secret_token.rb delete mode 100644 testapp42/config/initializers/session_store.rb delete mode 100644 testapp42/config/initializers/wrap_parameters.rb delete mode 100644 testapp42/config/locales/en.yml delete mode 100644 testapp42/config/routes.rb delete mode 100644 testapp42/db/migrate/20130408112524_create_foos.rb delete mode 100644 testapp42/db/migrate/20130408112535_create_bars.rb delete mode 100644 testapp42/db/schema.rb delete mode 100644 testapp42/db/seeds.rb delete mode 100644 testapp42/lib/assets/.keep delete mode 100644 testapp42/lib/tasks/.keep delete mode 100644 testapp42/log/.keep delete mode 100644 testapp42/public/404.html delete mode 100644 testapp42/public/422.html delete mode 100644 testapp42/public/500.html delete mode 100644 testapp42/public/favicon.ico delete mode 100644 testapp42/public/robots.txt delete mode 100644 testapp42/test/controllers/.keep delete mode 100644 testapp42/test/fixtures/.keep delete mode 100644 testapp42/test/fixtures/bars.yml delete mode 100644 testapp42/test/fixtures/foos.yml delete mode 100644 testapp42/test/helpers/.keep delete mode 100644 testapp42/test/integration/.keep delete mode 100644 testapp42/test/integration/postamt_test.rb delete mode 100644 testapp42/test/mailers/.keep delete mode 100644 testapp42/test/models/.keep delete mode 100644 testapp42/test/models/bar_test.rb delete mode 100644 testapp42/test/models/foo_test.rb delete mode 100644 testapp42/test/test_helper.rb delete mode 100644 testapp42/vendor/assets/javascripts/.keep delete mode 100644 testapp42/vendor/assets/stylesheets/.keep diff --git a/testapp42/.gitignore b/testapp42/.gitignore deleted file mode 100644 index cfb4e7b..0000000 --- a/testapp42/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. -# -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile '~/.gitignore_global' - -# Ignore bundler config. -/.bundle - -# Ignore all logfiles and tempfiles. -/log/*.log -/tmp diff --git a/testapp42/Gemfile b/testapp42/Gemfile deleted file mode 100644 index 4d500a5..0000000 --- a/testapp42/Gemfile +++ /dev/null @@ -1,16 +0,0 @@ -source 'https://rubygems.org' - -gem 'rails', '4.2.0.beta1' -gem 'pg' -gem 'pry-rails' - -gem 'postamt', path: '..' - -# Use unicorn as the app server -# gem 'unicorn' - -# Deploy with Capistrano -# gem 'capistrano', group: :development - -# To use debugger -# gem 'debugger' diff --git a/testapp42/README.rdoc b/testapp42/README.rdoc deleted file mode 100644 index dd4e97e..0000000 --- a/testapp42/README.rdoc +++ /dev/null @@ -1,28 +0,0 @@ -== README - -This README would normally document whatever steps are necessary to get the -application up and running. - -Things you may want to cover: - -* Ruby version - -* System dependencies - -* Configuration - -* Database creation - -* Database initialization - -* How to run the test suite - -* Services (job queues, cache servers, search engines, etc.) - -* Deployment instructions - -* ... - - -Please feel free to use a different markup language if you do not plan to run -rake doc:app. diff --git a/testapp42/Rakefile b/testapp42/Rakefile deleted file mode 100644 index 1295e96..0000000 --- a/testapp42/Rakefile +++ /dev/null @@ -1,6 +0,0 @@ -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require File.expand_path('../config/application', __FILE__) - -Pgcharmer::Application.load_tasks diff --git a/testapp42/app/assets/images/.gitkeep b/testapp42/app/assets/images/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/app/assets/javascripts/application.js b/testapp42/app/assets/javascripts/application.js deleted file mode 100644 index 084d5d1..0000000 --- a/testapp42/app/assets/javascripts/application.js +++ /dev/null @@ -1,13 +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 vendor/assets/javascripts of plugins, if any, 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. -// -// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD -// GO AFTER THE REQUIRES BELOW. -// -//= require_tree . diff --git a/testapp42/app/assets/stylesheets/application.css b/testapp42/app/assets/stylesheets/application.css deleted file mode 100644 index 3192ec8..0000000 --- a/testapp42/app/assets/stylesheets/application.css +++ /dev/null @@ -1,13 +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 vendor/assets/stylesheets of plugins, if any, 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 top of the - * compiled file, but it's generally better to create a new file per style scope. - * - *= require_self - *= require_tree . - */ diff --git a/testapp42/app/controllers/application_controller.rb b/testapp42/app/controllers/application_controller.rb deleted file mode 100644 index d83690e..0000000 --- a/testapp42/app/controllers/application_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -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 -end diff --git a/testapp42/app/controllers/concerns/.keep b/testapp42/app/controllers/concerns/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/app/helpers/application_helper.rb b/testapp42/app/helpers/application_helper.rb deleted file mode 100644 index de6be79..0000000 --- a/testapp42/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/testapp42/app/mailers/.keep b/testapp42/app/mailers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/app/models/.keep b/testapp42/app/models/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/app/models/bar.rb b/testapp42/app/models/bar.rb deleted file mode 100644 index d094aed..0000000 --- a/testapp42/app/models/bar.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Bar < ActiveRecord::Base - has_many :foos -end diff --git a/testapp42/app/models/concerns/.keep b/testapp42/app/models/concerns/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/app/models/foo.rb b/testapp42/app/models/foo.rb deleted file mode 100644 index 0f518e4..0000000 --- a/testapp42/app/models/foo.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Foo < ActiveRecord::Base - self.default_connection = :slave - - belongs_to :bar -end diff --git a/testapp42/app/views/layouts/application.html.erb b/testapp42/app/views/layouts/application.html.erb deleted file mode 100644 index 046551c..0000000 --- a/testapp42/app/views/layouts/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - Pgcharmer - <%= stylesheet_link_tag "application", media: "all" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/testapp42/bin/bundle b/testapp42/bin/bundle deleted file mode 100755 index 66e9889..0000000 --- a/testapp42/bin/bundle +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -load Gem.bin_path('bundler', 'bundle') diff --git a/testapp42/bin/rails b/testapp42/bin/rails deleted file mode 100755 index 728cd85..0000000 --- a/testapp42/bin/rails +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) -require_relative '../config/boot' -require 'rails/commands' diff --git a/testapp42/bin/rake b/testapp42/bin/rake deleted file mode 100755 index 1724048..0000000 --- a/testapp42/bin/rake +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env ruby -require_relative '../config/boot' -require 'rake' -Rake.application.run diff --git a/testapp42/config.ru b/testapp42/config.ru deleted file mode 100644 index 361e2be..0000000 --- a/testapp42/config.ru +++ /dev/null @@ -1,4 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path('../config/environment', __FILE__) -run Pgcharmer::Application diff --git a/testapp42/config/application.rb b/testapp42/config/application.rb deleted file mode 100644 index e3de4b8..0000000 --- a/testapp42/config/application.rb +++ /dev/null @@ -1,24 +0,0 @@ -require File.expand_path('../boot', __FILE__) - -require 'rails/all' - -# Assets should be precompiled for production (so we don't need the gems loaded then) -Bundler.require(*Rails.groups(assets: %w(development test))) - -module Pgcharmer - 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. - - config.autoload_paths << config.root.join('lib') - - # 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 - end -end diff --git a/testapp42/config/boot.rb b/testapp42/config/boot.rb deleted file mode 100644 index 3596736..0000000 --- a/testapp42/config/boot.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) - -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/testapp42/config/database.yml b/testapp42/config/database.yml deleted file mode 100644 index f99b8f1..0000000 --- a/testapp42/config/database.yml +++ /dev/null @@ -1,15 +0,0 @@ -development: - adapter: postgresql - database: postamt - username: master - encoding: utf8 - slave: - username: slave - -test: - adapter: postgresql - database: postamt_test - username: master - encoding: utf8 - slave: - username: slave diff --git a/testapp42/config/environment.rb b/testapp42/config/environment.rb deleted file mode 100644 index 54a2eae..0000000 --- a/testapp42/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the rails application. -require File.expand_path('../application', __FILE__) - -# Initialize the rails application. -Pgcharmer::Application.initialize! diff --git a/testapp42/config/environments/development.rb b/testapp42/config/environments/development.rb deleted file mode 100644 index 0b1004a..0000000 --- a/testapp42/config/environments/development.rb +++ /dev/null @@ -1,27 +0,0 @@ -Pgcharmer::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 and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = false - - # 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. - config.assets.debug = true -end diff --git a/testapp42/config/environments/production.rb b/testapp42/config/environments/production.rb deleted file mode 100644 index 7f8c36a..0000000 --- a/testapp42/config/environments/production.rb +++ /dev/null @@ -1,80 +0,0 @@ -Pgcharmer::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 thread 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 - - # 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 Rails's static asset server (Apache or nginx will already do this). - config.serve_static_assets = false - - # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier - # config.assets.css_compressor = :sass - - # Whether to fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false - - # Generate digests for assets URLs. - config.assets.digest = true - - # Version of your assets, change this if you want to expire all your assets. - config.assets.version = '1.0' - - # 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 - - # Set to :debug to see everything in the log. - config.log_level = :info - - # 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) - - # 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" - - # Precompile additional assets. - # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. - # config.assets.precompile += %w( search.js ) - - # 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 - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found). - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Disable automatic flushing of the log to improve performance. - # config.autoflush_log = false - - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new -end diff --git a/testapp42/config/environments/test.rb b/testapp42/config/environments/test.rb deleted file mode 100644 index 164483d..0000000 --- a/testapp42/config/environments/test.rb +++ /dev/null @@ -1,36 +0,0 @@ -Pgcharmer::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 static asset server for tests with Cache-Control for performance. - config.serve_static_assets = true - config.static_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 - - # 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 - - # 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 - - # Print deprecation notices to the stderr. - config.active_support.deprecation = :stderr -end diff --git a/testapp42/config/initializers/backtrace_silencers.rb b/testapp42/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cd..0000000 --- a/testapp42/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/testapp42/config/initializers/filter_parameter_logging.rb b/testapp42/config/initializers/filter_parameter_logging.rb deleted file mode 100644 index 4a994e1..0000000 --- a/testapp42/config/initializers/filter_parameter_logging.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] diff --git a/testapp42/config/initializers/inflections.rb b/testapp42/config/initializers/inflections.rb deleted file mode 100644 index ac033bf..0000000 --- a/testapp42/config/initializers/inflections.rb +++ /dev/null @@ -1,16 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format. Inflections -# are locale specific, and you may define rules for as many different -# locales as you wish. All of these examples are active by default: -# ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end - -# These inflection rules are supported but not enabled by default: -# ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' -# end diff --git a/testapp42/config/initializers/mime_types.rb b/testapp42/config/initializers/mime_types.rb deleted file mode 100644 index 72aca7e..0000000 --- a/testapp42/config/initializers/mime_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/testapp42/config/initializers/secret_token.rb b/testapp42/config/initializers/secret_token.rb deleted file mode 100644 index a6b68c0..0000000 --- a/testapp42/config/initializers/secret_token.rb +++ /dev/null @@ -1,12 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key 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 `rake secret` to generate a secure secret key. - -# Make sure your secret_key_base is kept private -# if you're sharing your code publicly. -Pgcharmer::Application.config.secret_key_base = 'a3335a1fc626e2c546f47ba39d6ead14a6742c1a837e27578743f61f5140538d93e064743362fcd7459582e6e9c0931e1d9c64fe97f1f21865fc7892feaa192e' diff --git a/testapp42/config/initializers/session_store.rb b/testapp42/config/initializers/session_store.rb deleted file mode 100644 index 468758f..0000000 --- a/testapp42/config/initializers/session_store.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. -# https://github.com/rails/rails/commit/f9d23b3848ab81cfb5207e14ccabca3d2e9b3182 - -Pgcharmer::Application.config.session_store :cookie_store, key: '_pgcharmer_session' diff --git a/testapp42/config/initializers/wrap_parameters.rb b/testapp42/config/initializers/wrap_parameters.rb deleted file mode 100644 index 33725e9..0000000 --- a/testapp42/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] if respond_to?(:wrap_parameters) -end - -# To enable root element in JSON for ActiveRecord objects. -# ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true -# end diff --git a/testapp42/config/locales/en.yml b/testapp42/config/locales/en.yml deleted file mode 100644 index 0653957..0000000 --- a/testapp42/config/locales/en.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Files in the config/locales directory are used for internationalization -# and are automatically loaded by Rails. If you want to use locales other -# than English, add the necessary files in this directory. -# -# To use the locales, use `I18n.t`: -# -# I18n.t 'hello' -# -# In views, this is aliased to just `t`: -# -# <%= t('hello') %> -# -# To use a different locale, set it with `I18n.locale`: -# -# I18n.locale = :es -# -# This would use the information in config/locales/es.yml. -# -# To learn more, please read the Rails Internationalization guide -# available at http://guides.rubyonrails.org/i18n.html. - -en: - hello: "Hello world" diff --git a/testapp42/config/routes.rb b/testapp42/config/routes.rb deleted file mode 100644 index 9a61f24..0000000 --- a/testapp42/config/routes.rb +++ /dev/null @@ -1,49 +0,0 @@ -Pgcharmer::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". - - # You can have the root of your site routed with "root" - # root to: 'welcome#index' - - # Example of regular route: - # get 'products/:id' => 'catalog#view' - - # 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 within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end -end diff --git a/testapp42/db/migrate/20130408112524_create_foos.rb b/testapp42/db/migrate/20130408112524_create_foos.rb deleted file mode 100644 index 4b7a40b..0000000 --- a/testapp42/db/migrate/20130408112524_create_foos.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateFoos < ActiveRecord::Migration - def change - create_table :foos do |t| - t.integer :bar_id - - t.timestamps - end - end -end diff --git a/testapp42/db/migrate/20130408112535_create_bars.rb b/testapp42/db/migrate/20130408112535_create_bars.rb deleted file mode 100644 index 317e770..0000000 --- a/testapp42/db/migrate/20130408112535_create_bars.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateBars < ActiveRecord::Migration - def change - create_table :bars do |t| - t.text :message - - t.timestamps - end - end -end diff --git a/testapp42/db/schema.rb b/testapp42/db/schema.rb deleted file mode 100644 index 29c9abe..0000000 --- a/testapp42/db/schema.rb +++ /dev/null @@ -1,31 +0,0 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# 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). -# -# It's strongly recommended that you check this file into your version control system. - -ActiveRecord::Schema.define(version: 20130408112535) do - - # These are extensions that must be enabled in order to support this database - enable_extension "plpgsql" - - create_table "bars", force: true do |t| - t.text "message" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "foos", force: true do |t| - t.integer "bar_id" - t.datetime "created_at" - t.datetime "updated_at" - end - -end diff --git a/testapp42/db/seeds.rb b/testapp42/db/seeds.rb deleted file mode 100644 index 5b3f58f..0000000 --- a/testapp42/db/seeds.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). - -a = Bar.create!(message: 'a') -b = Bar.create!(message: 'b') -c = Bar.create!(message: 'c') - -Foo.create!(bar: a) -Foo.create!(bar: a) -Foo.create!(bar: b) diff --git a/testapp42/lib/assets/.keep b/testapp42/lib/assets/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/lib/tasks/.keep b/testapp42/lib/tasks/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/log/.keep b/testapp42/log/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/public/404.html b/testapp42/public/404.html deleted file mode 100644 index 3d875c3..0000000 --- a/testapp42/public/404.html +++ /dev/null @@ -1,27 +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/testapp42/public/422.html b/testapp42/public/422.html deleted file mode 100644 index 3f1bfb3..0000000 --- a/testapp42/public/422.html +++ /dev/null @@ -1,26 +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.

-
- - diff --git a/testapp42/public/500.html b/testapp42/public/500.html deleted file mode 100644 index 012977d..0000000 --- a/testapp42/public/500.html +++ /dev/null @@ -1,26 +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/testapp42/public/favicon.ico b/testapp42/public/favicon.ico deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/public/robots.txt b/testapp42/public/robots.txt deleted file mode 100644 index 1a3a5e4..0000000 --- a/testapp42/public/robots.txt +++ /dev/null @@ -1,5 +0,0 @@ -# See http://www.robotstxt.org/wc/norobots.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/testapp42/test/controllers/.keep b/testapp42/test/controllers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/test/fixtures/.keep b/testapp42/test/fixtures/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/test/fixtures/bars.yml b/testapp42/test/fixtures/bars.yml deleted file mode 100644 index 9590c9d..0000000 --- a/testapp42/test/fixtures/bars.yml +++ /dev/null @@ -1,7 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html - -one: - message: MyText - -two: - message: MyText diff --git a/testapp42/test/fixtures/foos.yml b/testapp42/test/fixtures/foos.yml deleted file mode 100644 index cdd8bf4..0000000 --- a/testapp42/test/fixtures/foos.yml +++ /dev/null @@ -1,7 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html - -one: - bar_id: 1 - -two: - bar_id: 1 diff --git a/testapp42/test/helpers/.keep b/testapp42/test/helpers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/test/integration/.keep b/testapp42/test/integration/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/test/integration/postamt_test.rb b/testapp42/test/integration/postamt_test.rb deleted file mode 100644 index ad20dae..0000000 --- a/testapp42/test/integration/postamt_test.rb +++ /dev/null @@ -1,97 +0,0 @@ -require 'test_helper' - -class PostamtTest < ActionDispatch::IntegrationTest - def username_for(model_klass) - model_klass.connection.pool.spec.config[:username] - end - - def transaction_open?(model_klass) - if Rails::VERSION::MAJOR == 4 - model_klass.connection.transaction_open? - else - !model_klass.connection.outside_transaction? - end - end - - teardown do - Bar.delete_all - Foo.delete_all - end - - test "self.default_connection" do - assert_equal "master", username_for(Bar) - assert_equal "slave", username_for(Foo) - end - - test "Postamt.on(...) overwrites default_connection" do - Postamt.on(:slave) do - assert_equal "slave", username_for(Bar) - assert_equal "slave", username_for(Foo) - end - - Postamt.on(:master) do - assert_equal "master", username_for(Bar) - assert_equal "master", username_for(Foo) - end - end - - test "transaction overwrites default_connection" do - assert_equal "master", username_for(Bar) - assert_equal "slave", username_for(Foo) - - ActiveRecord::Base.transaction do - assert_equal "master", username_for(Bar) - assert_equal "master", username_for(Foo) - end - - assert_equal "master", username_for(Bar) - assert_equal "slave", username_for(Foo) - end - - test "Postamt.on(..) overwrites transaction" do - assert_equal "master", username_for(Bar) - assert_equal "slave", username_for(Foo) - - ActiveRecord::Base.transaction do - assert_equal "master", username_for(Bar) - assert_equal "master", username_for(Foo) - - Postamt.on(:slave) do - assert_equal "slave", username_for(Bar) - assert_equal "slave", username_for(Foo) - end - - assert_equal "master", username_for(Bar) - assert_equal "master", username_for(Foo) - end - - assert_equal "master", username_for(Bar) - assert_equal "slave", username_for(Foo) - end - - test "master and slave are actually different connections" do - # We test this by checking if transaction isolation between master and slave works - bar = nil - - ActiveRecord::Base.transaction do - bar = Bar.create!(message: 'random') - - Postamt.on(:slave) do - assert_nil Bar.where(id: bar.id).first - end - - Postamt.on(:master) do - assert_not_nil Bar.where(id: bar.id).first - end - - assert transaction_open?(Bar) # still in transaction? - end - assert !transaction_open?(Bar) # outside transaction? - - # After the transaction commits Bar becomes visible on the slave too - Postamt.on(:slave) do - assert_not_nil Bar.where(id: bar.id).first - end - end - -end diff --git a/testapp42/test/mailers/.keep b/testapp42/test/mailers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/test/models/.keep b/testapp42/test/models/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/test/models/bar_test.rb b/testapp42/test/models/bar_test.rb deleted file mode 100644 index 372fcec..0000000 --- a/testapp42/test/models/bar_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class BarTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/testapp42/test/models/foo_test.rb b/testapp42/test/models/foo_test.rb deleted file mode 100644 index 25e4366..0000000 --- a/testapp42/test/models/foo_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class FooTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/testapp42/test/test_helper.rb b/testapp42/test/test_helper.rb deleted file mode 100644 index f08d596..0000000 --- a/testapp42/test/test_helper.rb +++ /dev/null @@ -1,17 +0,0 @@ -ENV["RAILS_ENV"] = "test" -require File.expand_path('../../config/environment', __FILE__) -require 'rails/test_help' - -class ActiveSupport::TestCase - ActiveRecord::Migration.check_pending! if Rails::VERSION::MAJOR == 4 - - # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. - # - # Note: You'll currently still have to declare fixtures explicitly in integration tests - # -- they do not yet inherit this setting - fixtures :all - - self.use_transactional_fixtures = false - - # Add more helper methods to be used by all tests here... -end diff --git a/testapp42/vendor/assets/javascripts/.keep b/testapp42/vendor/assets/javascripts/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/testapp42/vendor/assets/stylesheets/.keep b/testapp42/vendor/assets/stylesheets/.keep deleted file mode 100644 index e69de29..0000000