Sha256: e4f14b0f43e73dddcde9a701a5ab3f9c120836d417e160bef9c15fb9e48ebaf8
Contents?: true
Size: 1.03 KB
Versions: 6
Compression:
Stored size: 1.03 KB
Contents
require 'spec_helper' require 'mspec/guards' require 'mspec/helpers' describe Object, "#responds_to" do it "returns true for specified symbols" do obj = mock("obj") obj.responds_to(:to_flo) obj.should respond_to(:to_flo) obj.should respond_to(:to_s) end end describe Object, "#does_not_respond_to" do it "returns false for specified symbols" do obj = mock("obj") obj.does_not_respond_to(:to_s) obj.should_not respond_to(:to_s) end end describe Object, "#undefine" do it "undefines the method" do # cannot use a mock here because of the way RSpec handles method_missing obj = Object.new obj.undefine(:to_s) lambda { obj.send :to_s }.should raise_error(NoMethodError) end end describe Object, "#fake!" do before :each do @obj = mock("obj") end it "makes the object respond to the message" do @obj.fake!(:to_flo) @obj.should respond_to(:to_flo) end it "returns the value when the obj is sent the message" do @obj.fake!(:to_flo, 1.2) @obj.to_flo.should == 1.2 end end
Version data entries
6 entries across 6 versions & 1 rubygems