Sha256: bbb734fff5657b923a98d302b3204d31e42d0e4b8481a700c6e75aef64c3cada
Contents?: true
Size: 1021 Bytes
Versions: 83
Compression:
Stored size: 1021 Bytes
Contents
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper' describe "Regexp.union" do it "returns /(?!)/ when passed no arguments" do Regexp.union.should == /(?!)/ end it "returns a regular expression that will match passed arguments" do Regexp.union("penzance").should == /penzance/ Regexp.union("skiing", "sledding").should == /skiing|sledding/ Regexp.union(/dogs/, /cats/i).should == /(?-mix:dogs)|(?i-mx:cats)/ end it "uses to_str to convert arguments (if not Regexp)" do obj = mock('pattern') obj.should_receive(:to_str).and_return('foo') Regexp.union(obj, "bar").should == /foo|bar/ end ruby_version_is '1.8.7' do it "accepts a single array of patterns as arguments" do Regexp.union(["skiing", "sledding"]).should == /skiing|sledding/ Regexp.union([/dogs/, /cats/i]).should == /(?-mix:dogs)|(?i-mx:cats)/ lambda{Regexp.union(["skiing", "sledding"], [/dogs/, /cats/i])}.should raise_error(TypeError) end end end
Version data entries
83 entries across 83 versions & 1 rubygems