â æ¦è¦ (æ¿ããæ¢åºæããã§ãããã)ä½å¹´ãrailsãã£ã¦ã¾ãããæ£ããç解ã§ãã¦ããªãã£ãäºã®ä¸ã¤ã« rake spec(test)ããã¨ãå¦çã®ä¸ç°ã¨ãã¦db:test:prepareã¿ã¹ã¯ãå¼ã³åºã ã¨ããæåãããã¾ãã é常åé¡ã«ãªããªãã®ã§ãããdb:test:prepareããdb/schema.rbã®æ å ±ãå ã«ãã¼ã¿ã¼ãã¼ã¹ãä½æããçºãrailsãèªèã§ããªããããªé ç®ã¯æãã¦è½ã¡ã¦ãã¾ãã¾ãã é¢æ°é©ç¨ããã¤ã³ããã¯ã¹ ããªã¬ã¼ããã¡ã³ã¯ã·ã§ã³ å¥ã¹ãã¼ãã«ä½ã£ããªãã¸ã§ã¯ã ...etc ãªã®ã§ RAILS_ENV=test rake db:drop RAILS_ENV=test rake db:create RAILS_ENV=test rake db:migrate ãã¦ããrake specããäºãåæã«ãdb:test:prepareãå¼ã³åºããã«specã
Testing Rake tasks is one of the most painful things I do as a Ruby developer. Even after extracting all the code out into a separate class (which helps a lot), I still want to make sure I test that the right classes got called correctly with the right arguments. I wanted the subject to be the task, where I could call invoke, check its prerequisites, etc. describe "cron:hourly" do its(:prerequisit
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}