Mock Object Mock Objectã®ä½æ my_mock = mock(<name>) my_mock = mock(<name>, <options>) person = mock('person', :null_object => true) Mockã¯ååãå¼æ°ã«åããä»æ§ã®æ¤è¨¼ãçµãã£ãéã«å ¨ã¦ã®Mockãæ¤è¨¼ãããã optionå¼æ°ãããã·ã¥ã§ä¸ãããã¨ã§Mockã®æ¯ãèãã調æ´ã§ãããç¾å¨ã:null_objectã®ã¿ããµãã¼ãããã¦ããã:null_object => trueãå¼æ°ã«æ¸¡ãã¨Mockã«å¯¾ããå ¨ã¦ã®ã¡ã½ãããMockèªèº«ãè¿ãããã«ãªãã Mockã«å¯¾ãã¦ã¹ã¿ãã¡ã½ãããå®ç¾©ãã person.should_receive(:name) # person.name => nil person.should_not_receive(:name) #
{{#tags}}- {{label}}
{{/tags}}