Sha256: baccb6889724b02eacf5d5dd228f098c0aa4ff4f4a9eccb0722df355961d3a75

Contents?: true

Size: 1.44 KB

Versions: 15

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

15 entries across 15 versions & 2 rubygems

Version Path
thecore_settings-2.0.9 spec/paperclip_spec.rb
thecore_settings-2.0.8 spec/paperclip_spec.rb
thecore_settings-2.0.7 spec/paperclip_spec.rb
thecore_settings-2.0.6 spec/paperclip_spec.rb
thecore_settings-2.0.5 spec/paperclip_spec.rb
thecore_settings-2.0.4 spec/paperclip_spec.rb
thecore_settings-2.0.3 spec/paperclip_spec.rb
thecore_settings-2.0.2 spec/paperclip_spec.rb
rails_admin_settings-1.7.0 spec/paperclip_spec.rb
rails_admin_settings-1.6.0 spec/paperclip_spec.rb
rails_admin_settings-1.5.1 spec/paperclip_spec.rb
rails_admin_settings-1.5.0 spec/paperclip_spec.rb
rails_admin_settings-1.4.2 spec/paperclip_spec.rb
rails_admin_settings-1.4.1 spec/paperclip_spec.rb
rails_admin_settings-1.4.0 spec/paperclip_spec.rb