Sha256: d0cf36a4b6c040aa3d5aada4daf4f42f969ce83f41b9a05e0d0d4e4ce08ee5ca
Contents?: true
Size: 856 Bytes
Versions: 1
Compression:
Stored size: 856 Bytes
Contents
class RespondToSpecs def self.bar 'done' end def undefed_method true end undef undefed_method def some_method :foo end def 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}.$foo.$$stub = true` @a.respond_to?(:foo).should be_false end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opal-0.11.0.rc1 | spec/opal/core/kernel/respond_to_spec.rb |