aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/lib/testing_sandbox.rb
blob: c36585104f5043d01f626876a58353ff16bfd0d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module TestingSandbox
  # Temporarily replaces KCODE for the block
  def with_kcode(kcode)
    if RUBY_VERSION < '1.9'
      old_kcode, $KCODE = $KCODE, kcode
      begin
        yield
      ensure
        $KCODE = old_kcode
      end
    else
      yield
    end
  end
end