Sha256: de998d5ae5f4a4faa9bd271fddf77d35a55e2bd8582c1d3b0b8555f8e3215b02
Contents?: true
Size: 1.3 KB
Versions: 40
Compression:
Stored size: 1.3 KB
Contents
require 'helper' # we turn off the test for MRI 1.8 because our source_location hack # for C methods actually runs the methods - and since it runs ALL # methods (in an attempt to find a match) it runs 'exit' and aborts # the test, causing a failure. We should fix this in the future by # blacklisting certain methods for 1.8 MRI (such as exit, fork, and so on) unless Pry::Helpers::BaseHelpers.mri_18? 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) end
Version data entries
40 entries across 40 versions & 1 rubygems