Sha256: ecfb35dad345140df539681dbc6ca9014c8b1a444e6c78f3b32daa9fed6341d8

Contents?: true

Size: 1.34 KB

Versions: 8

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

require "rails_helper"

module Archangel
  RSpec.describe LogoUploader, type: :uploader do
    let(:site) { create(:site) }
    let(:uploader) { described_class.new(site, :logo) }

    before do
      described_class.enable_processing = true

      uploader.store!(fixture_file_upload(uploader_test_image))
    end

    after do
      described_class.enable_processing = false

      uploader.remove!
    end

    it "uses default image" do
      expect(subject.default_url).to include("assets/archangel/fallback/logo")
    end

    it "scales an original image to be no larger than 512 by 512 pixels" do
      expect(uploader).to be_no_larger_than(512, 512)
    end

    it "scales a large image to be no larger than 256 by 256 pixels" do
      expect(uploader.large).to be_no_larger_than(256, 256)
    end

    it "scales a medium image to be no larger than 128 by 128 pixels" do
      expect(uploader.medium).to be_no_larger_than(128, 128)
    end

    it "scales a small image to be no larger than 64 by 64 pixels" do
      expect(uploader.small).to be_no_larger_than(64, 64)
    end

    it "scales a tiny image to be no larger than 32 by 32 pixels" do
      expect(uploader.tiny).to be_no_larger_than(32, 32)
    end

    it "makes the image with 666 permissions" do
      expect(uploader).to have_permissions(0o666)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
archangel-0.3.0 spec/uploaders/archangel/logo_uploader_spec.rb
archangel-0.0.8 spec/uploaders/archangel/logo_uploader_spec.rb
archangel-0.0.7 spec/uploaders/archangel/logo_uploader_spec.rb
archangel-0.0.6 spec/uploaders/archangel/logo_uploader_spec.rb
archangel-0.0.5 spec/uploaders/archangel/logo_uploader_spec.rb
archangel-0.0.4 spec/uploaders/archangel/logo_uploader_spec.rb
archangel-0.0.3 spec/uploaders/archangel/logo_uploader_spec.rb
archangel-0.0.2 spec/uploaders/archangel/logo_uploader_spec.rb