Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Upgrade to Rails 4 #7

Merged
merged 6 commits into from

2 participants

@gabebw
Admin

This commit updates JackUp to Rails 4. Important points that I'd like your opinion on:

  • JackUp now requires Rails 4.0+
  • I removed the respond_to :json from the AssetsController in the dummy app. Was that important? The Remove respond_to :json commit explains my reasoning.
gabebw added some commits
@gabebw gabebw Upgrade dummy app to Rails 4 bd2a9d0
@gabebw gabebw Fixes for new version of Capybara
* Capybara looks in spec/features now
* Add selenium-webdriver to Gemfile
73e3a65
@gabebw gabebw Clean up specs a bit
* Use expect syntax
* Use `have_css` instead of assuming `find` will not raise an exception
b76a14f
@gabebw gabebw Remove attr_accessible, update README 69a20d9
@gabebw gabebw Run dummy app migrations 63fdfba
@gabebw gabebw Remove respond_to :json
Setting the `JackUp.Processor` path to `/assets.json` made it not include the
file in the params. Without the `.json`, it correctly saved the Asset record
with the attached file, but then returned a 406 "content not acceptable" error
since the controller only responds to JSON, and it was processed as HTML.

This way it accepts the HTML request and returns JSON to JackUp.
645a20f
@joshuaclayton joshuaclayton merged commit 645a20f into from
@joshuaclayton joshuaclayton deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 18, 2013
  1. @gabebw

    Upgrade dummy app to Rails 4

    gabebw authored
  2. @gabebw

    Fixes for new version of Capybara

    gabebw authored
    * Capybara looks in spec/features now
    * Add selenium-webdriver to Gemfile
  3. @gabebw

    Clean up specs a bit

    gabebw authored
    * Use expect syntax
    * Use `have_css` instead of assuming `find` will not raise an exception
  4. @gabebw
  5. @gabebw

    Run dummy app migrations

    gabebw authored
  6. @gabebw

    Remove respond_to :json

    gabebw authored
    Setting the `JackUp.Processor` path to `/assets.json` made it not include the
    file in the params. Without the `.json`, it correctly saved the Asset record
    with the attached file, but then returned a 406 "content not acceptable" error
    since the controller only responds to JSON, and it was processed as HTML.
    
    This way it accepts the HTML request and returns JSON to JackUp.
This page is out of date. Refresh to see the latest.
Showing with 369 additions and 296 deletions.
  1. +5 −15 Gemfile
  2. +102 −108 Gemfile.lock
  3. +15 −5 README.md
  4. +1 −1  jack_up.gemspec
  5. +0 −8 script/rails
  6. +0 −1  spec/dummy/Rakefile
  7. +3 −1 spec/dummy/app/controllers/application_controller.rb
  8. +4 −5 spec/dummy/app/controllers/assets_controller.rb
  9. +0 −1  spec/dummy/app/models/asset.rb
  10. +1 −1  spec/dummy/config.ru
  11. +4 −45 spec/dummy/config/application.rb
  12. +4 −4 spec/dummy/config/boot.rb
  13. +2 −2 spec/dummy/config/environment.rb
  14. +11 −13 spec/dummy/config/environments/development.rb
  15. +40 −24 spec/dummy/config/environments/production.rb
  16. +13 −12 spec/dummy/config/environments/test.rb
  17. +4 −0 spec/dummy/config/initializers/filter_parameter_logging.rb
  18. +6 −5 spec/dummy/config/initializers/inflections.rb
  19. +7 −2 spec/dummy/config/initializers/secret_token.rb
  20. +0 −5 spec/dummy/config/initializers/session_store.rb
  21. +6 −2 spec/dummy/config/initializers/wrap_parameters.rb
  22. 0  spec/dummy/log/.keep
  23. +43 −11 spec/dummy/public/404.html
  24. +43 −11 spec/dummy/public/422.html
  25. +43 −11 spec/dummy/public/500.html
  26. +5 −0 spec/dummy/public/robots.txt
  27. +2 −2 spec/{integration → features}/upload_spec.rb
  28. +5 −1 spec/spec_helper.rb
