Skip to content
This repository
Browse code

Add test for MiniExiftool#save!

  • Loading branch information...
commit 3baec0c961d4c245a7033db73a776f13f2dfafd8 1 parent 2c012c0
janfri authored July 09, 2012
2  lib/mini_exiftool.rb
@@ -190,7 +190,7 @@ def save!
190 190
       self.errors.each do |key, value|
191 191
         err << "(#{key}) #{value}"
192 192
       end
193  
-      raise "MiniExiftool couldn't save. The following errors occurred: #{err.empty? ? "None" : err.join(", ")}"
  193
+      raise MiniExiftool::Error.new("MiniExiftool couldn't save. The following errors occurred: #{err.empty? ? "None" : err.join(", ")}")
194 194
     end
195 195
   end
196 196
 
12  test/test_save.rb
@@ -70,4 +70,16 @@ def test_encoding_conversion
70 70
     assert_equal special_string_latin1, @mini_exiftool.title
71 71
   end
72 72
 
  73
+  def test_save_bang
  74
+    @mini_exiftool.orientation = 'some value'
  75
+    exception = false
  76
+    begin
  77
+      @mini_exiftool.save!
  78
+    rescue MiniExiftool::Error => e
  79
+      assert_match /Orientation/, e.message
  80
+      exception = true
  81
+    end
  82
+    assert exception, "No exception when save! with error."
  83
+  end
  84
+
73 85
 end

0 notes on commit 3baec0c

Please sign in to comment.
Something went wrong with that request. Please try again.