Sha256: 1a63979ab7312b62126d66a98accffb1a50a967510d702731822f6f1328fae72

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 != :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?("#{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')

      # 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?("#{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/carrierwave_spec.rb
rails_admin_settings-0.5.4 spec/carrierwave_spec.rb