Sha256: f332ec50e3a933ff428a81210b5130173a3441c8d7d043b07777e672977cff00

Contents?: true

Size: 1.21 KB

Versions: 13

Compression:

Stored size: 1.21 KB

Contents

require 'test_helper'

module Guts
  class MediumTest < ActiveSupport::TestCase
    setup do
      @medium = guts_media :test_file
    end
    
    test 'should be trackable' do
      assert_equal true, Medium.methods.include?(:trackable)
    end
      
    test 'should not create without title' do
      medium = Medium.new
      assert_not medium.save
    end
    
    test 'should not create title less than three' do
      medium       = Medium.new
      medium.title = 'xy' 
      assert_not medium.save
    end
    
    test 'should not process paperclip for non images' do
      medium = Medium.new
      
      assert_equal false, medium.sizing_only_images
    end
    
    test 'should process paperclip for images' do      
      assert_nil @medium.sizing_only_images
    end
    
    test 'should return urls for different sizes' do
      Guts.configuration.file_image_sizing.each do |size|
        assert @medium.file.url(size).include?(size[0].to_s)
      end
    end
    
    test 'should return polymorphic object for medium' do
      assert_instance_of Guts::Content, @medium.filable
    end
    
    test 'medium should be multisite compatible' do
      assert Medium.all.to_sql.include?('site_id')
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
guts-1.4.0 test/models/guts/medium_test.rb
guts-1.3.6 test/models/guts/medium_test.rb
guts-1.3.5 test/models/guts/medium_test.rb
guts-1.3.4 test/models/guts/medium_test.rb
guts-1.3.3 test/models/guts/medium_test.rb
guts-1.3.2 test/models/guts/medium_test.rb
guts-1.3.1 test/models/guts/medium_test.rb
guts-1.3.0 test/models/guts/medium_test.rb
guts-1.2.2 test/models/guts/medium_test.rb
guts-1.2.1 test/models/guts/medium_test.rb
guts-1.2.0 test/models/guts/medium_test.rb
guts-1.1.1 test/models/guts/medium_test.rb
guts-1.1.0 test/models/guts/medium_test.rb