summaryrefslogtreecommitdiff
path: root/spec/ruby/core/regexp
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/regexp')
-rw-r--r--spec/ruby/core/regexp/union_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/ruby/core/regexp/union_spec.rb b/spec/ruby/core/regexp/union_spec.rb
index 81a31d89b3..8076836471 100644
--- a/spec/ruby/core/regexp/union_spec.rb
+++ b/spec/ruby/core/regexp/union_spec.rb
@@ -139,6 +139,16 @@ describe "Regexp.union" do
Regexp.union(obj, "bar").should == /foo|bar/
end
+ it "uses to_regexp to convert argument" do
+ obj = mock('pattern')
+ obj.should_receive(:to_regexp).and_return(/foo/)
+ Regexp.union(obj).should == /foo/
+ end
+
+ it "accepts a Symbol as argument" do
+ Regexp.union(:foo).should == /foo/
+ end
+
it "accepts a single array of patterns as arguments" do
Regexp.union(["skiing", "sledding"]).should == /skiing|sledding/
not_supported_on :opal do