Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add test for MiniExiftool#save!

  • Loading branch information...
commit 3baec0c961d4c245a7033db73a776f13f2dfafd8 1 parent 2c012c0
@janfri authored
Showing with 13 additions and 1 deletion.
  1. +1 −1  lib/mini_exiftool.rb
  2. +12 −0 test/test_save.rb
View
2  lib/mini_exiftool.rb
@@ -190,7 +190,7 @@ def save!
self.errors.each do |key, value|
err << "(#{key}) #{value}"
end
- raise "MiniExiftool couldn't save. The following errors occurred: #{err.empty? ? "None" : err.join(", ")}"
+ raise MiniExiftool::Error.new("MiniExiftool couldn't save. The following errors occurred: #{err.empty? ? "None" : err.join(", ")}")
end
end
View
12 test/test_save.rb
@@ -70,4 +70,16 @@ def test_encoding_conversion
assert_equal special_string_latin1, @mini_exiftool.title
end
+ def test_save_bang
+ @mini_exiftool.orientation = 'some value'
+ exception = false
+ begin
+ @mini_exiftool.save!
+ rescue MiniExiftool::Error => e
+ assert_match /Orientation/, e.message
+ exception = true
+ end
+ assert exception, "No exception when save! with error."
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.