Sha256: 76c9f544c8353d001a3c3c709393197d1a552f7641d70417ae6bb003aeb0e6cc

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 != :carrierwave
    pending "paperclip not detected, skipped. To run use UPLOADS=carrierwave rspec"
  else
    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')

      # because we're not inside Rails
      Settings.get(:file).file.root = '/'

      Settings.get(:file).file.file.file.should eq "#{File.dirname(__FILE__).gsub('/spec', '/')}uploads/1024x768.gif"

      File.exists?(Settings.root_file_path.join("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')

      # because we're not inside Rails
      Settings.get(:file).file.root = '/'

      Settings.get(:file).file.file.file.should eq "#{File.dirname(__FILE__).gsub('/spec', '/')}uploads/1024x768.gif"

      File.exists?(Settings.root_file_path.join("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/carrierwave_spec.rb
rails_admin_settings-0.7.7 spec/carrierwave_spec.rb
rails_admin_settings-0.7.6 spec/carrierwave_spec.rb
rails_admin_settings-0.7.5 spec/carrierwave_spec.rb
rails_admin_settings-0.7.4 spec/carrierwave_spec.rb
rails_admin_settings-0.7.3 spec/carrierwave_spec.rb
rails_admin_settings-0.7.2 spec/carrierwave_spec.rb
rails_admin_settings-0.7.1 spec/carrierwave_spec.rb
rails_admin_settings-0.7.0 spec/carrierwave_spec.rb
rails_admin_settings-0.6.8 spec/carrierwave_spec.rb
rails_admin_settings-0.6.7 spec/carrierwave_spec.rb
rails_admin_settings-0.6.5 spec/carrierwave_spec.rb
rails_admin_settings-0.6.4 spec/carrierwave_spec.rb
rails_admin_settings-0.6.3 spec/carrierwave_spec.rb
rails_admin_settings-0.6.2 spec/carrierwave_spec.rb
rails_admin_settings-0.6.1 spec/carrierwave_spec.rb
rails_admin_settings-0.6.0 spec/carrierwave_spec.rb