I'm trying to test output from a command line tool. How do I 'fake' a command line call with rspec? Doing the following doesn't work: it "should call the command line and return 'text'" do @p = Pig.new @p.should_receive(:run).with('my_command_line_tool_call').and_return('result text') end How do I create that stub?
Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article? ã¯ããã« RSpecã¯é£ãããããããããªããã¨ãã£ãã³ã¡ã³ããã¨ãã©ãè¦ããã¾ãã 確ãã«ã¡ãã£ã¨ç¬ç¹ãªæ§æãæã£ã¦ãã¾ãããæ©è½ãçµæ§å¤ãã®ã§ãé£ããããã¨æãã¦ãã¾ãæ°æã¡ããããã¾ãã ï¼æ§æã«ã¤ãã¦ã¯åãæåè¦ãã¨ãã«ãããã£ããªããæ°æã¡ããã£ãã¨æã£ãè¨æ¶ãããã¾ãwï¼ ããããRSpecã«éããã©ããªãã¬ã¼ã ã¯ã¼ã¯ã§ãåãã§ãããæ £ãã¦ãã¾ãã°ã¹ã©ã¹ã©æ¸ãã¾ãããå®éåèªèº«ã¯ãRSpecã£ã¦ä¾¿å©ã ãªï¼ãã¨æããªãããã¹ãã³ã¼ããæ¸ãã¦ãã¾ãã ããã§ãã®è¨äºã§ã¯ãåãèãããæä½éããã ããæ¼ããã¦ããã°å¤§ä¸å¤«ï¼ï¼ããªR
ããã³ã¾ãã¯ãRuby ã«é¢ããæè¡è¨äºã¯ãã¡ããã®ãã¨ãRubyist ã¸ã®ã¤ã³ã¿ãã¥ã¼ãã¨ãã»ã¤ããã®ä»ããå±ãããã¦ã§ãéèªã§ãã Rubyist Magazine ã«ã¤ã㦠ãRubyist Magazineããç¥ãã¦ããã³ã¾ãã¯ãRubyist ã® Rubyist ã«ãããRubyist ã¨ããã§ãªã人ã®ããã®ã¦ã§ãéèªã§ãã ææ°å· Rubyist Magazine 0064 å· ããã¯ãã³ãã¼ Rubyist Magazine 0064 å· Rubyist Magazine 0063 å· Rubyist Magazine 0062 å· Kaigi on Rails ç¹éå· RubyKaigi Takeout 2020 ç¹éå· Rubyist Magazine 0061 å· Rubyist Magazine 0060 å· RubyKaigi 2019 ç´åç¹éå· Rubyist
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}