summaryrefslogtreecommitdiff
path: root/spec/rubyspec/core/matchdata/regexp_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubyspec/core/matchdata/regexp_spec.rb')
-rw-r--r--spec/rubyspec/core/matchdata/regexp_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/rubyspec/core/matchdata/regexp_spec.rb b/spec/rubyspec/core/matchdata/regexp_spec.rb
new file mode 100644
index 0000000000..2fdca34c30
--- /dev/null
+++ b/spec/rubyspec/core/matchdata/regexp_spec.rb
@@ -0,0 +1,13 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe "MatchData#regexp" do
+ it "returns a Regexp object" do
+ m = 'haystack'.match(/hay/)
+ m.regexp.should be_an_instance_of(Regexp)
+ end
+
+ it "returns the pattern used in the match" do
+ m = 'haystack'.match(/hay/)
+ m.regexp.should == /hay/
+ end
+end