end
end
context 'ファイルがないとき' do
- it 'falseが返る' do
- @io.exist?('not.exist').should be_false
+ it 'PictureIO::Error例外が発生する' do
+ File.stub(:exist?).with(any_args()).and_raise(StandardError)
+ lambda {
+ @io.exist?('not.exist')
+ }.should raise_error(PictureIO::Error)
end
end
end
end
end
context '例外が発生するとき' do
- it 'falseが返る' do
+ it 'PictureIO::Error例外が発生する' do
File.stub(:open).with(any_args()).and_raise(StandardError)
- @io.get('test.get').should be_false
+ lambda {
+ r = @io.get('test.get')
+ }.should raise_error(PictureIO::Error)
end
end
end
end
end
context '例外が発生するとき' do
- it 'falseが返る' do
+ it 'PictureIO::Error例外が発生する' do
File.stub(:open).with(any_args()).and_raise(StandardError)
- @io.put('bindata', 'test.put').should be_false
+ lambda {
+ @io.put('bindata', 'test.put')
+ }.should raise_error(PictureIO::Error)
end
end
end
end
end
context '例外が発生するとき' do
- it 'falseが返る' do
+ it 'PictureIO::Error例外が発生する' do
File.stub(:delete).with(any_args()).and_raise(StandardError)
- @io.delete('test.del.not.exist').should be_false
+ lambda {
+ @io.delete('test.del.not.exist')
+ }.should raise_error(PictureIO::Error)
end
end
end