2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
require 'spec_helper'
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe UploaderHelper do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:uploader) do
|
|
|
|
example_uploader = Class.new(CarrierWave::Uploader::Base) do
|
|
|
|
include UploaderHelper
|
|
|
|
|
|
|
|
storage :file
|
|
|
|
end
|
|
|
|
|
|
|
|
example_uploader.new
|
|
|
|
end
|
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
describe '#extension_match?' do
|
2020-06-23 00:09:42 +05:30
|
|
|
it 'returns false if file does not exist' do
|
2018-11-20 20:47:30 +05:30
|
|
|
expect(uploader.file).to be_nil
|
|
|
|
expect(uploader.send(:extension_match?, 'jpg')).to eq false
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|