Sha256: f3ea8077a3a0513ff53586637be2579c3344ed51921be24b3a2602488f8bbba2

Contents?: true

Size: 1.44 KB

Versions: 34

Compression:

Stored size: 1.44 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 kind' do
      Settings.set('file', File.open("#{File.dirname(__FILE__)}/support/1024x768.gif"), kind: 'file')
      expect(Settings.get(:file).file_file_name).to eq '1024x768.gif'
      expect(Settings.get(:file).file_file_size).to eq 4357
      expect(Settings.file[0..21]).to eq '/uploads/1024x768.gif?'

      expect(File.exists?("#{File.dirname(__FILE__)}/../uploads/1024x768.gif")).to be_truthy
    end

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

      expect(File.exists?("#{File.dirname(__FILE__)}/../uploads/1024x768.gif")).to be_truthy
    end

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

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
rails_admin_settings-1.1.3 spec/paperclip_spec.rb
rails_admin_settings-1.1.2 spec/paperclip_spec.rb
rails_admin_settings-1.1.0.pre.1 spec/paperclip_spec.rb
rails_admin_settings-1.0.1 spec/paperclip_spec.rb
rails_admin_settings-1.0.0 spec/paperclip_spec.rb
rails_admin_settings-1.0.0.pre.1 spec/paperclip_spec.rb
rails_admin_settings-0.9.1 spec/paperclip_spec.rb
rails_admin_settings-0.9.0 spec/paperclip_spec.rb
rails_admin_settings-0.9.0.pre.6 spec/paperclip_spec.rb
rails_admin_settings-0.9.0.pre.5 spec/paperclip_spec.rb
rails_admin_settings-0.9.0.pre.4 spec/paperclip_spec.rb
rails_admin_settings-0.9.0.pre.3 spec/paperclip_spec.rb
rails_admin_settings-0.9.0.pre.2 spec/paperclip_spec.rb
rails_admin_settings-0.9.0.pre spec/paperclip_spec.rb