0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

個人メモ Rspec の基礎役割

Posted at

○基本構文 describe/it/expect

・describe
Describeには、テストのグループ化を宣言する

〇〇に関するテストをするよーというイメージ

・it
Itはテストをexampleという単位にまとめる役割をする
It do … endの中のexpectation(期待値とっ実際の値の比較)が全てpassしれば、そのexampleはパスしたことになる

・expect
expect(X).to eq Yで記述するのがエクスペクテーション
読み方は、「XがYに等しくなることを期待する」と読める

expect(1 + 2).to eq 3 は「1 + 2 が 3 になることを期待する」テスト

※to eqの部分はマッチャ(抹茶かな?)と呼ばれる

0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?