rspec
TDDã§éçºãã¦ãã人ã®ç®ä¸ã®æ©ã¿ã¯Slow teståé¡ãããªãã¡ãã¹ãã®å®è¡æéããããããã¦è¾ããã¨ããåé¡ã§ãã ãããµã¨æãã¨ããããã£ã¦ã次ã®ãããªã¿ã¹ã¯ãå®ç¾©ãã¦ãããããªãã¨ãããã¨ã§ããããåçã«æ©ããªã£ãã§ã¯ããã¾ãããã namespaceâ¦
Akabane.rbã¨ããã£ã¦ã¿ããä»æ¥ãã®é ã§ããåæã®9:00AMããã¾ãã¾ãå±ã¨ãã§ãã¾ãç§èªèº«ã¯ã ãã¶å ã¾ã§åæ¥ã®ãã¤ã«ã¯æ¯æ¸ãã¦ããã§ããã©ãããã¯ããã¨ãRSpecã®å ¨Example(it)ãCucumberã®ãã¹ã¦ã®ã·ããªãªã§åå¾å¦çãããããªããã¨ã¯ããã¾ããã?â¦
ãç¡æ²æ±°ãã¦ã¾ãã èãã¦ã¿ãã°ãã2ã¶æå¼±æ¸ãã¦ãªãã£ããã§ããããã¿ã¾ãããããããããã¾ãããå æ°ã§ãã ä¹ ãã¶ãã®æ¥è¨ã§ã¢ã¬ã§ããã宣ä¼ã§ããæ¥ã7/7ã®ãªãã¸ã§ã¯ãå¶æ¥½é¨2009å¤ã¤ãã³ãã®è¥äººãã©ãã¯ã§è©±ãæéããããã¾ãã(ããããã§ãâ¦
æ¬æ¥ãããã®ã§æçã«ãã¡ããã¡ããå¤ãã£ã¦ããã®ã§ã¯ã¾ã£ããã¤ã³ããã rspec-rails 1.2.2 ã«ã¼ãã£ã³ã°å¨ãã®exampleã®æ¸ãæ¹ãå¤ãã£ã¦ãããroutes_for(url_params)ã®ã»ã idãªãããStringã§æå®ããå¿ è¦ãã it "should map #show in rspec-rails 1â¦
ä»äºã§ä½ã£ã¦ããRailsã¢ããªã«Cucumberãçªã£è¾¼ãã§ã¿ã¾ãããããã¯ç±ããããããååãã客ããã«è¦ãã¦åãã£ã¦ããããæ°ããã¾ãããã¶ãããã¡ããæºåã¯å¿ è¦ã ããåãå ¥ãä»æ§ããã¹ã¦ã客ããã«æ¸ãã¦ãããã¨ããã®ã¯é£ããã§ããã©*1ãã¨ãããâ¦
æ¨æ¥ã¯ãªãã¸ã§ã¯ãå¶æ¥½é¨ã¯ãªã¹ãã¹ã¤ãã³ã2007ã«ã¹ã¿ããã¨ãã¦åå ãã¦ãã¾ããã ä»åã¯ããªãã¸ã§ã¯ãæåãã«å帰ãããã¨ããä¼ã§ãããããã¨é¢ç½ãè¦ç¹ãå¾ããã¨ãã§ãã¾ãããã¹ãã¼ã«ã¼ã®æ¹ã ããæ¬å½ã«ãããã¨ããããã¾ãããã¾ããhighly mâ¦
èªåã§ããããããã¦ãã®ã§ããã³ãå¸æãèãã ããå è¨äº : http://techon.nikkeibp.co.jp/article/TOPCOL/20070806/137518/TDDãç´¹ä»ããã¨ãã«ããTDDã§ã¯ãããã¯ãã³ã¼ãã®åã«ãã¹ããæ¸ããã¨ããç´¹ä»ã®ãããããå¤ããã§ãããããã¯ã¡ãã£ã¨èª¤è§£â¦
ä»å¹´ã®åæ¬ã«ãªãªã¼ã¹ããã¦ä»¥æ¥ããããããã¼ã¸ã§ã³ã¢ãããéãã¦ãã@nifty TimeLineã§ãããæ¬æ¥ã®ãã¼ã¸ã§ã³ã¢ããã§WebAPIãå ¬éããã¾ããããã§ããã ãã¬ã¹ãªãªã¼ã¹(http://www.nifty.co.jp/cs/07kami/detail/070808003265/1.htm) @niftyã¦ã§ããµâ¦
RSpecã¯é·ãã0.Xãªãªã¼ã¹ãç¶ãã¦ãããAPIã®å¤æ´ããªããã¦ãã¾ããããããã2007/5/19ã«æ£å¼ããªã¼ã¹ã§ãã1.0.0ãå ¬éãããç¾å¨ã§ã¯ãã®ãã¼ã¸ã§ã³ãæ´»çºã«ã¡ã³ããã³ã¹ããã¦ãã¾ãã æ©è½ã®è¿½å ã¯ãã¡ããããã°ä¿®æ£ãå¤ãè¡ããã¦ãããã¾ãRSpecã®â¦
ä¾ã«ãã£ã¦Railsåå¼·ä¼ã§RSpecã®è©±ãããã®ã§ãããããã§ãRSpecã«ãã£ã¦ã¢ãã«ã¨ãã¥ã¼ã¨ã³ã³ããã¼ã©ã®ãã¹ããåé¢ãããã¨ã«ãããããããè¨è¨ããã©ã¤ããããã§ã!ï¼ããªã©ã¨ãã¡ãã£ã¨æªãããªãã¨ãå£èµ°ã£ã¦ãã¾ãã¾ããã ãã¹ããåé¢ããã¨ããâ¦
RSpec 1.0 ãªãªã¼ã¹è¨å¿µã¨ãããã¨ã§ãã¡ãã£ã¨æ¬è °ãå ¥ãã¦ã½ã¼ã¹ãããã§ã¿ã¾ããããå¤å´ããèªããã¨ããã¿ã¤ãã«ã©ãããspecã³ãã³ãããèµ·åãããã·ã¼ã±ã³ã¹ã«æ²¿ã£ã¦èªãã§ãããã¨æãã¾ããèªã spec ã¯ãããªã®ã # written in array_spec.rb desâ¦
http://rspec.rubyforge.org/ããï¼è©³ç´°ã¯ã¡ããã©ææ¥ãRailsåå¼·ä¼ãããã®ã§ãããã§æ å ±äº¤æãããããªãã¨æã£ã¦ã¾ããChangelogã¯ãã¡ãããã http://rubyforge.org/frs/shownotes.php?release_id=11800
æè¿ã¯ä¸»ã« 0.8.x ã使ã£ã¦ãã å¤ã£ãããã¨ãã話ã¯èãã¤ã¤ãã¨ãããã 0.8.x ã§ä¸ä¾¿ãæãã¦ããªãã£ãã®ã§(äºææ§ããã)ã§æµãã¦ã Railsåå¼·ä¼@æ±äº¬ã®Wikiã§Yuguiããããå¤ããããwwwwã ã©ãã©ããã¨è¦ã¦ã¿ã¦å´ãã â ãã¾ãã
ããããªãµã³ãã«ã«å¯¾ãã¦ãå ¨é¨ã®ãã¼ã¿/ãã¿ã¼ã³ã§ã¡ããã¨å¦çã§ãã¦ããããæ¤è¨¼ããããã¨ããå ´åãRSpecã ã¨æ¸ãè¾ããªããã¨æã£ããã§ãããè¯ãèããã°ä½ã®ãã¨ã¯ãªããspecãã¡ã¤ã«ãæ®éã®Rubyã¹ã¯ãªãããªãã§ããããã¨ãããã㧠# xxx_specâ¦
ããã¿ããã® http://d.hatena.ne.jp/walf443/20070324/1174702913 ã®è¨äºã®è£è¶³ãæè¿ã®ãã¼ã¸ã§ã³ã§ã¯ Matchers ãèªåã§è¿½å ã㦠should ã®ãã¨ã«æ¸ããèªãå¢ããã¾ããã¨ããããããå®ç¾ããããã« should ã¨ãããåãããããã·ã«åé¢ãããã®è³å¦ãâ¦
ææ¸ç±ã®å·çãã¡ããã¨ãããã¨åéããã®ã§ããããããªã®ã§ãªã¼ããã¾ãããï¼æç²ã ä¸ã«ããã»ã©ä¿¡ä»°ãé«ã¾ã£ã¦ãã¾ããããã¡ããç¾ä¸å©çãåé¢ã«åºãã¦ã¿ã¾ãããæ ¡æ£åã¨ã¯ããå å稿ã®æç²ãªã®ã§ãã¬ãã¥ã¼&çªã£è¾¼ã¿(ããã¯å¬ããã®ï¼ã¨ã)大æè¿â¦
Yugui ããã®ãRSpecã«ãããã³ã³ããã¹ããã¾ããå ±éé¨åããé¢ç½ãã®ã§ç§ã Tips ããã³ã³ããã¼ã©ã«ãã£ã«ã¿*1ãããããæ¸ãã¦ããã¨ããã¹ãããå ´åã«äºåæºåããããããã©ããããªã(ã¦ã¼ã¶ Foo ã§ãã°ã¤ã³ãã¦ãªããã¤ã±ãã¤ãã¨ããªãã¨ã)ãã§â¦
http://rucila.s43.xrea.com/memo/?date=20070206#p02 ããç®æã§ãããä¾å¤ããããã㨠㨠ãã®ä¾å¤ã®ç¶æ ã xxx ã§ããã㨠ã¯ããããå¥ã®æ¤æ»é ç®ã ã£ãããããããããªãã®ã§ãããããã¨ãã¯contextãåããã®ãè¯ãããããªãããªããã¨æãã¾ãããâ¦
ç§çã¡ã¢ã Rails 1.2.x ã§å°å ¥ããã assert_select 㯠response ã«å«ã¾ããã¨ã¬ã¡ã³ãã CSS å½¢å¼ã§æå®ã§ããã¨ããããããã®ã ã§ãRSpec on Rails ãããã¾ã API ãä¸å®å®*1ãªããã使ãããã§ããããã® API ãã¾ãå¤ããã¾ããã(r1399:r1419 ã®ã©â¦
ã³ã©ãã¬ã¼ã¿ãå¤ã㦠fake ããã®ãããã¸ãã ã£ããã©ãä¸è¨ã§ããã¾ããã¨ããã¡ã¢ã ç¡çç¢çæãé«ãã setup do controller = ApplicationController.new controller.stub!(:params).and_return(:page => 1) assigns[:user_pages], assigns[:users] = â¦
ã©ã¡ãã Dave Astel ã«ãããè±èªã§ããããããããè¦ãã§ãã RSpec ã®cheat sheet http://blog.daveastels.com/articles/2006/09/09/rspec-cheat-sheet ä»æ¥è¦ä»ãããã§ãããåºæ¬çãªä½¿ããããä¹ã£ã¦ãã®ã§ããæãã§ããå æ¥ã®ç§ã®ã¨ã³ããªããããâ¦
å é±æ°ã¥ãã¦ããã°ãã£ã¨æ¥½ã«ã§ããã®ã«ã軽ãã¯ã¾ã£ãã¨ããã®è§£æ±ºæ³ã¯ãã§ã«æ¬å®¶ããã¥ã¡ã³ãã«ããã¾ãããããã¿ã¾ããï¼ãã¹ context "循ç°å°æ° (1 / 3.0) ã®specãæ¸ãå ´å" do specify "0.33 ã«è¿ãã誤差㯠0.004 以ä¸ã§ãããã¨" do ( 1 / 3.0 ).sâ¦
å¹´æ«å¹´å§ã«ã¹ã©ã¤ããä½ããã¨æã£ã¦æ«æãã¾ãããRSpec ã®ãã¹ãã³ã¼ãã¯è¦æ £ããªã "should" ãªãããåºã¦ãã¦é£ãããã«è¦ãã¾ãããå®ã¯è¦ããªãããããªãã®ã¯ 4ã¤ç¨ã®èªå½ã ãã§ãã*1 Object#should_xxx [args] Object#should_have(n).items Object#â¦
èé«åå°çã«ä½æã function! Rspec () let rails_spec_pat = '\
ã¾ãã¯ãã¡ããã http://idm.s9.xrea.com/ratio/2006/11/21/000549.htmlãªããããããã£ãããã¾ãããDevelopment ã Drive ããããã®ãã¹ãã«ã¤ãã¦ã¯ãã£ããåæããã ã®é³ãã§ãªããããããã¨ãRailsåå¼·ä¼ã§åºãé»è²ã®è©±ãã¡ãã£ã¨ææããã¨ãéâ¦
RSpec ã«ä»ãã¦è©±ããã¦ããã¨ã³ããªãææããããªã£ãã®ã§ã¯ã¦ãªãã¼ã¯ã¼ããä½ã£ã¦ã¿ã¾ããããªãã»ã©ããããã¨ãã«ä½¿ãã°ããã®ã>ãã¼ã¯ã¼ãä½æã ã¾ã ã¾ã ãããããã¨ã¯æ¸ãã¦ããã¾ãããããã ã¦ãã£ã¦ãã ãããhttp://d.hatena.ne.jp/keyword/Râ¦