ä»åæ¸ããRSpecã®ãã¿ã¼ã³
ã¾ã RSpecåå¿è ãªã®ã§æ¥ããããã§ãããä»åã®ããã¸ã§ã¯ãã§æ¸ããã¢ãã«ã®RSpecã®ãã¼ã¿ã³ããããã¦ããã¾ãã
å ·ä½çã«ã©ããªRSpecãæ¸ããã¦ããã®ãã¨ããæ å ±ã¯ãããä¸ã«å°ãªãã¨æãã¾ãã®ã§ã»ã»ã»
èè ã®æ¹ã®æè¦ãå¾ ã£ã¦ã¾ã ^^)
describe XXXX, "ãã¼ãã«ã®é¢é£ã¯" do fixtures :xxxxs, :yyyys, :zzzzs it "yyyysãææ" do .... end it "zzzzsã«ä¾å" do .... end .... end describe XXXX, "ã®å ¥åãã§ãã¯ã¯" do it "nameã¯å¿ é é ç®" do .... end it "nameã¯ã¦ãã¼ã¯" do ... end .... end describe XXXXX do fixtures :xxxxs it "å°ããªæ©è½ (1)" do .... end it "å°ããªæ©è½ (2)" do .... end describe "大ããªæ©è½(1)" do it "ä»æ§ (1)" do .... end it "ä»æ§ (2)" do .... end .... end
æåã® describe ã¯ãã¼ãã«ã®é¢é£ã®ã¹ããã¯(ãã¹ã)ã§ãããããããã¹ãããã»ã©ã®äºããªãå ´åãå¤ãã¨ã¯æãã¾ãããç§ã®å ´åï¼ã«æã§ç¶´ããã¹ãçºè¦ããã¾ãã ^^;
ã¾ãã¹ããã¯ã ã¨èããã¨ããã²ã¨ããã¼ãã«ã®é¢é£ã®è¨è¿°ã¯æ¬²ããã§ãããã
ï¼çªç®ã® describe 㯠Varidator ã®ã¹ããã¯(ãã¹ã)ã§ãã
ï¼çªç®ã® describe 㯠Model ã«ä»å ããã¡ã½ããã®ã¹ããã¯(ãã¹ã)ã§ããããå°ããªãã®(前のブログã«æ¸ããããã«ãã¸ãã¯çãªãã®ã¯å ¨ã¦ã¢ãã«çã«æ¸ããã®ã§ãå°ããªã¡ã½ãããããªãããã¾ã)ã¯ç´ä¸ã« it "ä»æ§ã»ã»ã»" ã§æ¸ãã¾ããã
ããã¦ãè¨è¿°ãè¤æ°ãããããªã大ããªã¡ã½ãã㯠describe ããã¹ãããã¦æ©è½ãæ¯ã« describe ãæ¸ãããã«ãã¾ããã
æåã®å ã¯ãdescribe ããã¹ãåºæ¥ãäºãå¿ãã¦ãã¦ã大ããªã¡ã½ããããã¹ãããã«æ¸ãã¦ããã®ã§ãããéä¸ãããã®ã¹ã¿ã¤ã«ã§æ¸ãããã«ãã¾ããã
ã¾ã ã¾ã ç§èªèº«ã§ãããã ã¨ããã¹ã¿ã¤ã«ã«æã£ã¦ããããã§ã¯ããã¾ãããã¾ã ã¾ã å¤ãã£ã¦è¡ãã¨æãã¾ã ^^)