WpTimthumb::Existable specs

This commit is contained in:
erwanlr
2013-03-26 16:46:39 +01:00
parent da1c556896
commit 65ca256a73
4 changed files with 53 additions and 1 deletions

View File

@@ -8,5 +8,4 @@ class WpTimthumb < WpItem
include WpTimthumb::Versionable
include WpTimthumb::Existable
include WpTimthumb::Output
end

View File

@@ -3,6 +3,10 @@
class WpTimthumb < WpItem
module Existable
# @param [ Typhoeus::Response ] response
# @param [ Hash ] options
#
# @return [ Boolean ]
def exists_from_response?(response, options = {})
response.code == 400 && response.body =~ /no image specified/i ? true : false
end