回答編集履歴

1

各メソッドの説明

2016/11/09 00:41

投稿

hana-da
hana-da

スコア1728

test CHANGED
@@ -117,3 +117,41 @@
117
117
  ```
118
118
 
119
119
  config.afterは書いてないですね。
120
+
121
+
122
+
123
+ ----
124
+
125
+
126
+
127
+ > Readmeをみると、start clean cleaningの3つが、書かれているのですが、どのように使いわけるのでしょうか。
128
+
129
+
130
+
131
+ READMEに書いてありますが。。。
132
+
133
+
134
+
135
+ startは
136
+
137
+
138
+
139
+ > 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.
140
+
141
+
142
+
143
+ という事です。
144
+
145
+ strategies によっては事前処理が必要でそれを行うのが `DatabaseCleaner.start` です。
146
+
147
+
148
+
149
+ で実際に削除を行うのが `DatabaseCleaner.clean`
150
+
151
+
152
+
153
+ そんでもって `Database.cleaning` は block を実行する前に `DatabaseCleaner.start` して 終ったら `DatabaseCleaner.clean` してくれるそうです。
154
+
155
+
156
+
157
+