반응형
RSpec에서 IT 블록과 지정 블록의 차이점
RSpec에서 IT 블록과 지정 블록의 차이점은 무엇입니까?
subject { MovieList.add_new(10) }
specify { subject.should have(10).items }
it { subject.track_number.should == 10}
그들은 같은 일을하는 것 같습니다. 확실히 확인하는 것뿐입니다.
방법은 동일합니다 . 테스트 본문에 따라 사양을 영어로 더 잘 읽을 수 있도록 제공됩니다. 다음 두 가지를 고려하십시오.
describe Array do
describe "with 3 items" do
before { @arr = [1, 2, 3] }
specify { @arr.should_not be_empty }
specify { @arr.count.should eq(3) }
end
end
describe Array do
describe "with 3 items" do
subject { [1, 2, 3] }
it { should_not be_empty }
its(:count) { should eq(3) }
end
end
반응형
'your programing' 카테고리의 다른 글
RecyclerView.ViewHolder-getLayoutPosition 대 getAdapterPosition (0) | 2020.10.10 |
---|---|
`—` 또는`—` HTML 출력에 차이가 있습니까? (0) | 2020.10.10 |
Objective-C : 어설 션 vs. 예외 vs. 오류 (0) | 2020.10.10 |
내 유형 힌트에서 함수 유형을 어떻게 지정할 수 있습니까? (0) | 2020.10.10 |
setuptools : 패키지 데이터 폴더 위치 (0) | 2020.10.10 |