Module: Woulda::AttachmentFu::Macros

Defined in:
lib/woulda/attachment_fu/macros.rb

Instance Method Summary collapse

Instance Method Details

#should_have_attachment(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/woulda/attachment_fu/macros.rb', line 4

def should_have_attachment(options = {})
  klass = described_type

  should_have_db_columns :size, :content_type, :filename
  if options[:content_type] == :image
    should_have_db_columns :height, :width
  end

  should "define AttachmentFu class methods" do
    # breakpoint
    class_modules = (class << klass; included_modules; end)
    assert class_modules.include?(Technoweenie::AttachmentFu::ClassMethods),
                                  "#{klass} doesn't define AttachmentFu class methods"
  end

  should "define AttachmentFu instance methods" do
    instance_modules = klass.included_modules
    assert instance_modules.include?(Technoweenie::AttachmentFu::InstanceMethods),
                                      "#{klass} doesn't define AttachmentFu instance methods"
  end
end