gitlab-org--gitlab-foss/spec/uploaders/favicon_uploader_spec.rb
Alexis Reigel 67fe0a17d8
call Gitlab::Favicon.status in serializer
this ways we can keep the `lib/gitlab/ci/status/*` classes to return the
bare favicon name as it was before.

also the favicon uploader versions are now have the same names as the
stock favicons (+ `favicon_` prefix), which makes working with the
status names easier.
2018-06-05 16:20:21 +02:00

38 lines
964 B
Ruby

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
expect(uploader.favicon_main).to be_format('ico')
end
it 'has the correct dimensions' do
expect(uploader.favicon_main).to have_dimensions(32, 32)
end
it 'generates all the status icons' do
# make sure that the following each statement actually loops
expect(FaviconUploader::STATUS_ICON_NAMES.count).to eq 10
FaviconUploader::STATUS_ICON_NAMES.each do |status_name|
expect(File.exist?(uploader.favicon_status_not_found.file.file)).to be true
end
end
end
end