mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
added initial tests for find-method command
This commit is contained in:
parent
feb716b5d0
commit
07095ceccd
1 changed files with 35 additions and 0 deletions
35
test/test_default_commands/test_find_method.rb
Normal file
35
test/test_default_commands/test_find_method.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
require 'helper'
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Object.remove_const(:MyKlass)
|
Loading…
Reference in a new issue