aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-03-28 10:30:42 +0000
committerLouise Crow <louise.crow@gmail.com>2013-03-28 10:30:42 +0000
commitb6434d4b18e57e018bea6ab23916a0b134438b6a (patch)
treefa74fff5123fa08ced6a2b9b0062ace05169c230
parent12946b70d1c3097a930f13bb812a1e0db709dcb4 (diff)
parentfd5c8370239ba970776aa345f4485e96a78f96ac (diff)
Merge remote-tracking branch 'openaustralia_github/test_order_fixes' into rails-3-develop
-rw-r--r--spec/controllers/request_controller_spec.rb2
-rw-r--r--spec/spec_helper.rb13
2 files changed, 15 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index ccbf6b8ab..4161f1118 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -2268,6 +2268,8 @@ describe RequestController, "when showing similar requests" do
end
it "should show similar requests" do
+ get_fixtures_xapian_index
+
badger_request = info_requests(:badger_request)
get :similar, :url_title => badger_request.url_title
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index c1b2d094c..57ab88da2 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -71,6 +71,19 @@ Spork.prefork do
ActionMailer::Base.deliveries = []
end
+ # Any test that messes with the locale needs to restore the state afterwards so that it
+ # doesn't interfere with any subsequent tests. This is made more complicated by the
+ # ApplicationController#set_gettext_locale which sets the locale and so you may be setting
+ # the locale in your tests and not even realising it. So, let's make things easier for
+ # ourselves and just always restore the locale for all tests.
+ config.before(:each) do
+ @save_i18n_locale = I18n.locale
+ end
+
+ config.after(:each) do
+ I18n.locale = @save_i18n_locale
+ end
+
# This section makes the garbage collector run less often to speed up tests
last_gc_run = Time.now