Sha256: 596e2d2018f118998ca698a1e6b2ab88730eefb8dae3e8a33beac5a705617cac

Contents?: true

Size: 818 Bytes

Versions: 4

Compression:

Stored size: 818 Bytes

Contents

class Test::Unit::TestCase
  def self.should_have_attached_file(attachment)
    klass = self.name.gsub(/Test$/, '').constantize

    context "To support a paperclip attachment named #{attachment}, #{klass}" do
      should have_db_column("#{attachment}_file_name").of_type(:string)
      should have_db_column("#{attachment}_content_type").of_type(:string)
      should have_db_column("#{attachment}_file_size").of_type(:integer)
      should have_db_column("#{attachment}_updated_at").of_type(:datetime)
    end

    should "have a paperclip attachment named ##{attachment}" do
      assert klass.new.respond_to?(attachment.to_sym), "@#{klass.name.underscore} doesn't have a paperclip field named #{attachment}"
      assert_equal Paperclip::Attachment, klass.new.send(attachment.to_sym).class
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_variant_options-0.4.1 test/support/paperclip.rb
spree_variant_options-0.4.0 test/support/paperclip.rb
spree_variant_options-0.3.0 test/support/paperclip.rb
spree_variant_options-0.2.0 test/support/paperclip.rb