aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/application_controller.rb2
-rw-r--r--app/models/raw_email.rb2
-rw-r--r--config/environment.rb2
-rw-r--r--config/initializers/session_store.rb2
-rw-r--r--lib/tasks/rspec.rake18
-rwxr-xr-xpublic/dispatch.fcgi2
-rwxr-xr-xscript/handle-mail-replies2
-rwxr-xr-xscript/spec_server4
-rw-r--r--spec/controllers/request_controller_spec.rb2
-rw-r--r--spec/script/handle-mail-replies_spec.rb2
-rw-r--r--spec/spec_helper.rb2
11 files changed, 20 insertions, 20 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 0508abe76..0ec8e206e 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -178,7 +178,7 @@ class ApplicationController < ActionController::Base
end
def foi_fragment_cache_path(param)
- path = File.join(RAILS_ROOT, 'cache', 'views', foi_fragment_cache_part_path(param))
+ path = File.join(Rails.root, 'cache', 'views', foi_fragment_cache_part_path(param))
max_file_length = 255 - 35 # we subtract 35 because tempfile
# adds on a variable number of
# characters
diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb
index 3e12a6feb..1feb9c70b 100644
--- a/app/models/raw_email.rb
+++ b/app/models/raw_email.rb
@@ -27,7 +27,7 @@ class RawEmail < ActiveRecord::Base
def directory
request_id = self.incoming_message.info_request.id.to_s
if ENV["RAILS_ENV"] == "test"
- return File.join(RAILS_ROOT, 'files/raw_email_test')
+ return File.join(Rails.root, 'files/raw_email_test')
else
return File.join(MySociety::Config.get('RAW_EMAILS_LOCATION',
'files/raw_emails'),
diff --git a/config/environment.rb b/config/environment.rb
index 7b6e8f5bc..e35194bc7 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -49,7 +49,7 @@ Rails::Initializer.run do |config|
# config.plugins = %W( exception_notification ssl_requirement )
# Add additional load paths for your own custom dirs
- # config.load_paths += %W( #{RAILS_ROOT}/extras )
+ # config.load_paths += %W( #{Rails.root}/extras )
# Force all environments to use the same logger level
# (by default production uses :info, the others :debug)
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 9ef2dddc1..bf40e99c1 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -12,6 +12,6 @@ ActionController::Base.session = {
ActionController::Base.session_store = :cookie_store
# Insert a bit of middleware code to prevent uneeded cookie setting.
-require "#{RAILS_ROOT}/lib/whatdotheyknow/strip_empty_sessions"
+require "#{Rails.root}/lib/whatdotheyknow/strip_empty_sessions"
ActionController::Dispatcher.middleware.insert_before ActionController::Base.session_store, WhatDoTheyKnow::StripEmptySessions, :key => '_wdtk_cookie_session', :path => "/", :httponly => true
diff --git a/lib/tasks/rspec.rake b/lib/tasks/rspec.rake
index c54d981e2..1eee74aee 100644
--- a/lib/tasks/rspec.rake
+++ b/lib/tasks/rspec.rake
@@ -1,6 +1,6 @@
rspec_gem_dir = nil
-Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
- rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
+Dir["#{Rails.root}/vendor/gems/*"].each do |subdir|
+ rspec_gem_dir = subdir if subdir.gsub("#{Rails.root}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
end
rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
@@ -46,7 +46,7 @@ end
Rake.application.instance_variable_get('@tasks').delete('default')
-spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
+spec_prereq = File.exist?(File.join(Rails.root, 'config', 'database.yml')) ? "db:test:prepare" : :noop
task :noop do
end
@@ -59,18 +59,18 @@ task :cruise => ['spec']
desc "Run all specs in spec directory (excluding plugin specs)"
Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
- t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_opts = ['--options', "\"#{Rails.root}/spec/spec.opts\""]
t.spec_files = FileList['spec/**/*_spec.rb']
end
namespace :spec do
desc "Run all specs in spec directory with RCov (excluding plugin specs)"
Spec::Rake::SpecTask.new(:rcov) do |t|
- t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_opts = ['--options', "\"#{Rails.root}/spec/spec.opts\""]
t.spec_files = FileList['spec/**/*_spec.rb']
t.rcov = true
t.rcov_opts = lambda do
- IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
+ IO.readlines("#{Rails.root}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
end
end
@@ -89,21 +89,21 @@ namespace :spec do
[:models, :controllers, :views, :helpers, :lib, :integration].each do |sub|
desc "Run the code examples in spec/#{sub}"
Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
- t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_opts = ['--options', "\"#{Rails.root}/spec/spec.opts\""]
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
end
end
desc "Run the code examples in vendor/plugins (except RSpec's own)"
Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
- t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_opts = ['--options', "\"#{Rails.root}/spec/spec.opts\""]
t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
end
namespace :plugins do
desc "Runs the examples for rspec_on_rails"
Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
- t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_opts = ['--options', "\"#{Rails.root}/spec/spec.opts\""]
t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb']
end
end
diff --git a/public/dispatch.fcgi b/public/dispatch.fcgi
index 3169ba267..ad34d90e4 100755
--- a/public/dispatch.fcgi
+++ b/public/dispatch.fcgi
@@ -4,7 +4,7 @@
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
-# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
+# By default, the FastCGI crash log is Rails.root/log/fastcgi.crash.log
# and the GC period is nil (turned off). A reasonable number of requests
# could range from 10-100 depending on the memory footprint of your app.
#
diff --git a/script/handle-mail-replies b/script/handle-mail-replies
index d6717bc58..cc7595bed 100755
--- a/script/handle-mail-replies
+++ b/script/handle-mail-replies
@@ -145,7 +145,7 @@ end
def load_rails
require File.join('config', 'boot')
- require RAILS_ROOT + '/config/environment'
+ require Rails.root + '/config/environment'
end
def record_bounce(email_address, bounce_message)
diff --git a/script/spec_server b/script/spec_server
index 1e839355f..dfdf8ff6c 100755
--- a/script/spec_server
+++ b/script/spec_server
@@ -41,7 +41,7 @@ module Spec
load File.dirname(__FILE__) + '/../spec/spec_helper.rb'
if in_memory_database?
- load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default
+ load "#{Rails.root}/db/schema.rb" # use db agnostic schema by default
ActiveRecord::Migrator.up('db/migrate') # use migrations
end
@@ -80,7 +80,7 @@ def daemonize(pid_file = nil)
return yield if $DEBUG
pid = Process.fork{
Process.setsid
- Dir.chdir(RAILS_ROOT)
+ Dir.chdir(Rails.root)
trap("SIGINT"){ exit! 0 }
trap("SIGTERM"){ exit! 0 }
trap("SIGHUP"){ restart_test_server }
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index f50158ff9..850ee6334 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -565,7 +565,7 @@ end
# XXX do this for invalid ids
# it "should render 404 file" do
-# response.should render_template("#{RAILS_ROOT}/public/404.html")
+# response.should render_template("#{Rails.root}/public/404.html")
# response.headers["Status"].should == "404 Not Found"
# end
diff --git a/spec/script/handle-mail-replies_spec.rb b/spec/script/handle-mail-replies_spec.rb
index 8ed83b31f..ad58ea565 100644
--- a/spec/script/handle-mail-replies_spec.rb
+++ b/spec/script/handle-mail-replies_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require "external_command"
def mail_reply_test(email_filename)
- Dir.chdir RAILS_ROOT do
+ Dir.chdir Rails.root do
xc = ExternalCommand.new("script/handle-mail-replies", "--test")
xc.run(load_file_fixture(email_filename))
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index c00da48bc..99cf8a2c8 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -43,7 +43,7 @@ Spec::Runner.configure do |config|
#
# You can also declare which fixtures to use (for example fixtures for test/fixtures):
#
- # config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
+ # config.fixture_path = Rails.root + '/spec/fixtures/'
#
# == Mock Framework
#