2018-03-04 15:09:32 +00:00
|
|
|
require_relative '../../spec_helper'
|
|
|
|
require_relative 'fixtures/classes'
|
2017-05-07 12:04:49 +00:00
|
|
|
|
|
|
|
describe "Kernel#untaint" do
|
2019-09-24 20:59:12 -07:00
|
|
|
ruby_version_is ''...'2.7' do
|
|
|
|
it "returns self" do
|
|
|
|
o = Object.new
|
|
|
|
o.untaint.should equal(o)
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2019-09-24 20:59:12 -07:00
|
|
|
it "clears the tainted bit" do
|
|
|
|
o = Object.new.taint
|
|
|
|
o.untaint
|
|
|
|
o.tainted?.should == false
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2019-09-24 20:59:12 -07:00
|
|
|
it "raises #{frozen_error_class} on a tainted, frozen object" do
|
|
|
|
o = Object.new.taint.freeze
|
|
|
|
-> { o.untaint }.should raise_error(frozen_error_class)
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2019-09-24 20:59:12 -07:00
|
|
|
it "does not raise an error on an untainted, frozen object" do
|
|
|
|
o = Object.new.freeze
|
|
|
|
o.untaint.should equal(o)
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
end
|
|
|
|
end
|