LoginSignup
1
0

More than 5 years have passed since last update.

Rspec beforeブロックの使い方

Posted at

• before(:each)
describe または context ブロック内の 各テストの前に実行される。
before(:example), before も同じ意味になる。もしブロック内に4つのテストがあれば、before のコードも4回実行される。

テストごとに実行され、他のテストの状況を受けづらいので基本はこれを使う。

• before(:all)
describe または context ブロック内の 全テストの前に一回だけ実行される。before(:context) も同じ意味になる。before のコードは一回だけ実行され、それから4つのテストが実行される。

• before(:suite) はテストスイート全体の全ファイルを実行する前に実行される。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0