devise_imprintable 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +22 -0
  3. data/LICENSE +22 -0
  4. data/README.md +54 -0
  5. data/Rakefile +16 -0
  6. data/devise_imprintable.gemspec +29 -0
  7. data/lib/devise_imprintable/hook.rb +5 -0
  8. data/lib/devise_imprintable/model.rb +12 -0
  9. data/lib/devise_imprintable/version.rb +3 -0
  10. data/lib/devise_imprintable.rb +14 -0
  11. data/lib/generators/active_record/devise_imprintable_generator.rb +13 -0
  12. data/lib/generators/active_record/templates/migration.rb +14 -0
  13. data/lib/generators/devise_imprintable/devise_imprintable_generator.rb +17 -0
  14. data/test/integration/inventable_test.rb +34 -0
  15. data/test/integration_tests_helper.rb +51 -0
  16. data/test/orm/active_record.rb +4 -0
  17. data/test/rails_app/Rakefile +7 -0
  18. data/test/rails_app/app/controllers/application_controller.rb +3 -0
  19. data/test/rails_app/app/controllers/home_controller.rb +4 -0
  20. data/test/rails_app/app/controllers/users_controller.rb +12 -0
  21. data/test/rails_app/app/helpers/application_helper.rb +2 -0
  22. data/test/rails_app/app/models/user.rb +32 -0
  23. data/test/rails_app/app/views/home/index.html.erb +0 -0
  24. data/test/rails_app/app/views/layouts/application.html.erb +16 -0
  25. data/test/rails_app/app/views/users/invitations/new.html.erb +15 -0
  26. data/test/rails_app/config/application.rb +23 -0
  27. data/test/rails_app/config/boot.rb +11 -0
  28. data/test/rails_app/config/database.yml +22 -0
  29. data/test/rails_app/config/environment.rb +5 -0
  30. data/test/rails_app/config/environments/development.rb +25 -0
  31. data/test/rails_app/config/environments/production.rb +49 -0
  32. data/test/rails_app/config/environments/test.rb +35 -0
  33. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  34. data/test/rails_app/config/initializers/devise.rb +207 -0
  35. data/test/rails_app/config/initializers/inflections.rb +10 -0
  36. data/test/rails_app/config/initializers/mime_types.rb +5 -0
  37. data/test/rails_app/config/initializers/secret_token.rb +7 -0
  38. data/test/rails_app/config/initializers/session_store.rb +8 -0
  39. data/test/rails_app/config/initializers/wrap_parameters.rb +14 -0
  40. data/test/rails_app/config/locales/devise.en.yml +57 -0
  41. data/test/rails_app/config/locales/en.yml +14 -0
  42. data/test/rails_app/config/mongoid.yml +10 -0
  43. data/test/rails_app/config/routes.rb +4 -0
  44. data/test/rails_app/config.ru +4 -0
  45. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +28 -0
  46. data/test/rails_app/log/test.log +1641 -0
  47. data/test/rails_app/script/rails +6 -0
  48. data/test/test_helper.rb +23 -0
  49. metadata +176 -0
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in devise_imprintable.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'rails'
8
+ platforms :jruby do
9
+ gem 'activerecord-jdbcsqlite3-adapter'
10
+ end
11
+
12
+ platforms :ruby do
13
+ gem "sqlite3", "~> 1.3.4"
14
+ end
15
+
16
+ gem 'activerecord', '~> 3.0'
17
+ gem "capybara", "~> 1.1.0"
18
+ gem 'shoulda', '~> 2.11.3'
19
+ gem 'mocha', '~> 0.9.9'
20
+ gem 'factory_girl_rails', '~> 1.2'
21
+ gem 'rspec-rails', '~> 2.6.0'
22
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Sergey Efremov
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # Devise Imprintable
2
+
3
+ It adds support to [devise](http://github.com/plataformatec/devise) for track time and ip for first user sign in.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'devise_imprintable'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install devise_imprintable
18
+
19
+ When you are done, you are ready to add DeviseImprintable to any of your Devise models using the following generator:
20
+
21
+ rails generate devise_imprintable Model
22
+
23
+ Or just add fields to your model:
24
+
25
+ class DeviseInvitableAddToUsers < ActiveRecord::Migration
26
+ def up
27
+ change_table :users do |t|
28
+ t.datetime :first_sign_in_at
29
+ t.string :first_sign_in_ip
30
+ end
31
+ end
32
+
33
+ def down
34
+ change_table :users do |t|
35
+ t.remove :first_sign_ip, :first_sign_in_at
36
+ end
37
+ end
38
+ end
39
+
40
+ and add imprintable to your model:
41
+
42
+ class User < ActiveRecord::Base
43
+ devise :database_authenticatable, :registerable, :imprintable
44
+
45
+ ...
46
+ end
47
+
48
+ ## Contributing
49
+
50
+ 1. Fork it
51
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
52
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
53
+ 4. Push to the branch (`git push origin my-new-feature`)
54
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ require 'rake/testtask'
2
+
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ desc 'Default: run tests for all ORMs.'
7
+ task :default => :test
8
+
9
+
10
+ desc 'Run Devise unit tests.'
11
+ Rake::TestTask.new(:test) do |t|
12
+ t.libs << 'lib'
13
+ t.libs << 'test'
14
+ t.pattern = 'test/**/*_test.rb'
15
+ t.verbose = true
16
+ end
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/devise_imprintable/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Sergey Efremov"]
6
+ gem.email = ["efremov.sergey@gmail.com"]
7
+ gem.description = %q{An imprintable strategy for Devise}
8
+ gem.summary = %q{It adds support to devise for track time and ip for first user sign in.}
9
+ gem.homepage = "https://github.com/EvilFaeton/devise_imprintable"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "devise_imprintable"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = DeviseImprintable::VERSION
17
+
18
+ gem.required_ruby_version = '>= 1.8.6'
19
+ gem.required_rubygems_version = '>= 1.3.6'
20
+
21
+ gem.add_development_dependency('bundler', '>= 1.1.0')
22
+
23
+ {
24
+ 'railties' => '~> 3.0',
25
+ 'devise' => '>= 2.1.0'
26
+ }.each do |lib, version|
27
+ gem.add_runtime_dependency(lib, *version)
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ Warden::Manager.after_set_user :except => :fetch do |record, warden, options|
2
+ if record.respond_to?(:update_imprintable_fields!) && warden.authenticated?(options[:scope]) && !warden.request.env['devise.skip_imprintable']
3
+ record.update_imprintable_fields!(warden.request)
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ module Devise
2
+ module Models
3
+ module Imprintable
4
+ def update_imprintable_fields!(request)
5
+ self.first_sign_in_at = self.first_sign_in_at || Time.now
6
+ self.first_sign_in_ip = self.first_sign_in_ip || request.remote_ip
7
+ save(:validate => false) or raise "Devise imprintable could not save #{inspect}." \
8
+ "Please make sure a model using imprintable can be saved at sign in."
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module DeviseImprintable
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,14 @@
1
+ require "devise"
2
+
3
+ require "devise_imprintable/version"
4
+ require "devise_imprintable/model"
5
+ require "devise_imprintable/hook"
6
+
7
+ module DeviseImprintable
8
+
9
+ end
10
+
11
+
12
+ Devise.with_options :model => true do |d|
13
+ d.add_module :imprintable
14
+ end
@@ -0,0 +1,13 @@
1
+ require 'rails/generators/active_record'
2
+
3
+ module ActiveRecord
4
+ module Generators
5
+ class DeviseImprintableGenerator < ActiveRecord::Generators::Base
6
+ source_root File.expand_path("../templates", __FILE__)
7
+
8
+ def copy_devise_migration
9
+ migration_template "migration.rb", "db/migrate/devise_imprintable_add_to_#{table_name}"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ class DeviseInvitableAddTo<%= table_name.camelize %> < ActiveRecord::Migration
2
+ def up
3
+ change_table :<%= table_name %> do |t|
4
+ t.datetime :first_sign_in_at
5
+ t.string :first_sign_in_ip
6
+ end
7
+ end
8
+
9
+ def down
10
+ change_table :<%= table_name %> do |t|
11
+ t.remove :first_sign_ip, :first_sign_in_at
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ module DeviseImprintable
2
+ module Generators
3
+ class DeviseImprintableGenerator < Rails::Generators::NamedBase
4
+ namespace "devise_imprintable"
5
+
6
+ desc "Add :imprintable directive in the given model. Also generate migration for ActiveRecord"
7
+
8
+
9
+ def inject_devise_invitable_content
10
+ path = File.join("app", "models", "#{file_path}.rb")
11
+ inject_into_file(path, "imprintable, :", :after => "devise :") if File.exists?(path)
12
+ end
13
+
14
+ hook_for :orm
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,34 @@
1
+ require 'test_helper'
2
+ require 'integration_tests_helper'
3
+
4
+ class InvitationTest < ActionDispatch::IntegrationTest
5
+ def teardown
6
+ Capybara.reset_sessions!
7
+ end
8
+
9
+ test 'should have empty fields by default' do
10
+ user = create_full_user
11
+ assert_equal user.first_sign_in_at, nil
12
+ assert_equal user.first_sign_in_ip, nil
13
+ end
14
+
15
+ test 'should have not rewrite fields after they filled' do
16
+ time_stamp = 1.year.ago
17
+ user = create_full_user({:first_sign_in_at => time_stamp, :first_sign_in_ip => '127.0.0.1'})
18
+ sign_in_as_user user
19
+ user.reload
20
+ assert_equal user.first_sign_in_at, time_stamp
21
+ assert_equal user.first_sign_in_ip, '127.0.0.1'
22
+ end
23
+
24
+ test 'should fill first sign fields on first sign in' do
25
+ new_time = 2.seconds.from_now
26
+ Time.stubs(:now).returns(new_time)
27
+ user = create_full_user
28
+ sign_in_as_user user
29
+ user.reload
30
+ assert_equal user.first_sign_in_at, new_time
31
+ assert_equal user.first_sign_in_ip, '127.0.0.1'
32
+ end
33
+
34
+ end
@@ -0,0 +1,51 @@
1
+ class ActionController::IntegrationTest
2
+
3
+ def warden
4
+ request.env['warden']
5
+ end
6
+
7
+ def create_full_user(options = {})
8
+ @user ||= begin
9
+ user = User.create!({
10
+ :username => 'usertest',
11
+ :email => 'fulluser@test.com',
12
+ :password => '123456',
13
+ :password_confirmation => '123456',
14
+ :created_at => Time.now.utc
15
+ }.merge(options)
16
+ )
17
+
18
+ user.confirm!
19
+ user
20
+ end
21
+ end
22
+
23
+ def sign_in_as_user(user = nil)
24
+ user ||= create_full_user
25
+ resource_name = user.class.name.underscore
26
+ visit send("new_#{resource_name}_session_path")
27
+ fill_in "#{resource_name}_email", :with => user.email
28
+ fill_in "#{resource_name}_password", :with => user.password
29
+ click_button 'Sign in'
30
+ end
31
+
32
+ # Fix assert_redirect_to in integration sessions because they don't take into
33
+ # account Middleware redirects.
34
+ #
35
+ def assert_redirected_to(url)
36
+ assert [301, 302].include?(@integration_session.status),
37
+ "Expected status to be 301 or 302, got #{@integration_session.status}"
38
+
39
+ url = prepend_ho
40
+ st(url)
41
+ location = prepend_host(@integration_session.headers["Location"])
42
+ assert_equal url, location
43
+ end
44
+
45
+ protected
46
+
47
+ def prepend_host(url)
48
+ url = "http://#{request.host}#{url}" if url[0] == ?/
49
+ url
50
+ end
51
+ end
@@ -0,0 +1,4 @@
1
+ ActiveRecord::Migration.verbose = false
2
+ ActiveRecord::Base.logger = Logger.new(nil)
3
+
4
+ ActiveRecord::Migrator.migrate(File.expand_path("../../rails_app/db/migrate/", __FILE__))
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ RailsApp::Application.load_tasks
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,4 @@
1
+ class HomeController < ApplicationController
2
+ def index
3
+ end
4
+ end
@@ -0,0 +1,12 @@
1
+ class UsersController < ApplicationController
2
+ before_filter :authenticate_user!
3
+
4
+ def index
5
+ user_session[:cart] = "Cart"
6
+ end
7
+
8
+ def expire
9
+ user_session['last_request_at'] = 31.minutes.ago.utc
10
+ render :text => 'User will be expired on next request'
11
+ end
12
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,32 @@
1
+ class User < PARENT_MODEL_CLASS
2
+ if DEVISE_ORM == :mongoid
3
+ include Mongoid::Document
4
+
5
+ ## Database authenticatable
6
+ field :email, :type => String, :null => false, :default => ""
7
+ field :encrypted_password, :type => String, :null => false, :default => ""
8
+
9
+ ## Recoverable
10
+ field :reset_password_token, :type => String
11
+ field :reset_password_sent_at, :type => Time
12
+
13
+ ## Confirmable
14
+ field :confirmation_token, :type => String
15
+ field :confirmed_at, :type => Time
16
+ field :confirmation_sent_at, :type => Time
17
+ field :unconfirmed_email, :type => String # Only if using reconfirmable
18
+
19
+ ## Imprintable
20
+ field :first_sign_in_ip, :type => String
21
+ field :first_sign_in_at, :type => Time
22
+
23
+
24
+ field :username
25
+ attr_accessible :username, :email, :password, :password_confirmation, :remember_me
26
+ end
27
+
28
+ devise :database_authenticatable, :registerable, :validatable, :confirmable, :imprintable, :recoverable
29
+
30
+ attr_accessible :email, :username, :password, :password_confirmation, :first_sign_in_at, :first_sign_in_ip
31
+
32
+ end
File without changes
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>RailsApp</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= content_tag :p, flash[:notice], :id => 'notice' unless flash[:notice].blank? %>
12
+ <%= content_tag :p, flash[:alert], :id => 'alert' unless flash[:alert].blank? %>
13
+ <%= yield %>
14
+
15
+ </body>
16
+ </html>
@@ -0,0 +1,15 @@
1
+ <h2>Send an invitation</h2>
2
+
3
+ <%= form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => { :method => :post } do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :username %></p>
7
+ <p><%= f.text_field :username %></p>
8
+
9
+ <p><%= f.label :email %></p>
10
+ <p><%= f.text_field :email %></p>
11
+
12
+ <p><%= f.submit "Send an invitation" %></p>
13
+ <% end %>
14
+
15
+ <%= link_to "Home", after_sign_in_path_for(resource_name) %><br />
@@ -0,0 +1,23 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "action_controller/railtie"
4
+ require "action_mailer/railtie"
5
+ require "rails/test_unit/railtie"
6
+
7
+ Bundler.require(:default, DEVISE_ORM) if defined?(Bundler)
8
+
9
+ begin
10
+ require "#{DEVISE_ORM}/railtie"
11
+ rescue LoadError
12
+ end
13
+ PARENT_MODEL_CLASS = DEVISE_ORM == :active_record ? ActiveRecord::Base : Object
14
+
15
+ require "devise"
16
+ require "devise_imprintable"
17
+
18
+ module RailsApp
19
+ class Application < Rails::Application
20
+ config.filter_parameters << :password
21
+ config.action_mailer.default_url_options = { :host => "localhost:3000" }
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ unless defined?(DEVISE_ORM)
2
+ DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
3
+ end
4
+
5
+ begin
6
+ require File.expand_path("../../../../.bundle/environment", __FILE__)
7
+ rescue LoadError
8
+ require 'rubygems'
9
+ require 'bundler'
10
+ Bundler.setup :default, :test, DEVISE_ORM
11
+ end
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: ":memory:"
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: ":memory:"
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ RailsApp::Application.initialize!
@@ -0,0 +1,25 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the webserver when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+ end
25
+
@@ -0,0 +1,49 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Specifies the header that your server uses for sending files
13
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
+
15
+ # For nginx:
16
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
+
18
+ # If you have no front-end server that supports something like X-Sendfile,
19
+ # just comment this out and Rails will serve the files
20
+
21
+ # See everything in the log (default is :info)
22
+ # config.log_level = :debug
23
+
24
+ # Use a different logger for distributed setups
25
+ # config.logger = SyslogLogger.new
26
+
27
+ # Use a different cache store in production
28
+ # config.cache_store = :mem_cache_store
29
+
30
+ # Disable Rails's static asset server
31
+ # In production, Apache or nginx will already do this
32
+ config.serve_static_assets = false
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Disable delivery errors, bad email addresses will be ignored
38
+ # config.action_mailer.raise_delivery_errors = false
39
+
40
+ # Enable threaded mode
41
+ # config.threadsafe!
42
+
43
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
+ # the I18n.default_locale when a translation can not be found)
45
+ config.i18n.fallbacks = true
46
+
47
+ # Send deprecation notices to registered listeners
48
+ config.active_support.deprecation = :notify
49
+ end
@@ -0,0 +1,35 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ Rails.backtrace_cleaner.remove_silencers!