Sha256: 929789dfda85d494ab3feaefb62d7e67ee49daef82e8e3421a0ab469ecf93d7f

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

require 'test_helper'

module Guts
  class MediumTest < ActiveSupport::TestCase
    setup do
      @medium = guts_media :test_file
    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

6 entries across 6 versions & 1 rubygems

Version Path
guts-3.0.1 test/models/guts/medium_test.rb
guts-3.0.0 test/models/guts/medium_test.rb
guts-2.1.0 test/models/guts/medium_test.rb
guts-2.0.2 test/models/guts/medium_test.rb
guts-2.0.1 test/models/guts/medium_test.rb
guts-2.0.0 test/models/guts/medium_test.rb