Sha256: cb520b203b59f61bd5c8bfbc5c75c7f4853ac85ac261a58d7e1f2bfdc1d50d7f
Contents?: true
Size: 855 Bytes
Versions: 39
Compression:
Stored size: 855 Bytes
Contents
class RespondToSpecs def self.bar 'done' end def undefed_method true end undef undefed_method def some_method :foo end end describe "Kernel.respond_to?" do it "indicates if a singleton object responds to a particular message" do RespondToSpecs.respond_to?(:bar).should == true RespondToSpecs.respond_to?(:baz).should == false end end describe "Kernel#respond_to?" do before :each do @a = RespondToSpecs.new end it "returns true if a method exists" do @a.respond_to?(:some_method).should be_true end it "indicates if an object responds to a message" do @a.respond_to?(:undefed_method).should be_false end it "returns false if a method exists, but is marked with a '$$stub' property" do `#{@a}.$some_method.$$stub = true` @a.respond_to?(:some_method).should be_false end end
Version data entries
39 entries across 39 versions & 3 rubygems