favicon_uploader_spec.rb 623 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
require 'spec_helper'

RSpec.describe FaviconUploader do
  include CarrierWave::Test::Matchers

  let(:uploader) { described_class.new(build_stubbed(:user)) }

  after do
    uploader.remove!
  end

  def upload_fixture(filename)
    fixture_file_upload(Rails.root.join('spec', 'fixtures', filename))
  end

  context 'versions' do
    before do
      uploader.store!(upload_fixture('dk.png'))
    end

    it 'has the correct format' do
22
      expect(uploader.favicon_main).to be_format('png')
23 24 25
    end

    it 'has the correct dimensions' do
26
      expect(uploader.favicon_main).to have_dimensions(32, 32)
27 28 29
    end
  end
end