View
20 Gemfile
@@ -1,25 +1,15 @@
source "http://rubygems.org"
-# Declare your gem's dependencies in jack_up.gemspec.
-# Bundler will treat runtime dependencies like base dependencies, and
-# development dependencies will be added by default to the :development group.
gemspec
# The following gems are used by the dummy application
+gem 'capybara'
+gem 'coffee-rails'
gem 'database_cleaner'
+gem 'high_voltage'
gem 'jquery-rails'
+gem 'paperclip', '>= 3.1.4'
gem 'rack-raw-upload'
gem 'rspec-rails'
-gem 'capybara'
-gem 'high_voltage'
-gem 'coffee-rails'
+gem 'selenium-webdriver'
gem 'sqlite3'
-gem 'paperclip', '>= 3.1.4'
-
-# Declare any dependencies that are still in development here instead of in
-# your gemspec. These might include edge Rails or gems from your path or
-# Git. Remember to move these dependencies to your gemspec before releasing
-# your gem to rubygems.org.
-
-# To use debugger
-# gem 'debugger'
View
210 Gemfile.lock
@@ -2,146 +2,139 @@ PATH
remote: .
specs:
jack_up (0.1.1)
- rails (~> 3.1)
+ rails (~> 4.0)
GEM
remote: http://rubygems.org/
specs:
- actionmailer (3.2.7)
- actionpack (= 3.2.7)
- mail (~> 2.4.4)
- actionpack (3.2.7)
- activemodel (= 3.2.7)
- activesupport (= 3.2.7)
- builder (~> 3.0.0)
+ actionmailer (4.0.1)
+ actionpack (= 4.0.1)
+ mail (~> 2.5.4)
+ actionpack (4.0.1)
+ activesupport (= 4.0.1)
+ builder (~> 3.1.0)
erubis (~> 2.7.0)
- journey (~> 1.0.4)
- rack (~> 1.4.0)
- rack-cache (~> 1.2)
- rack-test (~> 0.6.1)
- sprockets (~> 2.1.3)
- activemodel (3.2.7)
- activesupport (= 3.2.7)
- builder (~> 3.0.0)
- activerecord (3.2.7)
- activemodel (= 3.2.7)
- activesupport (= 3.2.7)
- arel (~> 3.0.2)
- tzinfo (~> 0.3.29)
- activeresource (3.2.7)
- activemodel (= 3.2.7)
- activesupport (= 3.2.7)
- activesupport (3.2.7)
- i18n (~> 0.6)
- multi_json (~> 1.0)
- addressable (2.3.2)
- arel (3.0.2)
- builder (3.0.0)
- capybara (1.1.2)
+ rack (~> 1.5.2)
+ rack-test (~> 0.6.2)
+ activemodel (4.0.1)
+ activesupport (= 4.0.1)
+ builder (~> 3.1.0)
+ activerecord (4.0.1)
+ activemodel (= 4.0.1)
+ activerecord-deprecated_finders (~> 1.0.2)
+ activesupport (= 4.0.1)
+ arel (~> 4.0.0)
+ activerecord-deprecated_finders (1.0.3)
+ activesupport (4.0.1)
+ i18n (~> 0.6, >= 0.6.4)
+ minitest (~> 4.2)
+ multi_json (~> 1.3)
+ thread_safe (~> 0.1)
+ tzinfo (~> 0.3.37)
+ arel (4.0.1)
+ atomic (1.1.14)
+ builder (3.1.4)
+ capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
- selenium-webdriver (~> 2.0)
- xpath (~> 0.1.4)
- childprocess (0.3.4)
- ffi (~> 1.0, >= 1.0.6)
- cocaine (0.2.1)
- coffee-rails (3.2.2)
+ xpath (~> 2.0)
+ childprocess (0.3.9)
+ ffi (~> 1.0, >= 1.0.11)
+ climate_control (0.0.3)
+ activesupport (>= 3.0)
+ cocaine (0.5.3)
+ climate_control (>= 0.0.3, < 1.0)
+ coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
- railties (~> 3.2.0)
+ railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0)
coffee-script-source
execjs
- coffee-script-source (1.3.3)
- database_cleaner (0.8.0)
- diff-lcs (1.1.3)
+ coffee-script-source (1.6.3)
+ database_cleaner (1.2.0)
+ diff-lcs (1.2.5)
erubis (2.7.0)
- execjs (1.4.0)
- multi_json (~> 1.0)
- ffi (1.1.3)
- high_voltage (1.1.1)
- hike (1.2.1)
- i18n (0.6.0)
- journey (1.0.4)
- jquery-rails (2.0.2)
- railties (>= 3.2.0, < 5.0)
- thor (~> 0.14)
- json (1.7.4)
- libwebsocket (0.1.5)
- addressable
- mail (2.4.4)
- i18n (>= 0.4.0)
+ execjs (2.0.2)
+ ffi (1.9.3)
+ high_voltage (2.0.0)
+ hike (1.2.3)
+ i18n (0.6.5)
+ jquery-rails (3.0.4)
+ railties (>= 3.0, < 5.0)
+ thor (>= 0.14, < 2.0)
+ mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- mime-types (1.19)
- multi_json (1.3.6)
- nokogiri (1.5.5)
- paperclip (3.1.4)
+ mime-types (1.25)
+ mini_portile (0.5.2)
+ minitest (4.7.5)
+ multi_json (1.8.2)
+ nokogiri (1.6.0)
+ mini_portile (~> 0.5.0)
+ paperclip (3.5.2)
activemodel (>= 3.0.0)
- activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
- cocaine (>= 0.0.2)
+ cocaine (~> 0.5.3)
mime-types
polyglot (0.3.3)
- rack (1.4.1)
- rack-cache (1.2)
- rack (>= 0.4)
- rack-raw-upload (1.1.0)
- json
- rack-ssl (1.3.2)
- rack
- rack-test (0.6.1)
+ rack (1.5.2)
+ rack-raw-upload (1.1.1)
+ multi_json
+ rack-test (0.6.2)
rack (>= 1.0)
- rails (3.2.7)
- actionmailer (= 3.2.7)
- actionpack (= 3.2.7)
- activerecord (= 3.2.7)
- activeresource (= 3.2.7)
- activesupport (= 3.2.7)
- bundler (~> 1.0)
- railties (= 3.2.7)
- railties (3.2.7)
- actionpack (= 3.2.7)
- activesupport (= 3.2.7)
- rack-ssl (~> 1.3.2)
+ rails (4.0.1)
+ actionmailer (= 4.0.1)
+ actionpack (= 4.0.1)
+ activerecord (= 4.0.1)
+ activesupport (= 4.0.1)
+ bundler (>= 1.3.0, < 2.0)
+ railties (= 4.0.1)
+ sprockets-rails (~> 2.0.0)
+ railties (4.0.1)
+ actionpack (= 4.0.1)
+ activesupport (= 4.0.1)
rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (>= 0.14.6, < 2.0)
- rake (0.9.2.2)
- rdoc (3.12)
- json (~> 1.4)
- rspec (2.11.0)
- rspec-core (~> 2.11.0)
- rspec-expectations (~> 2.11.0)
- rspec-mocks (~> 2.11.0)
- rspec-core (2.11.1)
- rspec-expectations (2.11.2)
- diff-lcs (~> 1.1.3)
- rspec-mocks (2.11.1)
- rspec-rails (2.11.0)
+ thor (>= 0.18.1, < 2.0)
+ rake (10.1.0)
+ rspec-core (2.14.7)
+ rspec-expectations (2.14.4)
+ diff-lcs (>= 1.1.3, < 2.0)
+ rspec-mocks (2.14.4)
+ rspec-rails (2.14.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
- rspec (~> 2.11.0)
- rubyzip (0.9.9)
- selenium-webdriver (2.25.0)
+ rspec-core (~> 2.14.0)
+ rspec-expectations (~> 2.14.0)
+ rspec-mocks (~> 2.14.0)
+ rubyzip (1.0.0)
+ selenium-webdriver (2.37.0)
childprocess (>= 0.2.5)
- libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
- rubyzip
- sprockets (2.1.3)
+ rubyzip (~> 1.0.0)
+ websocket (~> 1.0.4)
+ sprockets (2.10.0)
hike (~> 1.2)
+ multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sqlite3 (1.3.6)
- thor (0.15.4)
- tilt (1.3.3)
- treetop (1.4.10)
+ sprockets-rails (2.0.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ sprockets (~> 2.8)
+ sqlite3 (1.3.8)
+ thor (0.18.1)
+ thread_safe (0.1.3)
+ atomic
+ tilt (1.4.1)
+ treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
- tzinfo (0.3.33)
- xpath (0.1.4)
+ tzinfo (0.3.38)
+ websocket (1.0.7)
+ xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
@@ -157,4 +150,5 @@ DEPENDENCIES
paperclip (>= 3.1.4)
rack-raw-upload
rspec-rails
+ selenium-webdriver
sqlite3
View
20 README.md
@@ -23,7 +23,7 @@ Modify your `application.js` manifest:
### Requirements
-Rails 3.1 (for the asset pipeline), CoffeeScript, and both jQuery and
+Rails 4.0+, CoffeeScript, and both jQuery and
Underscore.js included in your `application.js` manifest.
### Usage
@@ -99,13 +99,12 @@ uploads.
# app/models/asset.rb
class Asset < ActiveRecord::Base
has_attached_file :photo
- attr_accessible :photo
end
# app/controllers/assets_controller.rb
class AssetsController < ApplicationController
def create
- @asset = Asset.new(photo: params[:file])
+ @asset = Asset.new(photo: asset_params[:file])
if @asset.save
render json: @asset
@@ -113,6 +112,12 @@ class AssetsController < ApplicationController
head :bad_request
end
end
+
+ private
+
+ def asset_params
+ params.permit(:file)
+ end
end
```
@@ -134,7 +139,6 @@ If attaching assets to a different model, additionally use:
class Post < ActiveRecord::Base
has_many :assets, dependent: :destroy
- attr_accessible :asset_ids, :assets_attributes
accepts_nested_attributes_for :assets
end
@@ -146,10 +150,16 @@ class PostsController < ApplicationController
end
def create
- @post = Post.new(params[:post])
+ @post = Post.new(post_params)
@post.save
respond_with @post
end
+
+ private
+
+ def post_params
+ params.require(:post).permit(:asset_ids, :assets_attributes)
+ end
end
```
View
2  jack_up.gemspec
@@ -13,5 +13,5 @@ Gem::Specification.new do |s|
s.summary = 'Easy AJAX file uploading in Rails'
s.description = 'Easy AJAX file uploading in Rails'
s.files = Dir['lib/**/*'] + ['LICENSE', 'Rakefile', 'README.md']
- s.add_dependency 'rails', '~> 3.1'
+ s.add_dependency 'rails', '~> 4.0'
end
View
8 script/rails
@@ -1,8 +0,0 @@
-#!/usr/bin/env ruby
-# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
-
-ENGINE_ROOT = File.expand_path('../..', __FILE__)
-ENGINE_PATH = File.expand_path('../../lib/jack_up/engine', __FILE__)
-
-require 'rails/all'
-require 'rails/engine/commands'
View
1  spec/dummy/Rakefile
@@ -1,4 +1,3 @@
-#!/usr/bin/env rake
# 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.
View
4 spec/dummy/app/controllers/application_controller.rb
@@ -1,3 +1,5 @@
class ApplicationController < ActionController::Base
- protect_from_forgery
+ # Prevent CSRF attacks by raising an exception.
+ # For APIs, you may want to use :null_session instead.
+ protect_from_forgery with: :exception
end
View
9 spec/dummy/app/controllers/assets_controller.rb
@@ -1,9 +1,8 @@
class AssetsController < ApplicationController
- respond_to :json
-
def create
- @asset = Asset.new(file: params[:file])
- @asset.save
- respond_with @asset
+ asset = Asset.new(file: params[:file])
+ asset.save
+
+ render json: asset
end
end
View
1  spec/dummy/app/models/asset.rb
@@ -1,4 +1,3 @@
class Asset < ActiveRecord::Base
has_attached_file :file
- attr_accessible :file
end
View
2  spec/dummy/config.ru
@@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
-run Dummy::Application
+run Rails.application
View
49 spec/dummy/config/application.rb
@@ -1,14 +1,10 @@
require File.expand_path('../boot', __FILE__)
-# Pick the frameworks you want:
-require "active_record/railtie"
-require "action_controller/railtie"
-require "action_mailer/railtie"
-require "active_resource/railtie"
-require "sprockets/railtie"
-# require "rails/test_unit/railtie"
+require 'rails/all'
-Bundler.require
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(:default, Rails.env)
require "jack_up"
module Dummy
@@ -17,16 +13,6 @@ class Application < Rails::Application
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
- # Custom directories with classes and modules you want to be autoloadable.
- # config.autoload_paths += %W(#{config.root}/extras)
-
- # Only load the plugins named here, in the order given (default is alphabetical).
- # :all can be used as a placeholder for all plugins not explicitly named.
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
-
- # Activate observers that should always be running.
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
-
# 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)'
@@ -35,33 +21,6 @@ class Application < Rails::Application
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
- # Configure the default encoding used in templates for Ruby 1.9.
- config.encoding = "utf-8"
-
- # Configure sensitive parameters which will be filtered from the log file.
- config.filter_parameters += [:password]
-
- # Enable escaping HTML in JSON.
- config.active_support.escape_html_entities_in_json = true
-
- # Use SQL instead of Active Record's schema dumper when creating the database.
- # This is necessary if your schema can't be completely dumped by the schema dumper,
- # like if you have constraints or database-specific column types
- # config.active_record.schema_format = :sql
-
- # Enforce whitelist mode for mass assignment.
- # This will create an empty whitelist of attributes available for mass-assignment for all models
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
- # parameters by using an attr_accessible or attr_protected declaration.
- # config.active_record.whitelist_attributes = true
-
- # Enable the asset pipeline
- config.assets.enabled = true
-
- # Version of your assets, change this if you want to expire all your assets
- config.assets.version = '1.0'
-
config.middleware.use 'Rack::RawUpload', paths: ['/assets']
end
end
-
View
8 spec/dummy/config/boot.rb
@@ -1,10 +1,10 @@
-require 'rubygems'
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
if File.exist?(gemfile)
ENV['BUNDLE_GEMFILE'] = gemfile
- require 'bundler'
- Bundler.setup
+ require 'bundler/setup'
+else
+ raise 'dummy app could not find Gemfile'
end
-$:.unshift File.expand_path('../../../../lib', __FILE__)
+$:.unshift File.expand_path('../../../../lib', __FILE__)
View
4 spec/dummy/config/environment.rb
@@ -1,5 +1,5 @@
-# Load the rails application
+# Load the Rails application.
require File.expand_path('../application', __FILE__)
-# Initialize the rails application
+# Initialize the Rails application.
Dummy::Application.initialize!
View
24 spec/dummy/config/environments/development.rb
@@ -1,31 +1,29 @@
Dummy::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
+ # 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
- # Log error messages when you accidentally call methods on nil.
- config.whiny_nils = true
+ # Do not eager load code on boot.
+ config.eager_load = false
- # Show full error reports and disable caching
+ # 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
+ # Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
- # Print deprecation notices to the Rails logger
+ # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
- # Only use best-standards-support built into browsers
- config.action_dispatch.best_standards_support = :builtin
+ # Raise an error on page load if there are pending migrations
+ config.active_record.migration_error = :page_load
-
- # Do not compress assets
- config.assets.compress = false
-
- # Expands the lines which load the assets
+ # 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
end
View
64 spec/dummy/config/environments/production.rb
@@ -1,64 +1,80 @@
Dummy::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
+ # Settings specified here will take precedence over those in config/application.rb.
- # Code is not reloaded between requests
+ # Code is not reloaded between requests.
config.cache_classes = true
- # Full error reports are disabled and caching is turned on
+ # 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
- # Disable Rails's static asset server (Apache or nginx will already do this)
+ # 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.compress = true
+ # Compress JavaScripts and CSS.
+ config.assets.js_compressor = :uglifier
+ # config.assets.css_compressor = :sass
- # Don't fallback to assets pipeline if a precompiled asset is missed
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
- # Generate digests for assets URLs
+ # Generate digests for assets URLs.
config.assets.digest = true
- # Defaults to nil and saved in location specified by config.assets.prefix
- # config.assets.manifest = YOUR_PATH
+ # 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
+ # 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
- # See everything in the log (default is :info)
- # config.log_level = :debug
+ # Set to :debug to see everything in the log.
+ config.log_level = :info
- # Prepend all log lines with the following tags
+ # Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
- # Use a different logger for distributed setups
+ # Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
- # Use a different cache store in production
+ # Use a different cache store in production.
# config.cache_store = :mem_cache_store
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
+ # 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 are already added)
+ # 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 )
- # Disable delivery errors, bad email addresses will be ignored
+ # 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 threaded mode
- # config.threadsafe!
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
- # the I18n.default_locale when a translation can not be found)
+ # the I18n.default_locale when a translation can not be found).
config.i18n.fallbacks = true
- # Send deprecation notices to registered listeners
+ # 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
View
25 spec/dummy/config/environments/test.rb
@@ -1,5 +1,5 @@
Dummy::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
+ # 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
@@ -7,29 +7,30 @@
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
- # Configure static asset server for tests with Cache-Control for performance
- config.serve_static_assets = true
- config.static_cache_control = "public, max-age=3600"
+ # 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
- # Log error messages when you accidentally call methods on nil
- config.whiny_nils = true
+ # 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
+ # 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
+ # 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
+ # 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
+ # Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
end
View
4 spec/dummy/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]
View
11 spec/dummy/config/initializers/inflections.rb
@@ -1,15 +1,16 @@
# Be sure to restart your server when you modify this file.
-# Add new inflection rules using the following format
-# (all these examples are active by default):
-# ActiveSupport::Inflector.inflections do |inflect|
+# 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 do |inflect|
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
View
9 spec/dummy/config/initializers/secret_token.rb
@@ -1,7 +1,12 @@
# Be sure to restart your server when you modify this file.
-# Your secret key for verifying the integrity of signed cookies.
+# 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.
-Dummy::Application.config.secret_token = '26c5851d4f2e5da2111453c427867226ad95472bc91da13324c96d5cd0e59baa3c20441a740192fe58731ec1edf1cb8e41b1194d970f3c7cf0a4b319dce0e052'
+# 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.
+Dummy::Application.config.secret_key_base = 'a1ed8143ee3c45fafb2b02b8530ae75e75fce749c952f05e3097d111b1ee278e0cbba9749941b950a4021bec8b16118e3904d4218312f0db544d587f044ddb4f'
View
5 spec/dummy/config/initializers/session_store.rb
@@ -1,8 +1,3 @@
# Be sure to restart your server when you modify this file.
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
-
-# Use the database for sessions instead of the cookie-based default,
-# which shouldn't be used to store highly confidential information
-# (create the session table with "rails generate session_migration")
-# Dummy::Application.config.session_store :active_record_store
View
8 spec/dummy/config/initializers/wrap_parameters.rb
@@ -1,10 +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]
+ 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
View
0  spec/dummy/log/.keep
No changes.
View
54 spec/dummy/public/404.html
@@ -2,17 +2,48 @@
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ <style>
+ body {
+ background-color: #EFEFEF;
+ color: #2E2F30;
+ text-align: center;
+ font-family: arial, sans-serif;
+ }
+
+ div.dialog {
+ width: 25em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-left-color: #999;
+ border-bottom-color: #BBB;
+ border-top: #B00100 solid 4px;
+ border-top-left-radius: 9px;
+ border-top-right-radius: 9px;
+ background-color: white;
+ padding: 7px 4em 0 4em;
+ }
+
+ h1 {
+ font-size: 100%;
+ color: #730E15;
+ line-height: 1.5em;
+ }
+
+ body > p {
+ width: 33em;
+ margin: 0 auto 1em;
+ padding: 1em 0;
+ background-color: #F7F7F7;
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ border-top-color: #DADADA;
+ color: #666;
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
+ }
</style>
</head>
@@ -22,5 +53,6 @@
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
+ <p>If you are the application owner check the logs for more information.</p>
</body>
</html>
View
54 spec/dummy/public/422.html
@@ -2,17 +2,48 @@
<html>
<head>
<title>The change you wanted was rejected (422)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ <style>
+ body {
+ background-color: #EFEFEF;
+ color: #2E2F30;
+ text-align: center;
+ font-family: arial, sans-serif;
+ }
+
+ div.dialog {
+ width: 25em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-left-color: #999;
+ border-bottom-color: #BBB;
+ border-top: #B00100 solid 4px;
+ border-top-left-radius: 9px;
+ border-top-right-radius: 9px;
+ background-color: white;
+ padding: 7px 4em 0 4em;
+ }
+
+ h1 {
+ font-size: 100%;
+ color: #730E15;
+ line-height: 1.5em;
+ }
+
+ body > p {
+ width: 33em;
+ margin: 0 auto 1em;
+ padding: 1em 0;
+ background-color: #F7F7F7;
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ border-top-color: #DADADA;
+ color: #666;
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
+ }
</style>
</head>
@@ -22,5 +53,6 @@
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
+ <p>If you are the application owner check the logs for more information.</p>
</body>
</html>
View
54 spec/dummy/public/500.html
@@ -2,17 +2,48 @@
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ <style>
+ body {
+ background-color: #EFEFEF;
+ color: #2E2F30;
+ text-align: center;
+ font-family: arial, sans-serif;
+ }
+
+ div.dialog {
+ width: 25em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-left-color: #999;
+ border-bottom-color: #BBB;
+ border-top: #B00100 solid 4px;
+ border-top-left-radius: 9px;
+ border-top-right-radius: 9px;
+ background-color: white;
+ padding: 7px 4em 0 4em;
+ }
+
+ h1 {
+ font-size: 100%;
+ color: #730E15;
+ line-height: 1.5em;
+ }
+
+ body > p {
+ width: 33em;
+ margin: 0 auto 1em;
+ padding: 1em 0;
+ background-color: #F7F7F7;
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ border-top-color: #DADADA;
+ color: #666;
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
+ }
</style>
</head>
@@ -21,5 +52,6 @@
<div class="dialog">
<h1>We're sorry, but something went wrong.</h1>
</div>
+ <p>If you are the application owner check the logs for more information.</p>
</body>
</html>
View
5 spec/dummy/public/robots.txt
@@ -0,0 +1,5 @@
+# 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: /
View
4 spec/integration/upload_spec.rb → spec/features/upload_spec.rb
@@ -5,7 +5,7 @@
visit root_path
attach_file 'upload', Rails.root.join(*%w(public ralph.png)).to_s
- find('.attachments img').should be_present
- Asset.last.file_file_name.should eq 'ralph.png'
+ expect(page).to have_css('.attachments img')
+ expect(Asset.last.file_file_name).to eq 'ralph.png'
end
end
View
6 spec/spec_helper.rb
@@ -1,7 +1,6 @@
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../spec/dummy/config/environment', __FILE__)
require 'rspec/rails'
-require 'rspec/autorun'
require 'database_cleaner'
Dir[Rails.root.join('spec/support/**/*.rb')].each {|f| require f}
@@ -11,5 +10,10 @@
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
+ run_dummy_app_migrations
+ end
+
+ def run_dummy_app_migrations
+ ActiveRecord::Migrator.migrate(Rails.root.join('db', 'migrate'))
end
end
Something went wrong with that request. Please try again.