Skip to content
This repository has been archived by the owner on Sep 9, 2019. It is now read-only.

Commit

Permalink
thoughtbot#97 Fix for shoulda macros
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Yurek committed Jan 23, 2009
1 parent 5647740 commit f07487f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions shoulda_macros/paperclip.rb
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f07487f

Please sign in to comment.