Sha256: 93955a40f3b689f0a410778fbf99ded91782b158faff863075a21b00ed64130d
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
require 'test_helper' class Spree::PageImageTest < ActiveSupport::TestCase should belong_to(:viewable) setup do @page_image = Spree::PageImage.new end should validate_attachment_presence(:attachment) %w(image/jpeg image/gif image/png image/tiff).each do |mime| should "return true for #{mime} as image content" do @page_image.attachment_content_type = mime assert @page_image.image_content? end end %w(application/pdf text/css).each do |mime| should "return false for #{mime} as image content" do @page_image.attachment_content_type = mime assert !@page_image.image_content? end end should "have blank attachment sizes hash if page is not image content" do hash = {} assert_equal hash, @page_image.attachment_sizes end %w(image/jpeg image/gif image/png image/tiff).each do |mime| should "have attachment sizes hash for #{mime}" do @page_image.attachment_content_type = mime hash = { :mini => '48x48>', :small => '150x150>', :medium => '420x300>', :large => '900x650>' } assert_equal hash, @page_image.attachment_sizes end end should "have slide attachment size if page is root" do @page_image.viewable = Spree::Page.new(:path => "/") @page_image.attachment_content_type = "image/jpeg" hash = { :mini => '48x48>', :small => '150x150>', :medium => '420x300>', :large => '900x650>', :slide => '950x250#'} assert_equal hash, @page_image.attachment_sizes end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_essential_cms-0.4.0 | test/unit/spree/page_image_test.rb |