Sha256: 376e0e2cf112304c5ea7edec9f0564bba99cc1d62c0eb1ebbd52c94c0eda94f6

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 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_match /#{size}/, @medium.file.url(size)
      end
    end
    
    test "should return polymorphic object for medium" do
      assert_instance_of Guts::Content, @medium.filable
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
guts-1.0.8 test/models/guts/medium_test.rb
guts-1.0.7 test/models/guts/medium_test.rb
guts-1.0.5 test/models/guts/medium_test.rb
guts-1.0.3 test/models/guts/medium_test.rb