Skip to content

Instantly share code, notes, and snippets.

@jimryan
Created January 9, 2012 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimryan/1584089 to your computer and use it in GitHub Desktop.
Save jimryan/1584089 to your computer and use it in GitHub Desktop.
should "save the files as the right formats and sizes" do
[[:large, 400, 61, "PNG"],
[:medium, 100, 15, "GIF"],
[:small, 32, 32, "JPEG"]].each do |style|
cmd = %Q[identify -format "%w %h %b %m" "#{@attachment.path(style.first)}"]
out = `#{cmd}`
width, height, size, format = out.split(" ")
assert_equal style[1].to_s, width.to_s
assert_equal style[2].to_s, height.to_s
assert_equal style[3].to_s, format.to_s
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment