DonutWorks / Ari

0 stars 0 forks source link

expect { model.save! }.not_to raise_error 를 expect(model).to be_valid 로 바꾸기 #335

Closed shaynekang closed 9 years ago

shaynekang commented 9 years ago

이 코멘트에서도 잠시 이야기했지만, 모델의 데이터 검증(Validation) 체크는 not_to raise_error보다 to be_valid가 더 간결하고 좋습니다.

it "should update when inputted TO is greater than the number of responsed go" do
  @to_notice.to = 2
  expect { @to_notice.save! }.not_to raise_error
end

는 다음과 같이 고칠 수 있겠죠.

it "should update when inputted TO is greater than the number of responsed go" do
  @to_notice.to = 2
  expect(@to_notice).to be_valid
end

다른 코드들도 동일하게 수정하면 좋겠습니다. ㅎㅎ