Sha256: b469524384da5545361493fbc8dc495aafacafa3ab44c682429b1f7c70272765

Contents?: true

Size: 1.17 KB

Versions: 10

Compression:

Stored size: 1.17 KB

Contents

RSpec.describe Hyrax::Statistics::FileSets::ByFormat do
  let(:service) { described_class.new }

  describe "#query" do
    let(:fs1) { build(:file_set, id: '1234567') }
    let(:fs2) { build(:file_set, id: '2345678') }
    let(:fs3) { build(:file_set, id: '3456789') }
    let(:fs4) { build(:file_set, id: '4567890') }
    before do
      allow(fs1).to receive_messages(mime_type: 'text/plain', format_label: ["plain text"])
      fs1.update_index
      allow(fs2).to receive_messages(mime_type: 'image/jpg', format_label: ["JPEG image"])
      fs2.update_index
      allow(fs3).to receive_messages(mime_type: 'image/tiff', format_label: ["TIFF image"])
      fs3.update_index
      allow(fs4).to receive_messages(mime_type: 'image/jpg', format_label: ["JPEG image"])
      fs4.update_index
    end

    subject { service.query }

    it "is a list of categories" do
      expect(subject).to eq [{ label: 'jpg (JPEG image)', data: 2 },
                             { label: 'plain (plain text)', data: 1 },
                             { label: 'tiff (TIFF image)', data: 1 }]
      expect(subject.first.label).to eq 'jpg (JPEG image)'
      expect(subject.first.value).to eq 2
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 spec/services/hyrax/statistics/file_sets/by_format_spec.rb
hyrax-1.1.0 spec/services/hyrax/statistics/file_sets/by_format_spec.rb
hyrax-1.0.5 spec/services/hyrax/statistics/file_sets/by_format_spec.rb
hyrax-1.0.4 spec/services/hyrax/statistics/file_sets/by_format_spec.rb
hyrax-1.0.3 spec/services/hyrax/statistics/file_sets/by_format_spec.rb
hyrax-1.0.2 spec/services/hyrax/statistics/file_sets/by_format_spec.rb
hyrax-1.0.1 spec/services/hyrax/statistics/file_sets/by_format_spec.rb
hyrax-1.0.0.rc2 spec/services/hyrax/statistics/file_sets/by_format_spec.rb
hyrax-1.0.0.rc1 spec/services/hyrax/statistics/file_sets/by_format_spec.rb
test_hyrax-0.0.1.alpha spec/services/hyrax/statistics/file_sets/by_format_spec.rb