diff --git a/test/test_default_commands/test_find_method.rb b/test/test_default_commands/test_find_method.rb index 73847ebd..964c9cea 100644 --- a/test/test_default_commands/test_find_method.rb +++ b/test/test_default_commands/test_find_method.rb @@ -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