ããã«æéãæãããã¹ãããããªã¨æã£ããã¡ã½ããã«sleepãå ¥ã£ã¦ã¾ããã ã¹ã¿ãåãããæ©ããªãããããªããã¨æã£ã¦èª¿ã¹ã¦ã¿ãã ãµã³ãã«ã³ã¼ã class User << ActiveRecord::Base def hoge sleep 5 true end end describe "hoge" do it "should be true" do user = User.new user.hoge.should be_true end end ãã¹ãå®è¡ rspec user_spec.rb . Finished in 5.01 seconds 1 exampel, 0 failures sleepã®5ç§ãã¡ããã¨ããã£ã¦ããã¾ãã æåã«èããã®ã¯ãsleepã¯Kernelã®ã¡ã½ããã ãã Kernel.stub(:sleep) ã§ãã¾ããããããã»ã»ã»ã¨æã£ããè¦äºåå¿ãªã
{{#tags}}- {{label}}
{{/tags}}