Sha256: 54a2290572d3bcd014c87ff674b2ec45cb4b64fc35060e7836ab67323356c203

Contents?: true

Size: 1.4 KB

Versions: 17

Compression:

Stored size: 1.4 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

    it 'supports defaults' do
      Settings.apply_defaults!(File.join(File.dirname(__FILE__), 'support/defaults_w_file.yml'))
      File.exists?(Settings.root_file_path.join("uploads/1024x768.gif")).should be_true
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rails_admin_settings-0.7.8 spec/paperclip_spec.rb
rails_admin_settings-0.7.7 spec/paperclip_spec.rb
rails_admin_settings-0.7.6 spec/paperclip_spec.rb
rails_admin_settings-0.7.5 spec/paperclip_spec.rb
rails_admin_settings-0.7.4 spec/paperclip_spec.rb
rails_admin_settings-0.7.3 spec/paperclip_spec.rb
rails_admin_settings-0.7.2 spec/paperclip_spec.rb
rails_admin_settings-0.7.1 spec/paperclip_spec.rb
rails_admin_settings-0.7.0 spec/paperclip_spec.rb
rails_admin_settings-0.6.8 spec/paperclip_spec.rb
rails_admin_settings-0.6.7 spec/paperclip_spec.rb
rails_admin_settings-0.6.5 spec/paperclip_spec.rb
rails_admin_settings-0.6.4 spec/paperclip_spec.rb
rails_admin_settings-0.6.3 spec/paperclip_spec.rb
rails_admin_settings-0.6.2 spec/paperclip_spec.rb
rails_admin_settings-0.6.1 spec/paperclip_spec.rb
rails_admin_settings-0.6.0 spec/paperclip_spec.rb