diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-09-26 09:51:24 +0200 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2018-06-05 16:20:06 +0200 |
commit | c8a4d202c99c772822a2b9b09fa6da2c90b2ae81 (patch) | |
tree | 0680404038d5923bd659e8557dd578341d4688d2 /spec/uploaders | |
parent | 9921830267ccef2321e9a57383b28daafd34fa78 (diff) | |
download | gitlab-ce-c8a4d202c99c772822a2b9b09fa6da2c90b2ae81.tar.gz |
favicon uploader generating ci status favicons
Diffstat (limited to 'spec/uploaders')
-rw-r--r-- | spec/uploaders/favicon_uploader_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/uploaders/favicon_uploader_spec.rb b/spec/uploaders/favicon_uploader_spec.rb new file mode 100644 index 00000000000..5989d294112 --- /dev/null +++ b/spec/uploaders/favicon_uploader_spec.rb @@ -0,0 +1,38 @@ +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.default).to be_format('ico') + end + + it 'has the correct dimensions' do + expect(uploader.default).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.status_not_found.file.file)).to be true + end + end + end +end |