aboutsummaryrefslogtreecommitdiffstats
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-07-18 15:33:05 +0100
committerLouise Crow <louise.crow@gmail.com>2013-07-18 17:43:11 +0100
commit9fe48c5b9db1c0ba6c1a59f0d092c88e5cae1aa0 (patch)
tree6a244ebe1422fa9fe627a7b4eebf2055adc6016e /spec/spec_helper.rb
parent6d67f4df65f8b56c9d54d71d449d46b1c6c92be2 (diff)
Switch routing-filter (which takes locale out of the params and puts it in the URL) off by default in model, controller, and helper tests. This means we can supply the locale as a param. Turn it on specifically for a couple of controller tests that test routing, and change other url localization tests into integration tests.
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index a3b06cea8..c7fb0af75 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -96,6 +96,16 @@ Spork.prefork do
I18n.locale = @save_i18n_locale
end
+ # Turn routing-filter off in functional and unit tests as per
+ # https://github.com/svenfuchs/routing-filter/blob/master/README.markdown#testing
+ config.before(:each) do
+ RoutingFilter.active = false if [:controller, :helper, :model].include? example.metadata[:type]
+ end
+
+ config.after(:each) do
+ RoutingFilter.active = true if [:controller, :helper, :model].include? example.metadata[:type]
+ end
+
# This section makes the garbage collector run less often to speed up tests
last_gc_run = Time.now