Created
June 5, 2010 08:12
-
-
Save machu/426434 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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