Update find method tests to new API

This commit is contained in:
☈king 2012-08-04 23:26:57 +00:00 committed by rking@sharpsaw.org
parent 7ecfa6d58f
commit d221a1e7ca
1 changed files with 16 additions and 9 deletions

View File

@ -24,21 +24,25 @@ unless Pry::Helpers::BaseHelpers.mri_18?
describe "find-method" do
describe "find matching methods by name regex (-n option)" do
it "should find a method by regex" do
mock_pry("find-method hell MyKlass").should =~ /MyKlass.*?hello/m
pry_eval("find-method hell MyKlass").should =~
/MyKlass.*?hello/m
end
it "should NOT match a method that does not match the regex" do
mock_pry("find-method hell MyKlass").should.not =~ /MyKlass.*?goodbye/m
pry_eval("find-method hell MyKlass").should.not =~
/MyKlass.*?goodbye/m
end
end
describe "find matching methods by content regex (-c option)" do
it "should find a method by regex" do
mock_pry("find-method -c timothy MyKlass").should =~ /MyKlass.*?hello/m
pry_eval("find-method -c timothy MyKlass").should =~
/MyKlass.*?hello/m
end
it "should NOT match a method that does not match the regex" do
mock_pry("find-method timothy MyKlass").should.not =~ /MyKlass.*?goodbye/m
pry_eval("find-method timothy MyKlass").should.not =~
/MyKlass.*?goodbye/m
end
end
@ -48,14 +52,17 @@ unless Pry::Helpers::BaseHelpers.mri_18?
raise "mooo"
end
mock_pry("find-method -c timothy MyKlass").should =~ /MyKlass.*?hello/m
pry_eval("find-method -c timothy MyKlass").should =~
/MyKlass.*?hello/m
end
it "should escape regexes correctly" do
mock_pry('find-method tea_time? MyKlass').should =~ /tea_tim\?/
mock_pry('find-method tea_time? MyKlass').should =~ /tea_time\?/
mock_pry('find-method tea_time\? MyKlass').should.not =~ /tea_tim\?/
mock_pry('find-method tea_time\? MyKlass').should =~ /tea_time\?/
good = /tea_time\?/
bad = /tea_tim\?/
pry_eval('find-method tea_time? MyKlass').should =~ good
pry_eval('find-method tea_time? MyKlass').should =~ good
pry_eval('find-method tea_time\? MyKlass').should.not =~ bad
pry_eval('find-method tea_time\? MyKlass').should =~ good
end
end