Permalink
Browse files

#97 Fix for shoulda macros

  • Loading branch information...
1 parent 5647740 commit f07487f62c8f9f1c212db2e49ea64f01afead94e @jyurek jyurek committed Jan 23, 2009
Showing with 6 additions and 5 deletions.
  1. +6 −5 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

0 comments on commit f07487f

Please sign in to comment.