summaryrefslogtreecommitdiff
path: root/spec/ruby/core/regexp/initialize_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/regexp/initialize_spec.rb')
-rw-r--r--spec/ruby/core/regexp/initialize_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/ruby/core/regexp/initialize_spec.rb b/spec/ruby/core/regexp/initialize_spec.rb
new file mode 100644
index 0000000000..3c32f97a31
--- /dev/null
+++ b/spec/ruby/core/regexp/initialize_spec.rb
@@ -0,0 +1,15 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+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
+ lambda { //.send(:initialize, "") }.should raise_error(SecurityError)
+ end
+
+ it "raises a TypeError on an initialized non-literal Regexp" do
+ lambda { Regexp.new("").send(:initialize, "") }.should raise_error(TypeError)
+ end
+end