2019-10-14 23:06:19 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 03:56:52 -04:00
|
|
|
require 'spec_helper'
|
2017-02-23 16:54:25 -05:00
|
|
|
|
2020-06-24 11:08:50 -04:00
|
|
|
RSpec.describe UploaderHelper do
|
2017-02-15 13:11:44 -05:00
|
|
|
let(:uploader) do
|
|
|
|
example_uploader = Class.new(CarrierWave::Uploader::Base) do
|
|
|
|
include UploaderHelper
|
2017-02-23 16:54:25 -05:00
|
|
|
|
2017-02-15 13:11:44 -05:00
|
|
|
storage :file
|
|
|
|
end
|
|
|
|
|
|
|
|
example_uploader.new
|
2017-02-23 16:54:25 -05:00
|
|
|
end
|
|
|
|
|
2018-09-04 06:39:08 -04:00
|
|
|
describe '#extension_match?' do
|
2020-05-22 11:08:09 -04:00
|
|
|
it 'returns false if file does not exist' do
|
2018-09-04 06:39:08 -04:00
|
|
|
expect(uploader.file).to be_nil
|
|
|
|
expect(uploader.send(:extension_match?, 'jpg')).to eq false
|
2017-02-23 16:54:25 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|