teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

各メソッドの説明

2016/11/09 00:41

投稿

hana-da
hana-da

スコア1728

answer CHANGED
@@ -57,4 +57,22 @@
57
57
 
58
58
  end
59
59
  ```
60
- config.afterは書いてないですね。
60
+ config.afterは書いてないですね。
61
+
62
+ ----
63
+
64
+ > Readmeをみると、start clean cleaningの3つが、書かれているのですが、どのように使いわけるのでしょうか。
65
+
66
+ READMEに書いてありますが。。。
67
+
68
+ startは
69
+
70
+ > Some strategies need to be started before tests are run (for example the :transaction strategy needs to know to open up a transaction). This can be accomplished by calling DatabaseCleaner.start at the beginning of the run, or by running the tests inside a block to Database.cleaning.
71
+
72
+ という事です。
73
+ strategies によっては事前処理が必要でそれを行うのが `DatabaseCleaner.start` です。
74
+
75
+ で実際に削除を行うのが `DatabaseCleaner.clean`
76
+
77
+ そんでもって `Database.cleaning` は block を実行する前に `DatabaseCleaner.start` して 終ったら `DatabaseCleaner.clean` してくれるそうです。
78
+