OSDN Git Service

t#30220:i18n system error message
[pettanr/pettanr.git] / lib / test / local_picture_spec.rb
index acb4733..6f5a610 100644 (file)
@@ -32,8 +32,11 @@ describe PictureIO::LocalPicture do
       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
@@ -58,9 +61,11 @@ describe PictureIO::LocalPicture do
       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
@@ -109,9 +114,11 @@ describe PictureIO::LocalPicture do
       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
@@ -138,9 +145,11 @@ describe PictureIO::LocalPicture do
       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