2012-04-01 07:51:11 +00:00
|
|
|
require 'helper'
|
|
|
|
|
2012-04-01 19:30:17 +00:00
|
|
|
MyKlass = Class.new do
|
|
|
|
def hello
|
|
|
|
"timothy"
|
|
|
|
end
|
|
|
|
def goodbye
|
|
|
|
"jenny"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "find-command" 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
|
2012-04-01 07:51:11 +00:00
|
|
|
end
|
2012-04-01 19:30:17 +00:00
|
|
|
|
|
|
|
it "should NOT match a method that does not match the regex" do
|
|
|
|
mock_pry("find-method hell MyKlass").should.not =~ /MyKlass.*?goodbye/m
|
2012-04-01 07:51:11 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-04-01 19:30:17 +00:00
|
|
|
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
|
2012-04-01 07:51:11 +00:00
|
|
|
end
|
|
|
|
|
2012-04-01 19:30:17 +00:00
|
|
|
it "should NOT match a method that does not match the regex" do
|
|
|
|
mock_pry("find-method timothy MyKlass").should.not =~ /MyKlass.*?goodbye/m
|
2012-04-01 07:51:11 +00:00
|
|
|
end
|
|
|
|
end
|
2012-04-01 19:30:17 +00:00
|
|
|
|
2012-04-01 08:34:40 +00:00
|
|
|
end
|
2012-04-01 19:30:17 +00:00
|
|
|
|
|
|
|
Object.remove_const(:MyKlass)
|