Commit a4d1b0eb by Jon Yurek

Removed warnings about #errors in Rails 3

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