diff options
Diffstat (limited to 'spec/ruby/core/matchdata/regexp_spec.rb')
-rw-r--r-- | spec/ruby/core/matchdata/regexp_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/core/matchdata/regexp_spec.rb b/spec/ruby/core/matchdata/regexp_spec.rb new file mode 100644 index 0000000000..2fdca34c30 --- /dev/null +++ b/spec/ruby/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 |