Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

#97 Fix for shoulda macros

  • Loading branch information...
commit f07487f62c8f9f1c212db2e49ea64f01afead94e 1 parent 5647740
@jyurek jyurek authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 shoulda_macros/paperclip.rb
View
11 shoulda_macros/paperclip.rb
@@ -31,16 +31,17 @@ def should_validate_attachment_presence name
@attachment.assign(nil)
end
should "have a :presence validation error" do
- assert @assignment.errors[:presence]
+ assert @attachment.errors[:presence]
end
end
context "when the assignment is valid" do
setup do
+ @file = StringIO.new(".")
@attachment = klass.new.send(name)
- @attachment.assign(nil)
+ @attachment.assign(@file)
end
should "have a :presence validation error" do
- assert ! @assignment.errors[:presence]
+ assert ! @attachment.errors[:presence]
end
end
end
@@ -65,7 +66,7 @@ class << @file; attr_accessor :content_type; end
@attachment.assign(@file)
end
should "not have a :content_type validation error" do
- assert ! @assignment.errors[:content_type]
+ assert ! @attachment.errors[:content_type]
end
end
end
@@ -79,7 +80,7 @@ class << @file; attr_accessor :content_type; end
@attachment.assign(@file)
end
should "have a :content_type validation error" do
- assert @assignment.errors[:content_type]
+ assert @attachment.errors[:content_type]
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.