Commit 2db36782 by S. Humza Shah Committed by Tute Costa

replaced 3 if-not-blank checks with if-present checks (#2230)

* replaced if-not-blank with if-present

an instance of code was testing presence via `!a.blank?`. this is now
replaced with a more readable version: `a.present?`

* replaced 2 if-not-blank checks with if-present checks

* temporarily restrict travis

* reverted travis changes

* readded whitespace
parent 6819fac5
......@@ -349,7 +349,7 @@ module Paperclip
# Returns true if a file has been assigned.
def file?
!original_filename.blank?
original_filename.present?
end
alias :present? :file?
......
......@@ -18,7 +18,7 @@ module Paperclip
raise "Class #{klass.name} has no attachments specified"
end
if !name.blank? && attachment_names.map(&:to_s).include?(name.to_s)
if name.present? && attachment_names.map(&:to_s).include?(name.to_s)
[ name ]
else
attachment_names
......
......@@ -1121,7 +1121,7 @@ describe Paperclip::Attachment do
context "with a file assigned but not saved yet" do
it "clears out any attached files" do
@attachment.assign(@file)
assert !@attachment.queued_for_write.blank?
assert @attachment.queued_for_write.present?
@attachment.clear
assert @attachment.queued_for_write.blank?
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment