Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@machu
Created June 5, 2010 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save machu/426434 to your computer and use it in GitHub Desktop.
Save machu/426434 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
require 'safe'
describe Safe, "safe mode module" do
before(:each) do
$SAFE = 1
ENV["sample"] = "default"
end
it "引数に1を指定するとセーフレベル1で実行すること" do
Safe.safe(1) do
ENV["sample"] = "changed"
ENV["sample"].should == "changed"
end
end
it "引数に4を指定するとセーフレベル4で実行すること" do
proc {
Safe.safe do
ENV["sample"] = "changed"
end
}.should raise_error(SecurityError)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment