r = @rp.store_picture_with_gif @imager\r
r.should be_false\r
end\r
+ it '全体エラーメッセージがセットされている' do\r
+ lambda {\r
+ r = @rp.store_picture_with_gif @imager\r
+ }.should change(@rp.errors[:base], :count)\r
+ end\r
it 'gif変換判定は呼ばれていない' do\r
ResourcePicture.any_instance.should_not_receive(:to_gif?).with(any_args)\r
r = @rp.store_picture_with_gif @imager\r
r = @rp.store_picture_with_gif @imager\r
r.should be_false\r
end\r
+ it '全体エラーメッセージがセットされている' do\r
+ lambda {\r
+ r = @rp.store_picture_with_gif @imager\r
+ }.should change(@rp.errors[:base], :count)\r
+ end\r
it 'gif画像の保存は呼ばれていない' do\r
#本画像の保存があるので、一度は呼ばれる\r
ResourcePicture.any_instance.should_receive(:store_picture).with(any_args).exactly(1)\r
r = @rp.store_picture_with_gif @imager\r
r.should be_false\r
end\r
+ it '全体エラーメッセージがセットされている' do\r
+ lambda {\r
+ r = @rp.store_picture_with_gif @imager\r
+ }.should change(@rp.errors[:base], :count)\r
+ end\r
end\r
end\r
\r
ResourcePicture.any_instance.stub(:flag_thumbnail).with(any_args).and_return(1)\r
@tmbimager = @imager.to_thumbnail\r
ImagerTest.any_instance.stub(:to_thumbnail).with(any_args).and_return(@tmbimager)\r
- PictureIO.resource_picture_io.stub(:put).with(@tmbimager.binary, '1.gif').and_return(false)\r
+ PictureIO.resource_picture_io.stub(:put).with(@tmbimager.binary, '1.gif').and_raise(PictureIO::Error)\r
end\r
it 'Falseを返す' do\r
r = @rp.store_picture(@imager, '1.gif')\r
@tmbimager = @imager.to_thumbnail\r
ImagerTest.any_instance.stub(:to_thumbnail).with(any_args).and_return(@tmbimager)\r
PictureIO.resource_picture_io.stub(:put).with(@tmbimager.binary, '1.gif').and_return(true)\r
- PictureIO.resource_picture_io.stub(:put).with(@imager.binary, '1.gif', 'full').and_return(false)\r
+ PictureIO.resource_picture_io.stub(:put).with(@imager.binary, '1.gif', 'full').and_raise(PictureIO::Error)\r
end\r
it 'Falseを返す' do\r
r = @rp.store_picture(@imager, '1.gif')\r