cirandas.net

ref: master

test/unit/thumbnail_test.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
require_relative "../test_helper"

class ThumbnailTest < ActiveSupport::TestCase

  should 'use sensible options' do
    assert_equal :file_system, Thumbnail.attachment_options[:storage]

    Thumbnail.attachment_options[:content_type].each do |item|
      assert_match /(image|application)\/.+/, item
    end
  end

  should 'not allow script files to be uploaded without append .txt in the end' do
    file = Thumbnail.create!(:uploaded_data => fixture_file_upload('files/hello_world.php', 'image/png'))
    assert_equal 'hello_world.php.txt', file.filename
  end
  
end