Sha256: fb5148773b7bf37acd7236aae3a9e650e9cc374fe5a643b1419a336e2f7960be

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

class Spree::ContentTest < ActiveSupport::TestCase

  should validate_presence_of(:page)
  should validate_presence_of(:title)

  context "An existing piece of content" do
    
    setup do
      Spree::Page.destroy_all
      @page = Factory(:spree_page)
      @content = Factory(:spree_content, :page => @page)
    end
    
    context "with an image attached" do
    
      setup do
        @image = File.expand_path("../../../support/files/1.jpg", __FILE__)
        @content.update_attribute(:attachment, File.open(@image))
      end
      
      should "reprocess image when context changes" do
        assert !@content.attachment.exists?(:slide)
        @content.update_attribute(:context, "slideshow")
        assert @content.reload.attachment.exists?(:slide)
      end
      
      should "delete attachment" do
        @content.update_attribute(:delete_attachment, true)
        assert !@content.reload.attachment.exists?
        assert @content.attachment_file_name.blank?
      end
            
    end
    
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_essential_cms-0.4.0 test/unit/spree/content_test.rb