Skip to content
This repository
Browse code

Return value of save, load and reload adapted.

  • Loading branch information...
commit ffb142f82a10edbc80fad19ee328250311b7cfa9 1 parent a43e647
authored January 18, 2007
4  lib/mini_exiftool.rb
@@ -32,6 +32,7 @@ def load filename
32 32
     else
33 33
       raise MiniExiftool::Error
34 34
     end
  35
+    self
35 36
   end
36 37
 
37 38
   def reload
@@ -79,14 +80,17 @@ def changed_tags
79 80
   end
80 81
 
81 82
   def save
  83
+    result = false
82 84
     @changed_values.each do |tag, val|
83 85
       unified_tag = unify tag
84 86
       converted_val = convert val
85 87
       opt_params = converted_val.kind_of?(Numeric) ? '-n' : ''
86 88
       cmd = %Q(#@prog -q -q -P -overwrite_original #{opt_params} -#{unified_tag}="#{converted_val}" "#{filename}")
87 89
       run(cmd)
  90
+      result = true
88 91
     end
89 92
     reload
  93
+    result
90 94
   end
91 95
   
92 96
   private
5  test/test_write.rb
@@ -95,12 +95,15 @@ def test_save
95 95
     temp_md5 = Digest::MD5.hexdigest(File.read(@temp_filename))
96 96
     assert_equal org_md5, temp_md5
97 97
     @mini_exiftool_num['Orientation'] = 2
98  
-    @mini_exiftool_num.save
  98
+    result = @mini_exiftool_num.save
  99
+    assert_equal true, result
99 100
     org_md5_2 = Digest::MD5.hexdigest(File.read(@org_filename))
100 101
     assert_equal org_md5, org_md5_2
101 102
     temp_md5_2 = Digest::MD5.hexdigest(File.read(@temp_filename))
102 103
     assert_not_equal temp_md5, temp_md5_2
103 104
     assert_equal false, @mini_exiftool_num.changed?
  105
+    result = @mini_exiftool_num.save
  106
+    assert_equal false, result
104 107
   end
105 108
 
106 109
 end

0 notes on commit ffb142f

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