2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../spec_helper'
|
2019-05-28 16:41:48 -04:00
|
|
|
require_relative 'shared/new'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
describe "Regexp.new" do
|
2019-05-28 16:41:48 -04:00
|
|
|
it_behaves_like :regexp_new, :new
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "Regexp.new given a String" do
|
2019-05-28 16:41:48 -04:00
|
|
|
it_behaves_like :regexp_new_string, :new
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "Regexp.new given a Regexp" do
|
2019-05-28 16:41:48 -04:00
|
|
|
it_behaves_like :regexp_new_regexp, :new
|
|
|
|
it_behaves_like :regexp_new_string_binary, :compile
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "Regexp.new given a Fixnum" do
|
|
|
|
it "raises a TypeError" do
|
2019-07-27 06:40:09 -04:00
|
|
|
-> { Regexp.new(1) }.should raise_error(TypeError)
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "Regexp.new given a Float" do
|
|
|
|
it "raises a TypeError" do
|
2019-07-27 06:40:09 -04:00
|
|
|
-> { Regexp.new(1.0) }.should raise_error(TypeError)
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
end
|