Rspec 基本

Rspecについて

 

セットアップ
.rspec
--require spec_helper
--format documentation

 

 

describe "何についてのテストか" do
  context "どの状態のテストか" do
    it "期待する動作" do

    end
  end
end

このような形でネストして書くことがデフォルトの形。
beforeをdescribeやcontextの中に書くと前提条件を記載するような形になり、itが実行される前に毎回beforeが実行される。