Sha256: 7e40e046620ccf2de423dbfc9dbcae7d3035b8be1896ed0c6607eff8e647c779

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'


describe "Uploads" do
  if Settings.file_uploads_engine != :paperclip
    pending "paperclip not detected, skipped. To run use UPLOADS=paperclip rspec"
  else
    Paperclip.options[:log] = false
    before :each do
      f = "#{File.dirname(__FILE__)}/../uploads/1024x768.gif"
      if File.file?(f)
        File.unlink(f)
      end
    end
    it 'supports file type' do
      Settings.set('file', File.open("#{File.dirname(__FILE__)}/support/1024x768.gif"), type: 'file')
      Settings.get(:file).file_file_name.should eq '1024x768.gif'
      Settings.get(:file).file_file_size.should eq 4357
      Settings.file[0..21].should eq '/uploads/1024x768.gif?'

      File.exists?("#{File.dirname(__FILE__)}/../uploads/1024x768.gif").should be_true
    end

    it 'supports image type' do
      Settings.set('file', File.open("#{File.dirname(__FILE__)}/support/1024x768.gif"), type: 'image')
      Settings.get(:file).file_file_name.should eq '1024x768.gif'
      Settings.get(:file).file_file_size.should eq 4357
      Settings.file[0..21].should eq '/uploads/1024x768.gif?'

      File.exists?("#{File.dirname(__FILE__)}/../uploads/1024x768.gif").should be_true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_admin_settings-0.5.5 spec/paperclip_spec.rb
rails_admin_settings-0.5.4 spec/paperclip_spec.rb