Module: Woulda::Paperclip::Macros
- Defined in:
- lib/woulda/paperclip/macros.rb
Instance Method Summary collapse
-
#should_have_attached_file(attachment) ⇒ Object
Original source: giantrobots.thoughtbot.com/2008/6/3/testing-paperclip-with-shoulda.
Instance Method Details
#should_have_attached_file(attachment) ⇒ Object
Original source: giantrobots.thoughtbot.com/2008/6/3/testing-paperclip-with-shoulda
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/woulda/paperclip/macros.rb', line 5 def should_have_attached_file() klass = self.name.gsub(/Test$/, '').constantize context "To support a paperclip attachment named #{}, #{klass}" do should_have_db_column("#{}_file_name", :type => :string) should_have_db_column("#{}_content_type", :type => :string) should_have_db_column("#{}_file_size", :type => :integer) end should "have a paperclip attachment named ##{}" do assert klass.new.respond_to?(.to_sym), "@#{klass.name.underscore} doesn't have a paperclip field named #{}" assert_equal ::Paperclip::Attachment, klass.new.send(.to_sym).class end end |