aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/testing_sandbox.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/testing_sandbox.rb')
-rw-r--r--actionpack/test/testing_sandbox.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/actionpack/test/testing_sandbox.rb b/actionpack/test/testing_sandbox.rb
index b3b8b0f4d4..c36585104f 100644
--- a/actionpack/test/testing_sandbox.rb
+++ b/actionpack/test/testing_sandbox.rb
@@ -1,11 +1,15 @@
module TestingSandbox
# Temporarily replaces KCODE for the block
def with_kcode(kcode)
- old_kcode, $KCODE = $KCODE, kcode
- begin
+ if RUBY_VERSION < '1.9'
+ old_kcode, $KCODE = $KCODE, kcode
+ begin
+ yield
+ ensure
+ $KCODE = old_kcode
+ end
+ else
yield
- ensure
- $KCODE = old_kcode
end
end
end