updated to rails 3.2, fixed tests
This commit is contained in:
5
Gemfile
5
Gemfile
@@ -14,13 +14,14 @@ group :assets do
|
|||||||
gem "therubyracer"
|
gem "therubyracer"
|
||||||
end
|
end
|
||||||
|
|
||||||
gem "rails", "3.1.3"
|
gem "rails", "3.2.0"
|
||||||
gem "pg"
|
gem "pg"
|
||||||
gem "memcache-client", :require => "memcache"
|
gem "memcache-client", :require => "memcache"
|
||||||
gem "delayed_job"
|
gem "delayed_job"
|
||||||
|
gem "delayed_job_active_record"
|
||||||
gem "super_exception_notifier"
|
gem "super_exception_notifier"
|
||||||
gem "simple_form"
|
gem "simple_form"
|
||||||
gem "mechanize"
|
gem "mechanize", git: 'git://github.com/caribio/mechanize.git'
|
||||||
gem "nokogiri"
|
gem "nokogiri"
|
||||||
gem "meta_search", :git => "git://github.com/ernie/meta_search.git"
|
gem "meta_search", :git => "git://github.com/ernie/meta_search.git"
|
||||||
gem "silent-postgres"
|
gem "silent-postgres"
|
||||||
|
|||||||
165
Gemfile.lock
165
Gemfile.lock
@@ -1,11 +1,23 @@
|
|||||||
|
GIT
|
||||||
|
remote: git://github.com/caribio/mechanize.git
|
||||||
|
revision: 602a453f25c376681317e1f1af7229d39ccfff3d
|
||||||
|
specs:
|
||||||
|
mechanize (2.1.1)
|
||||||
|
domain_name (~> 0.5, >= 0.5.1)
|
||||||
|
net-http-digest_auth (~> 1.1, >= 1.1.1)
|
||||||
|
net-http-persistent (~> 2.3, >= 2.3.2)
|
||||||
|
nokogiri (~> 1.4)
|
||||||
|
ntlm-http (~> 0.1, >= 0.1.1)
|
||||||
|
webrobots (~> 0.0, >= 0.0.9)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/ernie/meta_search.git
|
remote: git://github.com/ernie/meta_search.git
|
||||||
revision: 1b8522a4129b5771c920898cb05badbe119c2f35
|
revision: 5bfe8322ac3c56ed8c714c1892aebf1390e7db5e
|
||||||
specs:
|
specs:
|
||||||
meta_search (1.1.1)
|
meta_search (1.1.2)
|
||||||
actionpack (~> 3.1.0)
|
actionpack (~> 3.1)
|
||||||
activerecord (~> 3.1.0)
|
activerecord (~> 3.1)
|
||||||
activesupport (~> 3.1.0)
|
activesupport (~> 3.1)
|
||||||
polyamorous (~> 0.5.0)
|
polyamorous (~> 0.5.0)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
@@ -17,120 +29,112 @@ GIT
|
|||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: http://github.com/EmmanuelOga/ffaker.git
|
remote: http://github.com/EmmanuelOga/ffaker.git
|
||||||
revision: f95ce5645d706d865990184ff83d40fe8ccc5e49
|
revision: 0a281092f4ed985b7f7ae6eb2d03677fbcfc722d
|
||||||
specs:
|
specs:
|
||||||
ffaker (1.10.1)
|
ffaker (1.12.1)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: http://gemcutter.org/
|
remote: http://gemcutter.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (3.1.3)
|
actionmailer (3.2.0)
|
||||||
actionpack (= 3.1.3)
|
actionpack (= 3.2.0)
|
||||||
mail (~> 2.3.0)
|
mail (~> 2.4.0)
|
||||||
actionpack (3.1.3)
|
actionpack (3.2.0)
|
||||||
activemodel (= 3.1.3)
|
activemodel (= 3.2.0)
|
||||||
activesupport (= 3.1.3)
|
activesupport (= 3.2.0)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
i18n (~> 0.6)
|
journey (~> 1.0.0)
|
||||||
rack (~> 1.3.5)
|
rack (~> 1.4.0)
|
||||||
rack-cache (~> 1.1)
|
rack-cache (~> 1.1)
|
||||||
rack-mount (~> 0.8.2)
|
|
||||||
rack-test (~> 0.6.1)
|
rack-test (~> 0.6.1)
|
||||||
sprockets (~> 2.0.3)
|
sprockets (~> 2.1.2)
|
||||||
activemodel (3.1.3)
|
activemodel (3.2.0)
|
||||||
activesupport (= 3.1.3)
|
activesupport (= 3.2.0)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
i18n (~> 0.6)
|
activerecord (3.2.0)
|
||||||
activerecord (3.1.3)
|
activemodel (= 3.2.0)
|
||||||
activemodel (= 3.1.3)
|
activesupport (= 3.2.0)
|
||||||
activesupport (= 3.1.3)
|
arel (~> 3.0.0)
|
||||||
arel (~> 2.2.1)
|
|
||||||
tzinfo (~> 0.3.29)
|
tzinfo (~> 0.3.29)
|
||||||
activeresource (3.1.3)
|
activeresource (3.2.0)
|
||||||
activemodel (= 3.1.3)
|
activemodel (= 3.2.0)
|
||||||
activesupport (= 3.1.3)
|
activesupport (= 3.2.0)
|
||||||
activesupport (3.1.3)
|
activesupport (3.2.0)
|
||||||
|
i18n (~> 0.6)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
arel (2.2.1)
|
arel (3.0.0)
|
||||||
awesome_print (0.4.0)
|
awesome_print (1.0.2)
|
||||||
builder (3.0.0)
|
builder (3.0.0)
|
||||||
chronic (0.6.6)
|
chronic (0.6.6)
|
||||||
coderay (0.9.8)
|
coderay (1.0.5)
|
||||||
daemons (1.1.4)
|
delayed_job (3.0.1)
|
||||||
delayed_job (2.1.4)
|
|
||||||
activesupport (~> 3.0)
|
activesupport (~> 3.0)
|
||||||
daemons
|
delayed_job_active_record (0.3.1)
|
||||||
|
activerecord (> 2.1.0)
|
||||||
|
delayed_job (~> 3.0.0)
|
||||||
|
domain_name (0.5.2)
|
||||||
|
unf (~> 0.0.3)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (1.2.9)
|
execjs (1.3.0)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
factory_girl (2.3.2)
|
factory_girl (2.5.0)
|
||||||
activesupport
|
activesupport
|
||||||
hike (1.2.1)
|
hike (1.2.1)
|
||||||
i18n (0.6.0)
|
i18n (0.6.0)
|
||||||
json (1.6.2)
|
journey (1.0.1)
|
||||||
|
json (1.6.5)
|
||||||
libv8 (3.3.10.4)
|
libv8 (3.3.10.4)
|
||||||
mail (2.3.0)
|
mail (2.4.1)
|
||||||
i18n (>= 0.4.0)
|
i18n (>= 0.4.0)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
mechanize (2.0.1)
|
|
||||||
net-http-digest_auth (~> 1.1, >= 1.1.1)
|
|
||||||
net-http-persistent (~> 1.8)
|
|
||||||
nokogiri (~> 1.4)
|
|
||||||
webrobots (~> 0.0, >= 0.0.9)
|
|
||||||
memcache-client (1.8.5)
|
memcache-client (1.8.5)
|
||||||
metaclass (0.0.1)
|
metaclass (0.0.1)
|
||||||
method_source (0.6.7)
|
method_source (0.7.0)
|
||||||
ruby_parser (>= 2.3.1)
|
|
||||||
mime-types (1.17.2)
|
mime-types (1.17.2)
|
||||||
mocha (0.10.0)
|
mocha (0.10.3)
|
||||||
metaclass (~> 0.0.1)
|
metaclass (~> 0.0.1)
|
||||||
multi_json (1.0.4)
|
multi_json (1.0.4)
|
||||||
net-http-digest_auth (1.2)
|
net-http-digest_auth (1.2)
|
||||||
net-http-persistent (1.9)
|
net-http-persistent (2.3.3)
|
||||||
nokogiri (1.5.0)
|
nokogiri (1.5.0)
|
||||||
pg (0.11.0)
|
ntlm-http (0.1.1)
|
||||||
|
pg (0.12.2)
|
||||||
polyamorous (0.5.0)
|
polyamorous (0.5.0)
|
||||||
activerecord (~> 3.0)
|
activerecord (~> 3.0)
|
||||||
polyglot (0.3.3)
|
polyglot (0.3.3)
|
||||||
pry (0.9.7.4)
|
pry (0.9.8)
|
||||||
coderay (~> 0.9.8)
|
coderay (~> 1.0.5)
|
||||||
method_source (~> 0.6.7)
|
method_source (~> 0.7)
|
||||||
ruby_parser (>= 2.3.1)
|
slop (>= 2.4.3, < 3)
|
||||||
slop (~> 2.1.0)
|
rack (1.4.1)
|
||||||
rack (1.3.5)
|
|
||||||
rack-cache (1.1)
|
rack-cache (1.1)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
rack-mount (0.8.3)
|
|
||||||
rack (>= 1.0.0)
|
|
||||||
rack-ssl (1.3.2)
|
rack-ssl (1.3.2)
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.1)
|
rack-test (0.6.1)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (3.1.3)
|
rails (3.2.0)
|
||||||
actionmailer (= 3.1.3)
|
actionmailer (= 3.2.0)
|
||||||
actionpack (= 3.1.3)
|
actionpack (= 3.2.0)
|
||||||
activerecord (= 3.1.3)
|
activerecord (= 3.2.0)
|
||||||
activeresource (= 3.1.3)
|
activeresource (= 3.2.0)
|
||||||
activesupport (= 3.1.3)
|
activesupport (= 3.2.0)
|
||||||
bundler (~> 1.0)
|
bundler (~> 1.0)
|
||||||
railties (= 3.1.3)
|
railties (= 3.2.0)
|
||||||
railties (3.1.3)
|
railties (3.2.0)
|
||||||
actionpack (= 3.1.3)
|
actionpack (= 3.2.0)
|
||||||
activesupport (= 3.1.3)
|
activesupport (= 3.2.0)
|
||||||
rack-ssl (~> 1.3.2)
|
rack-ssl (~> 1.3.2)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
rdoc (~> 3.4)
|
rdoc (~> 3.4)
|
||||||
thor (~> 0.14.6)
|
thor (~> 0.14.6)
|
||||||
rake (0.9.2.2)
|
rake (0.9.2.2)
|
||||||
rdoc (3.11)
|
rdoc (3.12)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
rmagick (2.13.1)
|
rmagick (2.13.1)
|
||||||
ruby_parser (2.3.1)
|
sass (3.1.12)
|
||||||
sexp_processor (~> 3.0)
|
|
||||||
sass (3.1.11)
|
|
||||||
sexp_processor (3.0.8)
|
|
||||||
shoulda (2.11.3)
|
shoulda (2.11.3)
|
||||||
silent-postgres (0.1.1)
|
silent-postgres (0.1.1)
|
||||||
simple_form (1.5.2)
|
simple_form (1.5.2)
|
||||||
@@ -140,8 +144,8 @@ GEM
|
|||||||
multi_json (~> 1.0.3)
|
multi_json (~> 1.0.3)
|
||||||
simplecov-html (~> 0.5.3)
|
simplecov-html (~> 0.5.3)
|
||||||
simplecov-html (0.5.3)
|
simplecov-html (0.5.3)
|
||||||
slop (2.1.0)
|
slop (2.4.3)
|
||||||
sprockets (2.0.3)
|
sprockets (2.1.2)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
@@ -156,12 +160,14 @@ GEM
|
|||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
tzinfo (0.3.31)
|
tzinfo (0.3.31)
|
||||||
uglifier (1.1.0)
|
uglifier (1.2.2)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
multi_json (>= 1.0.2)
|
multi_json (>= 1.0.2)
|
||||||
webrobots (0.0.12)
|
unf (0.0.4)
|
||||||
nokogiri (>= 1.4.4)
|
unf_ext
|
||||||
whenever (0.7.0)
|
unf_ext (0.0.4)
|
||||||
|
webrobots (0.0.13)
|
||||||
|
whenever (0.7.2)
|
||||||
activesupport (>= 2.3.4)
|
activesupport (>= 2.3.4)
|
||||||
chronic (~> 0.6.3)
|
chronic (~> 0.6.3)
|
||||||
|
|
||||||
@@ -171,16 +177,17 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
awesome_print
|
awesome_print
|
||||||
delayed_job
|
delayed_job
|
||||||
|
delayed_job_active_record
|
||||||
factory_girl
|
factory_girl
|
||||||
ffaker!
|
ffaker!
|
||||||
mechanize
|
mechanize!
|
||||||
memcache-client
|
memcache-client
|
||||||
meta_search!
|
meta_search!
|
||||||
mocha
|
mocha
|
||||||
nokogiri
|
nokogiri
|
||||||
pg
|
pg
|
||||||
pry
|
pry
|
||||||
rails (= 3.1.3)
|
rails (= 3.2.0)
|
||||||
rmagick
|
rmagick
|
||||||
sanitize!
|
sanitize!
|
||||||
sass
|
sass
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class Artist < ActiveRecord::Base
|
|||||||
has_one :wiki_page, :foreign_key => "title", :primary_key => "name"
|
has_one :wiki_page, :foreign_key => "title", :primary_key => "name"
|
||||||
has_one :tag_alias, :foreign_key => "antecedent_name", :primary_key => "name"
|
has_one :tag_alias, :foreign_key => "antecedent_name", :primary_key => "name"
|
||||||
accepts_nested_attributes_for :wiki_page
|
accepts_nested_attributes_for :wiki_page
|
||||||
attr_accessible :name, :url_string, :other_names, :group_name, :wiki_page_attributes, :notes, :is_active, :as => [:member, :privileged, :contributor, :janitor, :moderator, :default, :admin]
|
attr_accessible :body, :name, :url_string, :other_names, :group_name, :wiki_page_attributes, :notes, :is_active, :as => [:member, :privileged, :contributor, :janitor, :moderator, :default, :admin]
|
||||||
attr_accessible :is_banned, :as => :admin
|
attr_accessible :is_banned, :as => :admin
|
||||||
scope :url_match, lambda {|string| where(["id in (?)", Artist.find_all_by_url(string).map(&:id)])}
|
scope :url_match, lambda {|string| where(["id in (?)", Artist.find_all_by_url(string).map(&:id)])}
|
||||||
scope :other_names_match, lambda {|string| where(["other_names_index @@ to_tsquery('danbooru', ?)", Artist.normalize_name(string)])}
|
scope :other_names_match, lambda {|string| where(["other_names_index @@ to_tsquery('danbooru', ?)", Artist.normalize_name(string)])}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class UserFeedback < ActiveRecord::Base
|
class UserFeedback < ActiveRecord::Base
|
||||||
set_table_name "user_feedback"
|
self.table_name = "user_feedback"
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :creator, :class_name => "User"
|
belongs_to :creator, :class_name => "User"
|
||||||
before_validation :initialize_creator, :on => :create
|
before_validation :initialize_creator, :on => :create
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ require File.expand_path('../boot', __FILE__)
|
|||||||
|
|
||||||
require 'rails/all'
|
require 'rails/all'
|
||||||
|
|
||||||
# If you have a Gemfile, require the default gems, the ones in the
|
if defined?(Bundler)
|
||||||
# current environment and also include :assets gems if in development
|
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
||||||
# or test environments.
|
end
|
||||||
Bundler.require *Rails.groups(:assets) if defined?(Bundler)
|
|
||||||
|
|
||||||
module Danbooru
|
module Danbooru
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
@@ -13,6 +12,7 @@ module Danbooru
|
|||||||
config.encoding = "utf-8"
|
config.encoding = "utf-8"
|
||||||
config.filter_parameters += [:password]
|
config.filter_parameters += [:password]
|
||||||
config.assets.enabled = true
|
config.assets.enabled = true
|
||||||
|
config.assets.version = '1.0'
|
||||||
config.autoload_paths += %W(#{config.root}/app/presenters #{config.root}/app/logical #{config.root}/app/mailers)
|
config.autoload_paths += %W(#{config.root}/app/presenters #{config.root}/app/logical #{config.root}/app/mailers)
|
||||||
config.plugins = [:all]
|
config.plugins = [:all]
|
||||||
config.time_zone = 'Eastern Time (US & Canada)'
|
config.time_zone = 'Eastern Time (US & Canada)'
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
# Load the rails application
|
# Load the rails application
|
||||||
require File.expand_path('../application', __FILE__)
|
require File.expand_path('../application', __FILE__)
|
||||||
|
|
||||||
|
Encoding.default_external = Encoding::UTF_8
|
||||||
|
Encoding.default_internal = Encoding::UTF_8
|
||||||
|
|
||||||
# Initialize the rails application
|
# Initialize the rails application
|
||||||
Danbooru::Application.initialize!
|
Danbooru::Application.initialize!
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Danbooru::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
|
# In the development environment your application's code is reloaded on
|
||||||
# every request. This slows down response time but is perfect for development
|
# 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.
|
# since you don't have to restart the web server when you make code changes.
|
||||||
config.cache_classes = false
|
config.cache_classes = false
|
||||||
|
|
||||||
@@ -22,6 +22,16 @@ Danbooru::Application.configure do
|
|||||||
# Only use best-standards-support built into browsers
|
# Only use best-standards-support built into browsers
|
||||||
config.action_dispatch.best_standards_support = :builtin
|
config.action_dispatch.best_standards_support = :builtin
|
||||||
|
|
||||||
|
# Raise exception on mass assignment protection for Active Record models
|
||||||
|
config.active_record.mass_assignment_sanitizer = :strict
|
||||||
|
|
||||||
|
# Log the query plan for queries taking more than this (works
|
||||||
|
# with SQLite, MySQL, and PostgreSQL)
|
||||||
|
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
||||||
|
|
||||||
# Do not compress assets
|
# Do not compress assets
|
||||||
config.assets.compress = false
|
config.assets.compress = false
|
||||||
|
|
||||||
|
# Expands the lines which load the assets
|
||||||
|
config.assets.debug = true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,9 +14,18 @@ Danbooru::Application.configure do
|
|||||||
# Compress JavaScripts and CSS
|
# Compress JavaScripts and CSS
|
||||||
config.assets.compress = true
|
config.assets.compress = true
|
||||||
|
|
||||||
|
# Don't fallback to assets pipeline if a precompiled asset is missed
|
||||||
|
config.assets.compile = false
|
||||||
|
|
||||||
|
# Generate digests for assets URLs
|
||||||
|
config.assets.digest = true
|
||||||
|
|
||||||
|
# Defaults to Rails.root.join("public/assets")
|
||||||
|
# config.assets.manifest = YOUR_PATH
|
||||||
|
|
||||||
# Specifies the header that your server uses for sending files
|
# Specifies the header that your server uses for sending files
|
||||||
# (comment out if your front-end server doesn't support this)
|
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
||||||
config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx
|
# 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.
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
# config.force_ssl = true
|
# config.force_ssl = true
|
||||||
@@ -24,8 +33,11 @@ Danbooru::Application.configure do
|
|||||||
# See everything in the log (default is :info)
|
# See everything in the log (default is :info)
|
||||||
# config.log_level = :debug
|
# config.log_level = :debug
|
||||||
|
|
||||||
|
# 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 = SyslogLogger.new
|
# 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
|
# config.cache_store = :mem_cache_store
|
||||||
@@ -48,4 +60,8 @@ Danbooru::Application.configure do
|
|||||||
|
|
||||||
# Send deprecation notices to registered listeners
|
# Send deprecation notices to registered listeners
|
||||||
config.active_support.deprecation = :notify
|
config.active_support.deprecation = :notify
|
||||||
|
|
||||||
|
# Log the query plan for queries taking more than this (works
|
||||||
|
# with SQLite, MySQL, and PostgreSQL)
|
||||||
|
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ Danbooru::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
|
# The test environment is used exclusively to run your application's
|
||||||
# test suite. You never need to work with it otherwise. Remember that
|
# 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
|
# 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!
|
# and recreated between test runs. Don't rely on the data there!
|
||||||
config.cache_classes = true
|
config.cache_classes = true
|
||||||
|
|
||||||
# Configure static asset server for tests with Cache-Control for performance
|
# Configure static asset server for tests with Cache-Control for performance
|
||||||
@@ -29,10 +29,8 @@ Danbooru::Application.configure do
|
|||||||
# ActionMailer::Base.deliveries array.
|
# ActionMailer::Base.deliveries array.
|
||||||
config.action_mailer.delivery_method = :test
|
config.action_mailer.delivery_method = :test
|
||||||
|
|
||||||
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
# Raise exception on mass assignment protection for Active Record models
|
||||||
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
config.active_record.mass_assignment_sanitizer = :strict
|
||||||
# like if you have constraints or database-specific column types
|
|
||||||
# config.active_record.schema_format = :sql
|
|
||||||
|
|
||||||
# Print deprecation notices to the stderr
|
# Print deprecation notices to the stderr
|
||||||
config.active_support.deprecation = :stderr
|
config.active_support.deprecation = :stderr
|
||||||
|
|||||||
@@ -8,3 +8,8 @@
|
|||||||
# inflect.irregular 'person', 'people'
|
# inflect.irregular 'person', 'people'
|
||||||
# inflect.uncountable %w( fish sheep )
|
# inflect.uncountable %w( fish sheep )
|
||||||
# end
|
# end
|
||||||
|
#
|
||||||
|
# These inflection rules are supported but not enabled by default:
|
||||||
|
# ActiveSupport::Inflector.inflections do |inflect|
|
||||||
|
# inflect.acronym 'RESTful'
|
||||||
|
# end
|
||||||
|
|||||||
@@ -4,9 +4,11 @@
|
|||||||
# is enabled by default.
|
# is enabled by default.
|
||||||
|
|
||||||
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||||
ActionController::Base.wrap_parameters :format => [:json]
|
ActiveSupport.on_load(:action_controller) do
|
||||||
|
wrap_parameters format: [:json]
|
||||||
|
end
|
||||||
|
|
||||||
# Disable root element in JSON by default.
|
# Disable root element in JSON by default.
|
||||||
if defined?(ActiveRecord)
|
ActiveSupport.on_load(:active_record) do
|
||||||
ActiveRecord::Base.include_root_in_json = false
|
self.include_root_in_json = false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
Factory.define(:artist) do |f|
|
Factory.define(:artist) do |f|
|
||||||
f.name {rand(1_000_000).to_s}
|
f.name {rand(1_000_000).to_s}
|
||||||
f.creator {|x| x.association(:user)}
|
|
||||||
f.is_active true
|
f.is_active true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
Factory.define(:comment) do |f|
|
Factory.define(:comment) do |f|
|
||||||
f.post {|x| x.association(:post)}
|
f.post {|x| x.association(:post)}
|
||||||
f.body {Faker::Lorem.sentences.join(" ")}
|
f.body {Faker::Lorem.sentences.join(" ")}
|
||||||
f.score 0
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,5 +2,4 @@ Factory.define(:dmail) do |f|
|
|||||||
f.to {|x| x.association(:user)}
|
f.to {|x| x.association(:user)}
|
||||||
f.title {Faker::Lorem.words.join(" ")}
|
f.title {Faker::Lorem.words.join(" ")}
|
||||||
f.body {Faker::Lorem.sentences.join(" ")}
|
f.body {Faker::Lorem.sentences.join(" ")}
|
||||||
f.is_read false
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class DmailsControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
should "create two messages, one for the sender and one for the recipient" do
|
should "create two messages, one for the sender and one for the recipient" do
|
||||||
assert_difference("Dmail.count", 2) do
|
assert_difference("Dmail.count", 2) do
|
||||||
dmail_attribs = {:to_id => @user_2.id, :title => "abc", :body => "abc", :is_read => false}
|
dmail_attribs = {:to_id => @user_2.id, :title => "abc", :body => "abc"}
|
||||||
post :create, {:dmail => dmail_attribs}, {:user_id => @user.id}
|
post :create, {:dmail => dmail_attribs}, {:user_id => @user.id}
|
||||||
assert_redirected_to dmail_path(Dmail.last)
|
assert_redirected_to dmail_path(Dmail.last)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -117,12 +117,14 @@ class ArtistTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
should "have an associated wiki" do
|
should "have an associated wiki" do
|
||||||
user = Factory.create(:user)
|
user = Factory.create(:user)
|
||||||
|
CurrentUser.user = user
|
||||||
artist = Factory.create(:artist, :name => "max", :wiki_page_attributes => {:title => "xxx", :body => "this is max"})
|
artist = Factory.create(:artist, :name => "max", :wiki_page_attributes => {:title => "xxx", :body => "this is max"})
|
||||||
assert_not_nil(artist.wiki_page)
|
assert_not_nil(artist.wiki_page)
|
||||||
assert_equal("this is max", artist.wiki_page.body)
|
assert_equal("this is max", artist.wiki_page.body)
|
||||||
|
|
||||||
artist.update_attributes(:wiki_page_attributes => {:id => artist.wiki_page.id, :body => "this is hoge mark ii", :creator_id => user.id})
|
artist.update_attributes({:wiki_page_attributes => {:id => artist.wiki_page.id, :body => "this is hoge mark ii"}})
|
||||||
assert_equal("this is hoge mark ii", artist.wiki_page(true).body)
|
assert_equal("this is hoge mark ii", artist.wiki_page(true).body)
|
||||||
|
CurrentUser.user = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
should "revert to prior versions" do
|
should "revert to prior versions" do
|
||||||
|
|||||||
Reference in New Issue
Block a user