X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=spec%2Fmodels%2Fsheet_spec.rb;h=4cec7ed309589d7dec4af9bf0b266181888ea807;hb=d58f0139c17d55dfb5b1bcf8fc55073997554223;hp=20768233fb552296d553f1280dfc009f1d5166a7;hpb=4de70a43f48c9becfd180631289f7a4d480bb5b8;p=pettanr%2Fpettanr.git diff --git a/spec/models/sheet_spec.rb b/spec/models/sheet_spec.rb index 20768233..4cec7ed3 100644 --- a/spec/models/sheet_spec.rb +++ b/spec/models/sheet_spec.rb @@ -26,11 +26,15 @@ describe Sheet do context 'オーソドックスなデータのとき' do it '下限データが通る' do @sheet.caption = 'a' + @sheet.width = 1 + @sheet.height = 1 @sheet.visible = 0 @sheet.should be_valid end it '上限データが通る' do @sheet.caption = 'a'*100 + @sheet.width = 99999 + @sheet.height = 99999 @sheet.visible = 1 @sheet.should be_valid end @@ -46,6 +50,42 @@ describe Sheet do @sheet.should_not be_valid end end + context 'widthを検証するとき' do + it 'nullなら失敗する' do + @sheet.width = nil + @sheet.should_not be_valid + end + it '数値でなければ失敗する' do + @sheet.width = 'a' + @sheet.should_not be_valid + end + it '0なら失敗する' do + @sheet.width = '0' + @sheet.should_not be_valid + end + it '負でも失敗する' do + @sheet.width = -1 + @sheet.should_not be_valid + end + end + context 'heightを検証するとき' do + it 'nullなら失敗する' do + @sheet.height = nil + @sheet.should_not be_valid + end + it '数値でなければ失敗する' do + @sheet.height = 'a' + @sheet.should_not be_valid + end + it '0なら失敗する' do + @sheet.height = '0' + @sheet.should_not be_valid + end + it '負でも失敗する' do + @sheet.height = -1 + @sheet.should_not be_valid + end + end context 'visibleを検証するとき' do it 'nullなら失敗する' do @sheet.visible = nil