aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-11-24 12:46:48 +0000
committerSeb Bacon <seb.bacon@gmail.com>2011-11-24 12:46:48 +0000
commit76168e23fd78d276a197cc992bb6ef5a065f6f3f (patch)
treef15093086b2ff767968e6bbd1b816c66f35bd5dd
parentfb2b20037bb176533de4e7fa86701248473f8ee3 (diff)
parent589d9b8c1e14bb7086a6b7baf0fa7e3b9aaeabf0 (diff)
Merge branch 'develop' into xapian-dcabo
Conflicts: spec/models/xapian_spec.rb
-rw-r--r--app/models/incoming_message.rb18
-rw-r--r--app/models/public_body.rb10
-rw-r--r--config/environment.rb1
-rw-r--r--config/initializers/fast_gettext.rb2
-rw-r--r--config/routes.rb2
-rw-r--r--lib/languages.rb1
-rw-r--r--lib/ruby19.rb8
-rw-r--r--lib/sendmail_return_path.rb2
-rw-r--r--lib/tasks/rspec.rake3
-rw-r--r--lib/tnef.rb2
-rwxr-xr-xscript/about2
-rwxr-xr-xscript/breakpointer2
-rwxr-xr-xscript/console2
-rwxr-xr-xscript/destroy2
-rwxr-xr-xscript/generate2
-rwxr-xr-xscript/handle-mail-replies12
-rwxr-xr-xscript/performance/benchmarker2
-rwxr-xr-xscript/performance/profiler2
-rwxr-xr-xscript/plugin2
-rwxr-xr-xscript/process/inspector2
-rwxr-xr-xscript/process/reaper2
-rwxr-xr-xscript/process/spawner2
-rwxr-xr-xscript/runner2
-rwxr-xr-xscript/server2
-rwxr-xr-xscript/wraptest2
-rw-r--r--spec/controllers/admin_public_body_controller_spec.rb8
-rw-r--r--spec/controllers/admin_request_controller_spec.rb4
-rw-r--r--spec/controllers/admin_track_controller_spec.rb2
-rw-r--r--spec/controllers/admin_user_controller_spec.rb2
-rw-r--r--spec/controllers/comment_controller_spec.rb2
-rw-r--r--spec/controllers/general_controller_spec.rb26
-rw-r--r--spec/controllers/public_body_controller_spec.rb8
-rw-r--r--spec/controllers/request_controller_spec.rb48
-rw-r--r--spec/controllers/request_game_controller_spec.rb2
-rw-r--r--spec/controllers/track_controller_spec.rb8
-rw-r--r--spec/controllers/user_controller_spec.rb7
-rw-r--r--spec/integration/errors_spec.rb22
-rw-r--r--spec/integration/search_request_spec.rb22
-rw-r--r--spec/lib/tmail_extensions_spec.rb1
-rw-r--r--spec/lib/whatdotheyknow/strip_empty_sessions_spec.rb2
-rw-r--r--spec/models/has_tag_string_tag_spec.rb2
-rw-r--r--spec/models/incoming_message_spec.rb9
-rw-r--r--spec/models/info_request_spec.rb14
-rw-r--r--spec/models/outgoing_mailer_spec.rb4
-rw-r--r--spec/models/outgoing_message_spec.rb4
-rw-r--r--spec/models/public_body_spec.rb28
-rw-r--r--spec/models/request_mailer_spec.rb2
-rw-r--r--spec/models/track_thing_spec.rb2
-rw-r--r--spec/models/user_spec.rb14
-rw-r--r--spec/models/xapian_spec.rb16
-rw-r--r--spec/spec_helper.rb17
-rw-r--r--spec/views/public_body/show.rhtml_spec.rb2
-rw-r--r--spec/views/request/_after_actions.rhtml_spec.rb2
-rw-r--r--spec/views/request/_describe_state.rhtml_spec.rb2
-rw-r--r--spec/views/request/list.rhtml_spec.rb2
-rw-r--r--spec/views/request/show.rhtml_spec.rb2
-rw-r--r--spec/views/request_game/play.rhtml_spec.rb2
-rw-r--r--vendor/plugins/has_tag_string/lib/has_tag_string.rb2
m---------vendor/rails-locales0
59 files changed, 196 insertions, 183 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 97e4a6c09..0608d46d7 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -267,7 +267,7 @@ class FOIAttachment
tempfile.flush
if self.content_type == 'application/pdf'
- IO.popen("/usr/bin/pdftohtml -nodrm -zoom 1.0 -stdout -enc UTF-8 -noframes " + tempfile.path + "", "r") do |child|
+ IO.popen("#{`which pdftohtml`.chomp} -nodrm -zoom 1.0 -stdout -enc UTF-8 -noframes " + tempfile.path + "", "r") do |child|
html = child.read()
end
elsif self.content_type == 'application/rtf'
@@ -447,7 +447,7 @@ class IncomingMessage < ActiveRecord::Base
# Special cases for some content types
if content_type == 'application/pdf'
uncompressed_text = nil
- IO.popen("/usr/bin/pdftk - output - uncompress", "r+") do |child|
+ IO.popen("#{`which pdftk`.chomp} - output - uncompress", "r+") do |child|
child.write(text)
child.close_write()
uncompressed_text = child.read()
@@ -464,7 +464,7 @@ class IncomingMessage < ActiveRecord::Base
if MySociety::Config.get('USE_GHOSTSCRIPT_COMPRESSION') == true
command = "gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=- -"
else
- command = "/usr/bin/pdftk - output - compress"
+ command = "#{`which pdftk`.chomp} - output - compress"
end
IO.popen(command, "r+") do |child|
child.write(censored_uncompressed_text)
@@ -1112,21 +1112,21 @@ class IncomingMessage < ActiveRecord::Base
tempfile.print body
tempfile.flush
if content_type == 'application/vnd.ms-word'
- AlaveteliExternalCommand.run("/usr/bin/wvText", tempfile.path, tempfile.path + ".txt")
+ AlaveteliExternalCommand.run(`which wvText`.chomp, tempfile.path, tempfile.path + ".txt")
# Try catdoc if we get into trouble (e.g. for InfoRequestEvent 2701)
if not File.exists?(tempfile.path + ".txt")
- AlaveteliExternalCommand.run("/usr/bin/catdoc", tempfile.path, :append_to => text)
+ AlaveteliExternalCommand.run(`which catdoc`.chomp, tempfile.path, :append_to => text)
else
text += File.read(tempfile.path + ".txt") + "\n\n"
File.unlink(tempfile.path + ".txt")
end
elsif content_type == 'application/rtf'
# catdoc on RTF prodcues less comments and extra bumf than --text option to unrtf
- AlaveteliExternalCommand.run("/usr/bin/catdoc", tempfile.path, :append_to => text)
+ AlaveteliExternalCommand.run(`which catdoc`.chomp, tempfile.path, :append_to => text)
elsif content_type == 'text/html'
# lynx wordwraps links in its output, which then don't get formatted properly
# by Alaveteli. We use elinks instead, which doesn't do that.
- AlaveteliExternalCommand.run("/usr/bin/elinks", "-eval", "'set document.codepage.assume = \"utf-8\"'", "-dump-charset", "utf-8", "-force-html", "-dump",
+ AlaveteliExternalCommand.run(`which elinks`.chomp, "-eval", "'set document.codepage.assume = \"utf-8\"'", "-dump-charset", "utf-8", "-force-html", "-dump",
tempfile.path, :append_to => text)
elsif content_type == 'application/vnd.ms-excel'
# Bit crazy using /usr/bin/strings - but xls2csv, xlhtml and
@@ -1137,9 +1137,9 @@ class IncomingMessage < ActiveRecord::Base
elsif content_type == 'application/vnd.ms-powerpoint'
# ppthtml seems to catch more text, but only outputs HTML when
# we want text, so just use catppt for now
- AlaveteliExternalCommand.run("/usr/bin/catppt", tempfile.path, :append_to => text)
+ AlaveteliExternalCommand.run(`which catppt`.chomp, tempfile.path, :append_to => text)
elsif content_type == 'application/pdf'
- AlaveteliExternalCommand.run("/usr/bin/pdftotext", tempfile.path, "-", :append_to => text)
+ AlaveteliExternalCommand.run(`which pdftotext`.chomp, tempfile.path, "-", :append_to => text)
elsif content_type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
# This is Microsoft's XML office document format.
# Just pull out the main XML file, and strip it of text.
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index ab836657b..36ea29dd5 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -360,11 +360,11 @@ class PublicBody < ActiveRecord::Base
set_of_importing = Set.new()
field_names = { 'name'=>1, 'request_email'=>2 } # Default values in case no field list is given
line = 0
- CSV::Reader.parse(csv) do |row|
+ CSV.parse(csv) do |row|
line = line + 1
# Parse the first line as a field list if it starts with '#'
- if line==1 and row.to_s =~ /^#(.*)$/
+ if line==1 and row.first.to_s =~ /^#(.*)$/
row[0] = row[0][1..-1] # Remove the # sign on first field
row.each_with_index {|field, i| field_names[field] = i}
next
@@ -390,7 +390,7 @@ class PublicBody < ActiveRecord::Base
if public_body = bodies_by_name[name] # Existing public body
available_locales.each do |locale|
PublicBody.with_locale(locale) do
- changed = {}
+ changed = ActiveSupport::OrderedHash.new
field_list.each do |field_name|
localized_field_name = (locale.to_s == I18n.default_locale.to_s) ? field_name : "#{field_name}.#{locale}"
localized_value = field_names[localized_field_name] && row[field_names[localized_field_name]]
@@ -425,7 +425,7 @@ class PublicBody < ActiveRecord::Base
public_body = PublicBody.new(:name=>"", :short_name=>"", :request_email=>"")
available_locales.each do |locale|
PublicBody.with_locale(locale) do
- changed = {}
+ changed = ActiveSupport::OrderedHash.new
field_list.each do |field_name|
localized_field_name = (locale.to_s == I18n.default_locale.to_s) ? field_name : "#{field_name}.#{locale}"
localized_value = field_names[localized_field_name] && row[field_names[localized_field_name]]
@@ -457,7 +457,7 @@ class PublicBody < ActiveRecord::Base
# Give an error listing ones that are to be deleted
deleted_ones = set_of_existing - set_of_importing
if deleted_ones.size > 0
- notes.push "Notes: Some " + tag + " bodies are in database, but not in CSV file:\n " + Array(deleted_ones).join("\n ") + "\nYou may want to delete them manually.\n"
+ notes.push "Notes: Some " + tag + " bodies are in database, but not in CSV file:\n " + Array(deleted_ones).sort.join("\n ") + "\nYou may want to delete them manually.\n"
end
# Rollback if a dry run, or we had errors
diff --git a/config/environment.rb b/config/environment.rb
index 91839c043..7c0662d3a 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -134,6 +134,7 @@ I18n.available_locales = available_locales.map {|locale_name| locale_name.to_sym
I18n.default_locale = default_locale
# Load monkey patches and other things from lib/
+require 'ruby19.rb'
require 'tmail_extensions.rb'
require 'activesupport_cache_extensions.rb'
require 'timezone_fixes.rb'
diff --git a/config/initializers/fast_gettext.rb b/config/initializers/fast_gettext.rb
index 026c4111c..63cf6b50d 100644
--- a/config/initializers/fast_gettext.rb
+++ b/config/initializers/fast_gettext.rb
@@ -1,2 +1,2 @@
-FastGettext.add_text_domain 'app', :path => 'locale', :type => :po
+FastGettext.add_text_domain 'app', :path => File.join(Rails.root, 'locale'), :type => :po
FastGettext.default_text_domain = 'app'
diff --git a/config/routes.rb b/config/routes.rb
index 48bf92e75..511b5fc1e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -15,7 +15,7 @@ ActionController::Routing::Routes.draw do |map|
# Keep in mind you can assign values other than :controller and :action
# Allow easy extension from themes. Note these will have the highest priority.
- require 'config/custom-routes'
+ require File.join(Rails.root, 'config', 'custom-routes')
map.with_options :controller => 'general' do |general|
general.frontpage '/', :action => 'frontpage'
diff --git a/lib/languages.rb b/lib/languages.rb
index 43212a777..474c0e0cb 100644
--- a/lib/languages.rb
+++ b/lib/languages.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
class LanguageNames
def self.get_language_name(locale)
language_names = {
diff --git a/lib/ruby19.rb b/lib/ruby19.rb
new file mode 100644
index 000000000..39f48d74e
--- /dev/null
+++ b/lib/ruby19.rb
@@ -0,0 +1,8 @@
+if RUBY_VERSION.to_f == 1.9
+ class String
+ # @see syck/lib/syck/rubytypes.rb
+ def is_binary_data?
+ self.count("\x00-\x7F", "^ -~\t\r\n").fdiv(self.size) > 0.3 || self.index("\x00") unless self.empty?
+ end
+ end
+end \ No newline at end of file
diff --git a/lib/sendmail_return_path.rb b/lib/sendmail_return_path.rb
index d8922f78b..23c4d4376 100644
--- a/lib/sendmail_return_path.rb
+++ b/lib/sendmail_return_path.rb
@@ -6,7 +6,7 @@
module ActionMailer
class Base
def perform_delivery_sendmail(mail)
- sender = (mail['return-path'] && mail['return-path'].spec) || mail.from
+ sender = (mail['return-path'] && mail['return-path'].spec) || mail.from.first
sendmail_args = sendmail_settings[:arguments].dup
sendmail_args += " -f \"#{sender}\""
diff --git a/lib/tasks/rspec.rake b/lib/tasks/rspec.rake
index 588c26378..4024a6a6d 100644
--- a/lib/tasks/rspec.rake
+++ b/lib/tasks/rspec.rake
@@ -53,7 +53,8 @@ end
task :default => :spec
task :stats => "spec:statsetup"
-task :spec => ['spec:commonlib']
+# XXX commonlib tests are not Ruby 1.9 compatible
+#task :spec => ['spec:commonlib']
task :test => ['spec']
task :cruise => ['spec']
diff --git a/lib/tnef.rb b/lib/tnef.rb
index ff88b0005..1c941f8b0 100644
--- a/lib/tnef.rb
+++ b/lib/tnef.rb
@@ -9,7 +9,7 @@ class TNEF
main = TMail::Mail.new
main.set_content_type 'multipart', 'mixed', { 'boundary' => TMail.new_boundary }
Dir.mktmpdir do |dir|
- IO.popen("/usr/bin/tnef -K -C #{dir}", "w") do |f|
+ IO.popen("#{`which tnef`.chomp} -K -C #{dir}", "w") do |f|
f.write(content)
f.close
if $?.signaled?
diff --git a/script/about b/script/about
index 746e44659..f2b98742d 100755
--- a/script/about
+++ b/script/about
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot.rb'
require 'commands/about'
diff --git a/script/breakpointer b/script/breakpointer
index dfe58bf36..609564148 100755
--- a/script/breakpointer
+++ b/script/breakpointer
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot.rb'
require 'commands/breakpointer'
diff --git a/script/console b/script/console
index 98f6702bb..83386647f 100755
--- a/script/console
+++ b/script/console
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
require 'commands/console'
diff --git a/script/destroy b/script/destroy
index 937962908..e63ac0ef5 100755
--- a/script/destroy
+++ b/script/destroy
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot.rb'
require 'commands/destroy'
diff --git a/script/generate b/script/generate
index a765ddcd4..8c0486a09 100755
--- a/script/generate
+++ b/script/generate
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot.rb'
require 'commands/generate'
diff --git a/script/handle-mail-replies b/script/handle-mail-replies
index 9b1fb5b29..9451bc9f2 100755
--- a/script/handle-mail-replies
+++ b/script/handle-mail-replies
@@ -1,4 +1,5 @@
-#!/usr/bin/ruby
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
# Handle email responses sent to us.
#
@@ -17,8 +18,13 @@ load "config.rb"
MySociety::Config.set_file(File.join($alaveteli_dir, 'config', 'general'), true)
MySociety::Config.load_default
-$:.push(File.join($alaveteli_dir, "vendor", "rails", "actionmailer", "lib", "action_mailer", "vendor", "tmail-1.2.7"))
-require 'tmail'
+require 'rubygems'
+if File.exist? File.join($alaveteli_dir,'vendor','rails','Rakefile')
+ $:.push(File.join($alaveteli_dir, "vendor", "rails", "actionmailer", "lib", "action_mailer", "vendor", "tmail-1.2.7"))
+ require 'tmail'
+else
+ require 'action_mailer'
+end
def main(in_test_mode)
Dir.chdir($alaveteli_dir) do
diff --git a/script/performance/benchmarker b/script/performance/benchmarker
index c2441c941..a94253aba 100755
--- a/script/performance/benchmarker
+++ b/script/performance/benchmarker
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot.rb'
require 'commands/performance/benchmarker'
diff --git a/script/performance/profiler b/script/performance/profiler
index a7ea37a9a..e9e5b071d 100755
--- a/script/performance/profiler
+++ b/script/performance/profiler
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot.rb'
require 'commands/performance/profiler'
diff --git a/script/plugin b/script/plugin
index bcc697802..18ae72620 100755
--- a/script/plugin
+++ b/script/plugin
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot.rb'
require 'commands/plugin'
diff --git a/script/process/inspector b/script/process/inspector
index 261317109..696551c6b 100755
--- a/script/process/inspector
+++ b/script/process/inspector
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot.rb'
require 'commands/process/inspector'
diff --git a/script/process/reaper b/script/process/reaper
index 309764a0d..a03da9387 100755
--- a/script/process/reaper
+++ b/script/process/reaper
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot.rb'
require 'commands/process/reaper'
diff --git a/script/process/spawner b/script/process/spawner
index 2768db7fd..6852fba27 100755
--- a/script/process/spawner
+++ b/script/process/spawner
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot.rb'
require 'commands/process/spawner'
diff --git a/script/runner b/script/runner
index 5a5254c47..6b0bc0a08 100755
--- a/script/runner
+++ b/script/runner
@@ -1,4 +1,4 @@
-#!/usr/bin/ruby
+#!/usr/bin/env ruby
daemon_mode = !ARGV.empty? && ARGV[0] == "--daemon"
diff --git a/script/server b/script/server
index 9c6088a88..dc3edabd5 100755
--- a/script/server
+++ b/script/server
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
require 'commands/server'
diff --git a/script/wraptest b/script/wraptest
index d62e4ce48..780c9b4a2 100755
--- a/script/wraptest
+++ b/script/wraptest
@@ -1,4 +1,4 @@
-#!/usr/bin/ruby
+#!/usr/bin/env ruby
#
# wraptest:
# Test email wrapping function
diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb
index 0a90cd64b..22af3df80 100644
--- a/spec/controllers/admin_public_body_controller_spec.rb
+++ b/spec/controllers/admin_public_body_controller_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe AdminPublicBodyController, "when administering public bodies" do
integrate_views
- fixtures :public_bodies, :public_body_translations
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
username = MySociety::Config.get('ADMIN_USERNAME', '')
@@ -57,7 +57,7 @@ end
describe AdminPublicBodyController, "when administering public bodies and paying attention to authentication" do
integrate_views
- fixtures :public_bodies, :public_body_translations
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "disallows non-authenticated users to do anything" do
@request.env["HTTP_AUTHORIZATION"] = ""
@@ -107,7 +107,7 @@ end
describe AdminPublicBodyController, "when administering public bodies with i18n" do
integrate_views
- fixtures :public_bodies, :public_body_translations
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
username = MySociety::Config.get('ADMIN_USERNAME', '')
@@ -176,7 +176,7 @@ end
describe AdminPublicBodyController, "when creating public bodies with i18n" do
integrate_views
- fixtures :public_bodies, :public_body_translations
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
username = MySociety::Config.get('ADMIN_USERNAME', '')
diff --git a/spec/controllers/admin_request_controller_spec.rb b/spec/controllers/admin_request_controller_spec.rb
index 441b1b91d..635d73b9e 100644
--- a/spec/controllers/admin_request_controller_spec.rb
+++ b/spec/controllers/admin_request_controller_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe AdminRequestController, "when administering requests" do
integrate_views
- fixtures :users, :public_bodies, :public_body_translations, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events
+ fixtures :users, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before { basic_auth_login @request }
it "shows the index/list page" do
@@ -41,7 +41,7 @@ end
describe AdminRequestController, "when administering the holding pen" do
integrate_views
- fixtures :users, :public_bodies, :public_body_translations, :info_requests, :raw_emails, :incoming_messages
+ fixtures :users, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
basic_auth_login @request
load_raw_emails_data(raw_emails)
diff --git a/spec/controllers/admin_track_controller_spec.rb b/spec/controllers/admin_track_controller_spec.rb
index 3db242f73..b87ee9f0e 100644
--- a/spec/controllers/admin_track_controller_spec.rb
+++ b/spec/controllers/admin_track_controller_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe AdminTrackController, "when administering tracks" do
integrate_views
- fixtures :users, :track_things
+ fixtures :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "shows the list page" do
get :list
diff --git a/spec/controllers/admin_user_controller_spec.rb b/spec/controllers/admin_user_controller_spec.rb
index 313f3f328..b2b2d0626 100644
--- a/spec/controllers/admin_user_controller_spec.rb
+++ b/spec/controllers/admin_user_controller_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe AdminUserController, "when administering users" do
integrate_views
- fixtures :users
+ fixtures :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before { basic_auth_login @request }
it "shows the index/list page" do
diff --git a/spec/controllers/comment_controller_spec.rb b/spec/controllers/comment_controller_spec.rb
index 2b0f5eee2..4c14b8d24 100644
--- a/spec/controllers/comment_controller_spec.rb
+++ b/spec/controllers/comment_controller_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe CommentController, "when commenting on a request" do
integrate_views
- fixtures :info_requests, :outgoing_messages, :public_bodies, :public_body_translations, :users, :comments
+ fixtures :users, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "should give an error and render 'new' template when body text is just some whitespace" do
post :new, :url_title => info_requests(:naughty_chicken_request).url_title,
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index 054b9881f..40a676d61 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -2,15 +2,19 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe GeneralController, "when searching" do
integrate_views
- fixtures [ :public_bodies,
- :public_body_translations,
- :users,
- :raw_emails,
- :info_requests,
- :info_request_events,
- :outgoing_messages,
- :incoming_messages,
- :comments ]
+ fixtures [
+ :public_bodies,
+ :public_body_translations,
+ :public_body_versions,
+ :users,
+ :info_requests,
+ :raw_emails,
+ :incoming_messages,
+ :outgoing_messages,
+ :comments,
+ :info_request_events,
+ :track_things,
+ ]
before(:each) do
load_raw_emails_data(raw_emails)
@@ -70,13 +74,13 @@ describe GeneralController, "when searching" do
describe "when using different locale settings" do
home_link_regex = /href=".*\/en"/
it "should generate URLs with a locale prepended when there's more than one locale set" do
- ActionController::Routing::Routes.add_filters(['conditionallyprependlocale'])
+ ActionController::Routing::Routes.add_filters('conditionallyprependlocale')
get :frontpage
response.should have_text(home_link_regex)
end
it "should generate URLs without a locale prepended when there's only one locale set" do
- ActionController::Routing::Routes.add_filters(['conditionallyprependlocale'])
+ ActionController::Routing::Routes.add_filters('conditionallyprependlocale')
old_available_locales = FastGettext.default_available_locales
available_locales = ['en']
FastGettext.default_available_locales = available_locales
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb
index efcbc7d57..ec56707be 100644
--- a/spec/controllers/public_body_controller_spec.rb
+++ b/spec/controllers/public_body_controller_spec.rb
@@ -4,7 +4,7 @@ require 'json'
describe PublicBodyController, "when showing a body" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :public_body_versions
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "should be successful" do
get :show, :url_name => "dfh", :view => 'all'
@@ -61,7 +61,7 @@ end
describe PublicBodyController, "when listing bodies" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :public_body_versions
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "should be successful" do
get :list
@@ -142,7 +142,7 @@ end
describe PublicBodyController, "when showing JSON version for API" do
- fixtures :public_bodies, :public_body_translations
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "should be successful" do
get :show, :url_name => "dfh", :format => "json", :view => 'all'
@@ -157,7 +157,7 @@ describe PublicBodyController, "when showing JSON version for API" do
end
describe PublicBodyController, "when doing type ahead searches" do
- fixtures :public_bodies, :public_body_translations, :users, :raw_emails, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "should return nothing for the empty query string" do
get :search_typeahead, :q => ""
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index fe9a6a99e..3420d212e 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -4,7 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'json'
describe RequestController, "when listing recent requests" do
- fixtures :users, :public_bodies, :public_body_translations, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events
+ fixtures :users, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
@@ -52,7 +52,7 @@ end
describe RequestController, "when showing one request" do
- fixtures :public_bodies, :public_body_translations, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events # all needed as integrating views
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
@@ -249,7 +249,7 @@ describe RequestController, "when showing one request" do
end
describe RequestController, "when changing prominence of a request" do
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :info_request_events # all needed as integrating views
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :info_request_events, :track_things # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
@@ -365,7 +365,7 @@ end
describe RequestController, "when creating a new request" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :outgoing_messages
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
@user = users(:bob_smith_user)
@@ -549,7 +549,7 @@ end
describe RequestController, "when viewing an individual response for reply/followup" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events # all needed as integrating views
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
@@ -596,7 +596,7 @@ end
describe RequestController, "when classifying an information request" do
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events # all needed as integrating views
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things # all needed as integrating views
before(:each) do
@dog_request = info_requests(:fancy_dog_request)
@@ -807,7 +807,7 @@ describe RequestController, "when classifying an information request" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /as needing admin/
- mail.from_addrs.to_s.should == @request_owner.name_and_email
+ mail.from_addrs.first.to_s.should == @request_owner.name_and_email
end
it 'should say it is showing advice as to what to do next' do
@@ -932,7 +932,7 @@ end
describe RequestController, "when sending a followup message" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :info_request_events # all needed as integrating views
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
@@ -985,7 +985,7 @@ describe RequestController, "when sending a followup message" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /What a useless response! You suck./
- mail.to_addrs.to_s.should == "FOI Person <foiperson@localhost>"
+ mail.to_addrs.first.to_s.should == "FOI Person <foiperson@localhost>"
response.should redirect_to(:action => 'show', :url_title => info_requests(:fancy_dog_request).url_title)
@@ -1015,7 +1015,7 @@ end
describe RequestController, "sending overdue request alerts" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :info_request_events # all needed as integrating views
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
@@ -1032,7 +1032,7 @@ describe RequestController, "sending overdue request alerts" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /promptly, as normally/
- mail.to_addrs.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email
mail.body =~ /(http:\/\/.*\/c\/(.*))/
mail_url = $1
@@ -1060,7 +1060,7 @@ describe RequestController, "sending overdue request alerts" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /promptly, as normally/
- mail.to_addrs.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email
end
it "should send not actually send the overdue alert if the user is banned" do
@@ -1085,7 +1085,7 @@ describe RequestController, "sending overdue request alerts" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /required by law/
- mail.to_addrs.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:naughty_chicken_request).user.name_and_email
mail.body =~ /(http:\/\/.*\/c\/(.*))/
mail_url = $1
@@ -1103,7 +1103,7 @@ end
describe RequestController, "sending unclassified new response reminder alerts" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events # all needed as integrating views
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
@@ -1116,7 +1116,7 @@ describe RequestController, "sending unclassified new response reminder alerts"
deliveries.size.should == 3 # sufficiently late it sends reminders too
mail = deliveries[0]
mail.body.should =~ /To let us know/
- mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
mail.body =~ /(http:\/\/.*\/c\/(.*))/
mail_url = $1
mail_token = $2
@@ -1134,7 +1134,7 @@ end
describe RequestController, "clarification required alerts" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :info_request_events # all needed as integrating views
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -1153,7 +1153,7 @@ describe RequestController, "clarification required alerts" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /asked you to explain/
- mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
mail.body =~ /(http:\/\/.*\/c\/(.*))/
mail_url = $1
mail_token = $2
@@ -1188,7 +1188,7 @@ end
describe RequestController, "comment alerts" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events # all needed as integrating views
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -1207,7 +1207,7 @@ describe RequestController, "comment alerts" do
deliveries = ActionMailer::Base.deliveries
mail = deliveries[0]
mail.body.should =~ /has annotated your/
- mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
mail.body =~ /(http:\/\/.*)/
mail_url = $1
@@ -1250,7 +1250,7 @@ describe RequestController, "comment alerts" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /There are 2 new annotations/
- mail.to_addrs.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
+ mail.to_addrs.first.to_s.should == info_requests(:fancy_dog_request).user.name_and_email
mail.body =~ /(http:\/\/.*)/
mail_url = $1
@@ -1263,7 +1263,7 @@ end
describe RequestController, "when viewing comments" do
integrate_views
- fixtures :users, :info_requests, :raw_emails, :incoming_messages
+ fixtures :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -1286,7 +1286,7 @@ end
describe RequestController, "authority uploads a response from the web interface" do
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :info_request_events
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:all) do
# domain after the @ is used for authentication of FOI officers, so to test it
@@ -1373,7 +1373,7 @@ end
describe RequestController, "when showing JSON version for API" do
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
@@ -1393,7 +1393,7 @@ describe RequestController, "when showing JSON version for API" do
end
describe RequestController, "when doing type ahead searches" do
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "should return nothing for the empty query string" do
get :search_typeahead, :q => ""
diff --git a/spec/controllers/request_game_controller_spec.rb b/spec/controllers/request_game_controller_spec.rb
index 0b8f5751c..cc0808ef3 100644
--- a/spec/controllers/request_game_controller_spec.rb
+++ b/spec/controllers/request_game_controller_spec.rb
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe RequestGameController, "when playing the game" do
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :info_request_events # all needed as integrating views
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things # all needed as integrating views
before(:each) do
load_raw_emails_data(raw_emails)
end
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb
index 617e36213..90d13495f 100644
--- a/spec/controllers/track_controller_spec.rb
+++ b/spec/controllers/track_controller_spec.rb
@@ -36,7 +36,7 @@ end
describe TrackController, "when sending alerts for a track" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things, :track_things_sent_emails
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things, :track_things_sent_emails
include LinkToHelper # for main_url
before(:each) do
@@ -58,7 +58,7 @@ describe TrackController, "when sending alerts for a track" do
deliveries.size.should == 1
mail = deliveries[0]
mail.body.should =~ /Alter your subscription/
- mail.to_addrs.to_s.should include(users(:silly_name_user).email)
+ mail.to_addrs.first.to_s.should include(users(:silly_name_user).email)
mail.body =~ /(http:\/\/.*\/c\/(.*))/
mail_url = $1
mail_token = $2
@@ -110,7 +110,7 @@ end
describe TrackController, "when viewing RSS feed for a track" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
@@ -136,7 +136,7 @@ end
describe TrackController, "when viewing JSON version of a track feed" do
integrate_views
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index ae771da04..399b275a7 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'json'
@@ -7,7 +8,7 @@ require 'json'
describe UserController, "when showing a user" do
integrate_views
- fixtures :users, :public_bodies, :public_body_translations, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :info_request_events, :comments
+ fixtures :users, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -260,8 +261,8 @@ describe UserController, "when sending another user a message" do
mail = deliveries[0]
mail.body.should include("Bob Smith has used #{MySociety::Config.get('SITE_NAME')} to send you the message below")
mail.body.should include("Just a test!")
- #mail.to_addrs.to_s.should == users(:silly_name_user).name_and_email # XXX fix some nastiness with quoting name_and_email
- mail.from_addrs.to_s.should == users(:bob_smith_user).name_and_email
+ #mail.to_addrs.first.to_s.should == users(:silly_name_user).name_and_email # XXX fix some nastiness with quoting name_and_email
+ mail.from_addrs.first.to_s.should == users(:bob_smith_user).name_and_email
end
end
diff --git a/spec/integration/errors_spec.rb b/spec/integration/errors_spec.rb
index c64ca79e8..bfb7e5fb5 100644
--- a/spec/integration/errors_spec.rb
+++ b/spec/integration/errors_spec.rb
@@ -2,15 +2,19 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "When rendering errors" do
- fixtures [ :info_requests,
- :info_request_events,
- :public_bodies,
- :public_body_translations,
- :users,
- :raw_emails,
- :outgoing_messages,
- :incoming_messages,
- :comments ]
+ fixtures [
+ :users,
+ :public_bodies,
+ :public_body_translations,
+ :public_body_versions,
+ :info_requests,
+ :raw_emails,
+ :outgoing_messages,
+ :incoming_messages,
+ :comments,
+ :info_request_events,
+ :track_things,
+ ]
before(:each) do
load_raw_emails_data(raw_emails)
diff --git a/spec/integration/search_request_spec.rb b/spec/integration/search_request_spec.rb
index dcd20c7bd..07839af32 100644
--- a/spec/integration/search_request_spec.rb
+++ b/spec/integration/search_request_spec.rb
@@ -2,15 +2,19 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "When searching" do
- fixtures [ :info_requests,
- :info_request_events,
- :public_bodies,
- :public_body_translations,
- :users,
- :raw_emails,
- :outgoing_messages,
- :incoming_messages,
- :comments ]
+ fixtures [
+ :users,
+ :public_bodies,
+ :public_body_translations,
+ :public_body_versions,
+ :info_requests,
+ :raw_emails,
+ :outgoing_messages,
+ :incoming_messages,
+ :comments,
+ :info_request_events,
+ :track_things,
+ ]
before(:each) do
emails = raw_emails.clone
diff --git a/spec/lib/tmail_extensions_spec.rb b/spec/lib/tmail_extensions_spec.rb
index ffb8cb178..6a55c34da 100644
--- a/spec/lib/tmail_extensions_spec.rb
+++ b/spec/lib/tmail_extensions_spec.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
# This is a test of the set_content_type monkey patch in
# lib/tmail_extensions.rb
diff --git a/spec/lib/whatdotheyknow/strip_empty_sessions_spec.rb b/spec/lib/whatdotheyknow/strip_empty_sessions_spec.rb
index 1cf5e3d25..9bd5ccb93 100644
--- a/spec/lib/whatdotheyknow/strip_empty_sessions_spec.rb
+++ b/spec/lib/whatdotheyknow/strip_empty_sessions_spec.rb
@@ -1,4 +1,4 @@
-require 'spec_helper'
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe WhatDoTheyKnow::StripEmptySessions do
def make_response(session_data, response_headers)
diff --git a/spec/models/has_tag_string_tag_spec.rb b/spec/models/has_tag_string_tag_spec.rb
index ba439acb8..1acd2e27d 100644
--- a/spec/models/has_tag_string_tag_spec.rb
+++ b/spec/models/has_tag_string_tag_spec.rb
@@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe HasTagString::HasTagStringTag, " when fiddling with tag strings " do
- fixtures :public_bodies, :public_body_translations
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "should be able to make a new tag and save it" do
@tag = HasTagString::HasTagStringTag.new
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb
index a8411bc34..1a4baca0b 100644
--- a/spec/models/incoming_message_spec.rb
+++ b/spec/models/incoming_message_spec.rb
@@ -1,7 +1,8 @@
+# coding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe IncomingMessage, " when dealing with incoming mail" do
- fixtures :users, :raw_emails, :public_bodies, :public_body_translations, :info_requests, :incoming_messages
+ fixtures :users, :raw_emails, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
@im = incoming_messages(:useless_incoming_message)
@@ -160,7 +161,7 @@ describe IncomingMessage, " checking validity to reply to" do
end
describe IncomingMessage, " checking validity to reply to with real emails" do
- fixtures :users, :raw_emails, :public_bodies, :public_body_translations, :info_requests, :incoming_messages
+ fixtures :users, :raw_emails, :public_bodies, :public_body_translations, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
after(:all) do
ActionMailer::Base.deliveries.clear
@@ -184,7 +185,7 @@ describe IncomingMessage, " checking validity to reply to with real emails" do
end
describe IncomingMessage, " when censoring data" do
- fixtures :users, :raw_emails, :public_bodies, :public_body_translations, :info_requests, :incoming_messages
+ fixtures :users, :raw_emails, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
@test_data = "There was a mouse called Stilton, he wished that he was blue."
@@ -294,7 +295,7 @@ describe IncomingMessage, " when censoring data" do
end
describe IncomingMessage, " when censoring whole users" do
- fixtures :users, :raw_emails, :public_bodies, :public_body_translations, :info_requests, :incoming_messages
+ fixtures :users, :raw_emails, :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
@test_data = "There was a mouse called Stilton, he wished that he was blue."
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index d50d6dace..409d48ede 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe InfoRequest do
describe "guessing a request from an email" do
- fixtures :public_bodies, :info_requests, :raw_emails, :incoming_messages
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
@im = incoming_messages(:useless_incoming_message)
@@ -74,7 +74,7 @@ describe InfoRequest do
describe " when emailing" do
- fixtures :public_bodies, :public_body_translations, :users, :info_requests, :outgoing_messages, :info_request_events, :comments
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
@info_request = info_requests(:fancy_dog_request)
@@ -154,7 +154,7 @@ describe InfoRequest do
end
describe "when calculating the status" do
- fixtures :holidays, :public_bodies, :public_body_translations, :info_requests, :outgoing_messages, :info_request_events
+ fixtures :holidays, :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
@ir = info_requests(:naughty_chicken_request)
@@ -196,7 +196,7 @@ describe InfoRequest do
describe "when using a plugin and calculating the status" do
- fixtures :info_requests
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
InfoRequest.send(:require, File.expand_path(File.dirname(__FILE__) + '/customstates'))
@@ -231,7 +231,7 @@ describe InfoRequest do
describe "when calculating the status for a school" do
- fixtures :holidays, :public_bodies, :public_body_translations, :info_requests, :info_request_events
+ fixtures :holidays, :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
@ir = info_requests(:naughty_chicken_request)
@@ -380,8 +380,8 @@ describe InfoRequest do
before do
Time.stub!(:now).and_return(Time.utc(2007, 11, 9, 23, 59))
- @mock_comment_event = mock_model(InfoRequestEvent, :created_at => Time.now - 23.days, :event_type => 'comment')
- @mock_response_event = mock_model(InfoRequestEvent, :created_at => Time.now - 22.days, :event_type => 'response')
+ @mock_comment_event = safe_mock_model(InfoRequestEvent, :created_at => Time.now - 23.days, :event_type => 'comment')
+ @mock_response_event = safe_mock_model(InfoRequestEvent, :created_at => Time.now - 22.days, :event_type => 'response')
@info_request = InfoRequest.new(:prominence => 'normal',
:awaiting_description => true,
:info_request_events => [@mock_response_event, @mock_comment_event])
diff --git a/spec/models/outgoing_mailer_spec.rb b/spec/models/outgoing_mailer_spec.rb
index c96a3fb74..75c8053b4 100644
--- a/spec/models/outgoing_mailer_spec.rb
+++ b/spec/models/outgoing_mailer_spec.rb
@@ -4,7 +4,7 @@ describe OutgoingMailer, " when working out follow up addresses" do
# This is done with fixtures as the code is a bit tangled with the way it
# calls TMail. XXX untangle it and make these tests spread out and using
# mocks. Put parts of the tests in spec/lib/tmail_extensions.rb
- fixtures :info_requests, :incoming_messages, :raw_emails, :public_bodies, :public_body_translations
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -70,7 +70,7 @@ describe OutgoingMailer, " when working out follow up addresses" do
end
describe OutgoingMailer, "when working out follow up subjects" do
- fixtures :info_requests, :incoming_messages, :outgoing_messages, :raw_emails
+ fixtures :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
diff --git a/spec/models/outgoing_message_spec.rb b/spec/models/outgoing_message_spec.rb
index 1956c4d73..58d9f398e 100644
--- a/spec/models/outgoing_message_spec.rb
+++ b/spec/models/outgoing_message_spec.rb
@@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe OutgoingMessage, " when making an outgoing message" do
- fixtures :outgoing_messages, :info_requests, :incoming_messages, :public_bodies, :public_body_translations
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
@om = outgoing_messages(:useless_outgoing_message)
@@ -38,7 +38,7 @@ end
describe IncomingMessage, " when censoring data" do
- fixtures :outgoing_messages, :info_requests
+ fixtures :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
@om = outgoing_messages(:useless_outgoing_message)
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index 33ab8ffdb..09edb395f 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -95,7 +95,7 @@ describe PublicBody, " using machine tags" do
end
describe PublicBody, "when finding_by_tags" do
- fixtures :public_bodies, :public_body_translations
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
@geraldine = public_bodies(:geraldine_public_body)
@@ -173,7 +173,7 @@ describe PublicBody, " when saving" do
end
describe PublicBody, "when searching" do
- fixtures :public_bodies, :public_body_translations, :public_body_versions
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "should find by existing url name" do
body = PublicBody.find_by_url_name_with_historic('dfh')
@@ -302,8 +302,8 @@ describe PublicBody, " when loading CSV files" do
notes.size.should == 4
notes.should == [
"line 2: creating new authority 'North West Fake Authority' (locale: en):\n\t\{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\",\"home_page\":\"http://northwest.org\"\}",
- "line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t\{\"tag_string\":\"scottish\",\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\"\}",
- "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t\{\"tag_string\":\"fake aTag\",\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\"\}",
+ "line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t\{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"\}",
+ "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t\{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"\}",
"Notes: Some bodies are in database, but not in CSV file:\n Department for Humpadinking\n Geraldine Quango\nYou may want to delete them manually.\n"
]
@@ -316,7 +316,7 @@ describe PublicBody, " when loading CSV files" do
PublicBody.find_by_name('North West Fake Authority').tag_array_for_search.should == []
PublicBody.find_by_name('Scottish Fake Authority').tag_array_for_search.should == ['scottish']
- PublicBody.find_by_name('Fake Authority of Northern Ireland').tag_array_for_search.should == ['fake', 'aTag']
+ PublicBody.find_by_name('Fake Authority of Northern Ireland').tag_array_for_search.should == ['aTag', 'fake']
# Import again to check the 'add' tag functionality works
new_tags_file = load_file_fixture('fake-authority-add-tags.rb')
@@ -324,8 +324,8 @@ describe PublicBody, " when loading CSV files" do
# Check tags were added successfully
PublicBody.find_by_name('North West Fake Authority').tag_array_for_search.should == ['aTag']
- PublicBody.find_by_name('Scottish Fake Authority').tag_array_for_search.should == ['scottish', 'aTag']
- PublicBody.find_by_name('Fake Authority of Northern Ireland').tag_array_for_search.should == ['fake', 'aTag']
+ PublicBody.find_by_name('Scottish Fake Authority').tag_array_for_search.should == ['aTag', 'scottish']
+ PublicBody.find_by_name('Fake Authority of Northern Ireland').tag_array_for_search.should == ['aTag', 'fake']
end
it "should import tags successfully when the import tag is set" do
@@ -334,8 +334,8 @@ describe PublicBody, " when loading CSV files" do
# Check new bodies were imported successfully
PublicBody.find_by_name('North West Fake Authority').tag_array_for_search.should == ['fake']
- PublicBody.find_by_name('Scottish Fake Authority').tag_array_for_search.should == ['scottish', 'fake']
- PublicBody.find_by_name('Fake Authority of Northern Ireland').tag_array_for_search.should == ['fake', 'aTag']
+ PublicBody.find_by_name('Scottish Fake Authority').tag_array_for_search.should == ['fake', 'scottish']
+ PublicBody.find_by_name('Fake Authority of Northern Ireland').tag_array_for_search.should == ['aTag', 'fake']
# Import again to check the 'replace' tag functionality works
new_tags_file = load_file_fixture('fake-authority-add-tags.rb')
@@ -344,7 +344,7 @@ describe PublicBody, " when loading CSV files" do
# Check tags were added successfully
PublicBody.find_by_name('North West Fake Authority').tag_array_for_search.should == ['aTag']
PublicBody.find_by_name('Scottish Fake Authority').tag_array_for_search.should == ['aTag']
- PublicBody.find_by_name('Fake Authority of Northern Ireland').tag_array_for_search.should == ['fake', 'aTag']
+ PublicBody.find_by_name('Fake Authority of Northern Ireland').tag_array_for_search.should == ['aTag', 'fake']
end
it "should create bodies with names in multiple locales" do
@@ -357,9 +357,9 @@ describe PublicBody, " when loading CSV files" do
notes.should == [
"line 2: creating new authority 'North West Fake Authority' (locale: en):\n\t{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\",\"home_page\":\"http://northwest.org\"}",
"line 2: creating new authority 'North West Fake Authority' (locale: es):\n\t{\"name\":\"Autoridad del Nordeste\"}",
- "line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t{\"tag_string\":\"scottish\",\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\"}",
+ "line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"}",
"line 3: creating new authority 'Scottish Fake Authority' (locale: es):\n\t{\"name\":\"Autoridad Escocesa\"}",
- "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t{\"tag_string\":\"fake aTag\",\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\"}",
+ "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"}",
"line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: es):\n\t{\"name\":\"Autoridad Irlandesa\"}",
"Notes: Some bodies are in database, but not in CSV file:\n Department for Humpadinking\n Geraldine Quango\nYou may want to delete them manually.\n"
]
@@ -385,8 +385,8 @@ describe PublicBody, " when loading CSV files" do
notes.size.should == 4
notes.should == [
"line 2: creating new authority 'North West Fake Authority' (locale: en):\n\t{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\",\"home_page\":\"http://northwest.org\"}",
- "line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t{\"tag_string\":\"scottish\",\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\"}",
- "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t{\"tag_string\":\"fake aTag\",\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\"}",
+ "line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"}",
+ "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"}",
"Notes: Some bodies are in database, but not in CSV file:\n Department for Humpadinking\n Geraldine Quango\nYou may want to delete them manually.\n"
]
diff --git a/spec/models/request_mailer_spec.rb b/spec/models/request_mailer_spec.rb
index fbe22c220..ef4ed8074 100644
--- a/spec/models/request_mailer_spec.rb
+++ b/spec/models/request_mailer_spec.rb
@@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe RequestMailer, " when receiving incoming mail" do
- fixtures :info_requests, :incoming_messages, :raw_emails, :users, :public_bodies, :public_body_translations
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
end
diff --git a/spec/models/track_thing_spec.rb b/spec/models/track_thing_spec.rb
index 1a0324a78..4922a96c7 100644
--- a/spec/models/track_thing_spec.rb
+++ b/spec/models/track_thing_spec.rb
@@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe TrackThing, "when tracking changes" do
- fixtures :track_things, :users
+ fixtures :users, :info_requests, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
@track_thing = track_things(:track_fancy_dog_search)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 751a61060..e0a6c649e 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -152,10 +152,10 @@ end
describe User, "when reindexing referencing models" do
before do
- @request_event = mock_model(InfoRequestEvent, :xapian_mark_needs_index => true)
- @request = mock_model(InfoRequest, :info_request_events => [@request_event])
- @comment_event = mock_model(InfoRequestEvent, :xapian_mark_needs_index => true)
- @comment = mock_model(Comment, :info_request_events => [@comment_event])
+ @request_event = safe_mock_model(InfoRequestEvent, :xapian_mark_needs_index => true)
+ @request = safe_mock_model(InfoRequest, :info_request_events => [@request_event])
+ @comment_event = safe_mock_model(InfoRequestEvent, :xapian_mark_needs_index => true)
+ @comment = safe_mock_model(Comment, :info_request_events => [@comment_event])
@user = User.new(:comments => [@comment], :info_requests => [@request])
end
@@ -193,7 +193,7 @@ describe User, "when reindexing referencing models" do
end
describe User, "when checking abilities" do
- fixtures :users
+ fixtures :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
@user = users(:bob_smith_user)
@@ -283,7 +283,7 @@ describe User, "when setting a profile photo" do
end
describe User, "when unconfirmed" do
- fixtures :users
+ fixtures :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before do
@user = users(:unconfirmed_user)
@@ -295,7 +295,7 @@ describe User, "when unconfirmed" do
end
describe User, "when emails have bounced" do
- fixtures :users
+ fixtures :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "should record bounces" do
User.record_bounce_for_email("bob@localhost", "The reason we think the email bounced (e.g. a bounce message)")
diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb
index 8e8616df5..932966dfb 100644
--- a/spec/models/xapian_spec.rb
+++ b/spec/models/xapian_spec.rb
@@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe User, " when indexing users with Xapian" do
- fixtures :users
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
it "should search by name" do
rebuild_xapian_index
@@ -33,7 +33,7 @@ describe User, " when indexing users with Xapian" do
end
describe PublicBody, " when indexing public bodies with Xapian" do
- fixtures :public_bodies, :public_body_translations, :incoming_messages, :outgoing_messages, :raw_emails, :comments, :info_requests
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -71,7 +71,7 @@ describe PublicBody, " when indexing public bodies with Xapian" do
end
describe PublicBody, " when indexing requests by body they are to" do
- fixtures :public_bodies, :public_body_translations, :info_request_events, :info_requests, :raw_emails, :comments
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
@@ -131,7 +131,7 @@ describe PublicBody, " when indexing requests by body they are to" do
end
describe User, " when indexing requests by user they are from" do
- fixtures :users, :info_request_events, :info_requests, :incoming_messages, :outgoing_messages, :raw_emails, :comments
+ fixtures :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -218,7 +218,7 @@ describe User, " when indexing requests by user they are from" do
end
describe User, " when indexing comments by user they are by" do
- fixtures :users, :info_request_events, :info_requests, :comments, :incoming_messages, :outgoing_messages, :raw_emails, :comments
+ fixtures :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -255,7 +255,7 @@ describe User, " when indexing comments by user they are by" do
end
describe InfoRequest, " when indexing requests by their title" do
- fixtures :info_request_events, :info_requests, :incoming_messages, :raw_emails, :comments
+ fixtures :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -286,7 +286,7 @@ describe InfoRequest, " when indexing requests by their title" do
end
describe InfoRequest, " when indexing requests by tag" do
- fixtures :info_request_events, :info_requests, :incoming_messages, :raw_emails, :comments
+ fixtures :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
end
@@ -308,7 +308,7 @@ describe InfoRequest, " when indexing requests by tag" do
end
describe PublicBody, " when indexing authorities by tag" do
- fixtures :public_bodies, :public_body_translations, :incoming_messages, :outgoing_messages, :raw_emails, :comments
+ fixtures :public_bodies, :public_body_translations, :public_body_versions, :users, :info_requests, :raw_emails, :incoming_messages, :outgoing_messages, :comments, :info_request_events, :track_things
before(:each) do
load_raw_emails_data(raw_emails)
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index d1b3083c4..ecb67a3b4 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,7 +1,7 @@
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
-require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment'))
+require File.expand_path(File.join('..', '..', 'config', 'environment'), __FILE__)
require 'spec/autorun'
require 'spec/rails'
@@ -17,16 +17,13 @@ config['REPLY_LATE_AFTER_DAYS'] = 20
# Uncomment the next line to use webrat's matchers
#require 'webrat/integrations/rspec-rails'
-# Requires supporting files with custom matchers and macros, etc,
-# in ./support/ and its subdirectories.
-Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
-
Spec::Runner.configure do |config|
# If you're not using ActiveRecord you should remove these
# lines, delete config/database.yml and disable :active_record
# in your config/boot.rb
- config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
+ # fixture_path must end in a separator
+ config.fixture_path = File.join(Rails.root, 'spec', 'fixtures') + File::SEPARATOR
# == Fixtures
#
@@ -147,6 +144,14 @@ if $tempfilecount.nil?
end
end
+# to_ary differs in Ruby 1.8 and 1.9
+# @see http://yehudakatz.com/2010/01/02/the-craziest-fing-bug-ive-ever-seen/
+def safe_mock_model(model, args = {})
+ mock = mock_model(model, args)
+ mock.should_receive(:to_ary).any_number_of_times
+ mock
+end
+
def load_raw_emails_data(raw_emails)
raw_email = raw_emails(:useless_raw_email)
begin
diff --git a/spec/views/public_body/show.rhtml_spec.rb b/spec/views/public_body/show.rhtml_spec.rb
index cd81888eb..a37d8be0d 100644
--- a/spec/views/public_body/show.rhtml_spec.rb
+++ b/spec/views/public_body/show.rhtml_spec.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
+require File.expand_path(File.join('..', '..', '..', 'spec_helper'), __FILE__)
describe "when viewing a body" do
before do
diff --git a/spec/views/request/_after_actions.rhtml_spec.rb b/spec/views/request/_after_actions.rhtml_spec.rb
index c73f35d33..6a56e7a71 100644
--- a/spec/views/request/_after_actions.rhtml_spec.rb
+++ b/spec/views/request/_after_actions.rhtml_spec.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
+require File.expand_path(File.join('..', '..', '..', 'spec_helper'), __FILE__)
describe 'when displaying actions that can be taken with regard to a request' do
diff --git a/spec/views/request/_describe_state.rhtml_spec.rb b/spec/views/request/_describe_state.rhtml_spec.rb
index 9fb776db3..ccf653b1b 100644
--- a/spec/views/request/_describe_state.rhtml_spec.rb
+++ b/spec/views/request/_describe_state.rhtml_spec.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
+require File.expand_path(File.join('..', '..', '..', 'spec_helper'), __FILE__)
describe 'when showing the form for describing the state of a request' do
diff --git a/spec/views/request/list.rhtml_spec.rb b/spec/views/request/list.rhtml_spec.rb
index 60a28eec5..1f86ec641 100644
--- a/spec/views/request/list.rhtml_spec.rb
+++ b/spec/views/request/list.rhtml_spec.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
+require File.expand_path(File.join('..', '..', '..', 'spec_helper'), __FILE__)
describe "when listing recent requests" do
diff --git a/spec/views/request/show.rhtml_spec.rb b/spec/views/request/show.rhtml_spec.rb
index ca4663afc..adb244f47 100644
--- a/spec/views/request/show.rhtml_spec.rb
+++ b/spec/views/request/show.rhtml_spec.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
+require File.expand_path(File.join('..', '..', '..', 'spec_helper'), __FILE__)
describe 'when viewing an information request' do
diff --git a/spec/views/request_game/play.rhtml_spec.rb b/spec/views/request_game/play.rhtml_spec.rb
index e90861e34..24fb6d75d 100644
--- a/spec/views/request_game/play.rhtml_spec.rb
+++ b/spec/views/request_game/play.rhtml_spec.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
+require File.expand_path(File.join('..', '..', '..', 'spec_helper'), __FILE__)
describe 'when viewing the request game' do
diff --git a/vendor/plugins/has_tag_string/lib/has_tag_string.rb b/vendor/plugins/has_tag_string/lib/has_tag_string.rb
index 49b82ca0d..b982bc3a0 100644
--- a/vendor/plugins/has_tag_string/lib/has_tag_string.rb
+++ b/vendor/plugins/has_tag_string/lib/has_tag_string.rb
@@ -98,7 +98,7 @@ module HasTagString
ret[tag.name_and_value] = 1
end
- return ret.keys
+ return ret.keys.sort
end
# Test to see if class is tagged with the given tag
diff --git a/vendor/rails-locales b/vendor/rails-locales
-Subproject d0fb0563129001c6114e351ba5738655733b833
+Subproject 7b769690775e9705f82da75aee3435e8dadebec