Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
æè¡é¨ã¢ã«ãã¤ãã®é´æ¨(@draftcode)ã§ãã ã¯ãã¯ããããå é¨åãã«éçºã»éç¨ãè¡ã£ã¦ãããåæ£ãã¹ãå®è¡ã·ã¹ãã RRRSpecããªã¼ãã³ã½ã¼ã¹ã¨ãã¦å ¬éãã¾ãããRRRSpecã¯æéã®ãããèªåãã¹ããåæ£å¦çãããã¨ã§ãå ¨ä½ã®ãã¹ãæéã®ç縮ãçãã¢ããªã±ã¼ã·ã§ã³ã§ããç¾å¨ã¯ãã¯ãããã§ã¯17000ãè¶ ãããã¹ãé ç®ãããããã·ã³ä¸å°ã§ãã¹ããå®è¡ããã¨å®äºã¾ã§æ°æéãããã¾ãããã®ãã¹ãã60並åç¨åº¦ã®åæ£å¦çã§è¡ããã¨ã§ãå¹³å8åãã9åç¨åº¦ã§å®äºã§ããããã«ãªãã¾ãããã¾ããAmazon EC2ã®ã¹ãããã¤ã³ã¹ã¿ã³ã¹ãå©ç¨ãããã¨ã«ãããå¤§å¹ ãªã³ã¹ãåæ¸ãåæã«éæãã¾ããã https://github.com/cookpad/rrrspec åæ£ãã¹ãå®è¡ã¨ã¯ ã¢ããªã±ã¼ã·ã§ã³ã大ãããªãã«ã¤ãã¦ãèªåãã¹ãã®æ°ã大ãããªã£ã¦ããã¾ããã¯ãã¯ãããã§ã¯ãé常ã«å¤ãã®
2012å¹´04æ19æ¥ æè¿ãæ°äººã®ãã¹ãã³ã¼ããè¦ãæ©ä¼ããããã¦ããããã¹ãã®æ¸ãæ¹ã«ã¤ãã¦èããæ©ä¼ããã£ããã¦ããããã¹ãã¯ãã³ãã¬ã¼ãã¿ãããªãã®ãããã®ã§ãããããæ¼ãããã°ã誰ã§ãç°¡åã«æ¸ããã¨ãã§ããã ããã§ã¯ããã®æ¹æ³ã«ã¤ãã¦ç´¹ä»ãããããµã³ãã«ã¯RSpecã§æ¸ããããã®ä»ã®ã¦ããããã¹ããã¬ã¼ã ã¯ã¼ã¯ã§ããå¿ç¨ãã§ããã¨ãããã ã¯ããã«ããåç´åããã¨ããã¹ã対象ã¯ç¶æ ãæã¡ãå ¥åãä¸ããã¨ä½ããã®åºåãè¡ãªããã®ã§ãããå ¥åãå¤ããã°åºåã¯å¤åããããç¶æ ãå¤åããã¨å ¥åãåãã§ãåºåãå¤ããï¼ãããããªãï¼ã ã¦ããããã¹ãã¯ããã¹ã対象ã®ç¶æ ãæä½ããä¸ããå ¥åã«ãã£ã¦æå³éãã®åºåãå¾ããããã確èªããä½æ¥ã®ãã¨ãããããªã®ã§ãã¦ããããã¹ããæ¸ãã¨ãã«ã¯ããªãã¸ã§ã¯ãã®ç¶æ ãã¨ã«ã¡ã½ããåä½ã§å ¥åã¨åºåã確èªããããã«ããã RSpecã®çä¼¼ã³ã¼ãã§æ¸ãã¨
ð° ç®æ¬¡(1)RSpec ã¯ããã®ä¸æ© (2)stackã¯ã©ã¹ã¨stackã¯ã©ã¹ã®Rspec (3) before/after (4) matcherï¼ãããã£ï¼ (5) ã«ã¹ã¿ã ããã㣠(6) ãµã³ãã«ã½ã¼ã¹(GitHub) ð (1)RSpecã¯ããã®ä¸æ©we use RSpec to #describe Behaviour of a system using Examples of how #it should work. ã#itãã©ã®ããã«workãããããä¾ã«ãã¦ãã·ã¹ãã ã® æ¯ãèã(åä½)ã説æããããã«RSpecã使ã From [Ruby][Rails] RSpec ããã£ã¨ç解ãããã£ãã®ã§ãã¾ã¨ããä½ãã¾ãã RSpecã®å°å ¥ã®èª¬æã«ã¯ä¸çªããããã¾ãï¼ ð (2)stackã¯ã©ã¹ã¨stackã¯ã©ã¹ã®RSpec次ã®stackã¯ã©ã¹ããã¹ã対象ã¨ãã¾ãã cl
Puppet ã Chef ã§æ§ç¯ãããµã¼ãã RSpec ã§ãã¹ããã ã§æ¸ããä»çµã¿ã使ããããããããã« serverspec ã¨ããåå㧠gem åãã¦ã¿ãã rubygems.org ã«ãç»é²ãã¦ããã®ã§ãgem install ã§ã¤ã³ã¹ãã¼ã«ã§ããã $ gem install serverspec ã¤ã³ã¹ãã¼ã«ããããé©å½ãªãã£ã¬ã¯ããªã§ serverspec-init ãå®è¡ãããã¨ãéå½¢ã¨ãªããã£ã¬ã¯ããªããã¡ã¤ã«ãçæããã $ serverspec-init + spec/ + spec/www.example.jp/ + spec/www.example.jp/httpd_spec.rb + spec/spec_helper.rb + Rakefile spec/www.example.jp/httpd_spec.rb ããµã³ãã«ãã¹ãã³ã¼ãã§ããããªæãã«ãªã£ã¦
ã¹ã©ã¤ãã SpeakerDeck ã«ä¸ãã¾ããã
ç¶ç¶çã¤ã³ãã°ã¬ã¼ã·ã§ã³ ç¶ç¶çã¤ã³ãã°ã¬ã¼ã·ã§ã³ãã¼ã«ã¨ã¯ããã¼ã¸ã§ã³ç®¡çã·ã¹ãã ã«ããææ°ã½ã¼ã¹ãå®æçã«åå¾ãã¦ãã«ãããã³ãã¹ããå®è¡ãããã¹ãçµæãåºåãããã®ã§ãï¼åèï¼ãç¶ç¶çã«ãã¹ããè¡ããã¨ã§ãã·ã¹ãã å ¨ä½ã®å質æ¹åãæå¾ ãããçµ±åã«ä¼´ãåé¡ãæ¸ãããã¨ãã§ãã¾ããããã§ã¯ä»£è¡¨çãªãã¼ã«ã§ããJenkinsã使ã£ã¦ãRSpecã®ãã¹ãã³ã¼ããå®æçã«å®è¡ããããã®è¨å®æ¹æ³ã¨çµæ表示ãç´¹ä»ããç¶ç¶çã¤ã³ãã°ã¬ã¼ã·ã§ã³ã®æ¦è¦ã説æãã¾ãã 以ä¸ã®æ¡ä»¶ãåæã¨ãã¾ãã ã»Ruby1.9.3 ã»Rails2.3.1 ã»RSpec2.8.0 ã»Subversionã«ããã³ã¼ã管ç 1.対象ã¨ããã¢ããªã±ã¼ã·ã§ã³ã®æºå æ¢ã«RSpecã®ãã¹ãã³ã¼ããå«ã¾ããã¢ããªã±ã¼ã·ã§ã³ãããã°ããã®ã»ã¯ã·ã§ã³ãã¹ããããã¦ãæ§ãã¾ããããJenkinsã§Ruby1.9ç³»ãç¨ãã¦ã«ãã¬ã¼ã¸ãåå¾ã
ååã¯ã¤ã³ãã°ã¬ã¼ã·ã§ã³ãã¹ãã¨ãã¦Cucumberã§ãã¹ããä½æãã¾ãããä»åã¯ã¦ããããã¹ãã¨ãã¦ãRSpecã使ã£ã¦ã³ã³ããã¼ã©ã®ãã¹ããä½æãã¾ã ååã¯ã¤ã³ãã°ã¬ã¼ã·ã§ã³ãã¹ãã¨ãã¦Cucumberã§ãã¹ããä½æãã¾ãããä»åã¯ã¦ããããã¹ãã¨ãã¦RSpecã使ã£ã¦ã³ã³ããã¼ã©ã®ãã¹ãï¼RSpecã®ãã¹ãã³ã¼ãã¯âã¹ããã¯âã¨å¼ã°ããã®ã§ã以éã¯ã¹ããã¯ã¨å¼ã³ã¾ãï¼ãä½æãã¾ããæ¬ç¨¿ã§ç´¹ä»ããã¹ããã¯ã®å ¨æã¯GitHubä¸ã«ããã¾ãã æåã«ãã³ã¼ãã¬ãã¥ã¼ã®åã§è¿°ã¹ãã³ã³ããã¼ã©ã®å½¹å²ã«ã¤ãã¦ããä¸åº¦ãããããã¦ã¿ã¾ãããã ã³ã³ããã¼ã©ã¯å¤é¨ããæ¥ããªã¯ã¨ã¹ããåãä»ããã¬ã¹ãã³ã¹ãè¿ãã®ãå½¹å²ã§ããå ·ä½çã«ã¯ä»¥ä¸ã®3ã¤ã®åä½ããããªãã¾ãã é©åãªãªãã¸ã§ã¯ããã¨ã£ã¦ãã ãªãã¸ã§ã¯ãã«å¯¾ããä½ããã®æä½ãæ示ãã æä½ãæåããéã¨å¤±æããéã®ãã¥ã¼ã®æ¯ãèããæå®ãã
åç° å人(@t_wada) ä½ãRSpec ã®å ¥éã¨ãã®ä¸æ©å ã¸ãã¯ã¯ãªã¨ã¤ãã£ãã»ã³ã¢ã³ãº 表示 - ç¶æ¿ 4.0 å½é ã©ã¤ã»ã³ã¹ã§æä¾ããã¦ãã¾ãã æ±äº¬ Ruby ä¼è° 03 ã® RSpec ã¯ã¼ã¯ã·ã§ããã®è³æã§ãããã®ã¯ã¼ã¯ã·ã§ããã§ã¯åå è ã®æ¹ã«ãåçµã(ã³ã¼ããæ¸ãåããã¨)ããã¦è²°ããTDD/BDD 㨠RSpec ãåæã«å¦ã¹ãããã«é½åº¦èª¬æãå ¥ããããã¡ã§è¡ãã¾ããã 第2ã¤ãã¬ã¼ã·ã§ã³ãæ¸ãã¾ãããç¶ãã«èå³ããæ¹ã¯ã覧ä¸ãã (æ´æ°) 第3ã¤ãã¬ã¼ã·ã§ã³ãæ¸ãã¾ãããç¶ãã«èå³ããæ¹ã¯ã覧ä¸ãã 1st iteration favotter ã® ã¿ãã㪠NG ã¯ã¼ãã®ãã£ã«ã¿ãªã³ã°æ©è½ã RSpec ã§ä½ãã¾ããããã¾ã㯠NG ã¯ã¼ãã®æ¤åºæ©è½ãä½æãã¾ãã ãã®ã¤ãã¬ã¼ã·ã§ã³ã§ã¯æåãã¿ãªå½¢ã®ãã¹ãã³ã¼ãã¨å®è£ ãæ¸ããã ãã ãã¨ãã®ã³ã¼ããæ´ç·´ããã¦ããã¾
ç§ãRSpec使ã£ã¦ãã¹ãæ¸ãæã¯ãããªæãã§æ¸ãã¦ãããã£ã¦ã®ãæ¸ãã¦ã¿ãã*1 ãã¹ããæ¸ãé çªã«ã¤ã㦠TDDã§ã³ã¼ããæ¸ãå ´åãå ã«ãã¹ããæ¸ãäºã«ãªãã¾ãã ããã¦ããã®ãã¹ããæ¸ãé çªã§ãããç§ã¯ä¸è¨ã®ãããªé çªã§æ¸ãããã«æèãã¦ãã¾ãã è¨è¨ãã describe ãæ¸ã itãæ¸ã subjectãæ確ã«ãã before(context)ãæ確ã«ãã ãã®ä»ã«ãæ°ãã¤ãã¦ããç¹ã¯ãããªæã å¥ã®ã¡ã½ããå¼ã¶æã¯åºæ¬çã«stubãªã©ã§æ½°ã contextã¯ããã®å ´åããit ã¯ããã§ãããã¨ãã«ãªãããã«ãã ä¸ã¤ãã¤ã詳細ãæ¸ãã¾ãã è¨è¨ãã ãã¹ããæ¸ãå§ããåã«ãã¾ãå®è£ ãããã¨ãã¦ãã¯ã©ã¹ãã¡ã½ãããç°¡åã«è¨è¨ãã¾ãã å°ãªãã¨ãããã¯ã©ã¹åããã¯ã©ã¹ã¡ã½ãã or ã¤ã³ã¹ã¿ã³ã¹ã¡ã½ããããã¡ã½ããåããã¡ã½ããã®æ»ãå¤ããããã¯æ±ºãã¾ãã describe ã
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}