2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../spec_helper'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
describe "Regexp#initialize" do
|
|
|
|
it "is a private method" do
|
|
|
|
Regexp.should have_private_method(:initialize)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "raises a SecurityError on a Regexp literal" do
|
2019-07-27 06:40:09 -04:00
|
|
|
-> { //.send(:initialize, "") }.should raise_error(SecurityError)
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "raises a TypeError on an initialized non-literal Regexp" do
|
2019-07-27 06:40:09 -04:00
|
|
|
-> { Regexp.new("").send(:initialize, "") }.should raise_error(TypeError)
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
end
|