diff options
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/spec_helper.rb | 13 |
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 |