Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
janko committed Oct 4, 2014
1 parent e45ca38 commit 3fce41f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/mini_magick/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def format(format, page = 0)
@info.clear

if @tempfile
new_tempfile = MiniMagick::Utilities.tempfile(format)
new_tempfile = MiniMagick::Utilities.tempfile(".#{format}")
new_path = new_tempfile.path
else
new_path = path.sub(/\.\w+$/, ".#{format}")
Expand Down Expand Up @@ -375,7 +375,7 @@ def write(output_to)
builder << output_to
end
else
FileUtils.cp path, output_to
FileUtils.copy_file path, output_to
end
else
IO.copy_stream File.open(path, "rb"), output_to
Expand All @@ -395,7 +395,7 @@ def write(output_to)
# @see http://www.imagemagick.org/script/composite.php
#
def composite(other_image, output_extension = 'jpg', mask = nil)
output_tempfile = MiniMagick::Utilities.tempfile(output_extension)
output_tempfile = MiniMagick::Utilities.tempfile(".#{output_extension}")

MiniMagick::Tool::Composite.new do |composite|
yield composite if block_given?
Expand Down
2 changes: 1 addition & 1 deletion lib/mini_magick/utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def which(cmd)
end

def tempfile(extension)
Tempfile.new(["mini_magick", ".#{extension}"]).tap do |tempfile|
Tempfile.new(["mini_magick", extension]).tap do |tempfile|
tempfile.binmode
yield tempfile if block_given?
tempfile.close
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/mini_magick/shell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

it "timeouts afer a period of time" do
allow(MiniMagick).to receive(:timeout).and_return(0.001)
expect { subject.execute(%W[identify]) }
expect { subject.execute(%W[identify -format %[EXIF:*] #{image_path(:exif)}]) }
.to raise_error(Timeout::Error)
end

Expand Down
3 changes: 2 additions & 1 deletion spec/support/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def image_url
end

def random_path(basename = "")
Tempfile.open(basename).path
@tempfile = Tempfile.open(basename)
@tempfile.path
end
end

Expand Down

0 comments on commit 3fce41f

Please sign in to comment.