Commit a4d1b0eb by Jon Yurek

Removed warnings about #errors in Rails 3

parent 724cc7e1
......@@ -57,7 +57,7 @@ module Paperclip
file = StringIO.new(".")
file.content_type = type
(subject = @subject.new).attachment_for(@attachment_name).assign(file)
subject.valid? && subject.errors.on(:"#{@attachment_name}_content_type").blank?
subject.valid? && subject.errors[:"#{@attachment_name}_content_type"].blank?
end
end
......
......@@ -39,14 +39,14 @@ module Paperclip
def error_when_not_valid?
(subject = @subject.new).send(@attachment_name).assign(nil)
subject.valid?
not subject.errors.on(:"#{@attachment_name}_file_name").blank?
not subject.errors[:"#{@attachment_name}_file_name"].blank?
end
def no_error_when_valid?
@file = StringIO.new(".")
(subject = @subject.new).send(@attachment_name).assign(@file)
subject.valid?
subject.errors.on(:"#{@attachment_name}_file_name").blank?
subject.errors[:"#{@attachment_name}_file_name"].blank?
end
end
end
......
......@@ -69,7 +69,7 @@ module Paperclip
(subject = @subject.new).send(@attachment_name).assign(file)
subject.valid?
subject.errors.on(:"#{@attachment_name}_file_size").blank?
subject.errors[:"#{@attachment_name}_file_size"].blank?
end
def lower_than_low?
......
......@@ -235,11 +235,11 @@ class PaperclipTest < Test::Unit::TestCase
end
if validation == :presence
should "have an error on the attachment" do
assert @dummy.errors.on(:avatar_file_name)
assert @dummy.errors[:avatar_file_name]
end
else
should "not have an error on the attachment" do
assert_nil @dummy.errors.on(:avatar_file_name), @dummy.errors.full_messages.join(", ")
assert @dummy.errors[:avatar_file_name].blank?, @dummy.errors.full_messages.join(", ")
end
end
end
......@@ -288,7 +288,7 @@ class PaperclipTest < Test::Unit::TestCase
end
should "have a file size min/max error message" do
assert_match %r/between 0 and 10240 bytes/, @dummy.errors.on(:avatar_file_size)
assert @dummy.errors[:avatar_file_size].any?{|e| e.match %r/between 0 and 10240 bytes/ }
end
end
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