Sha256: 664e7dd72c34336303e95b8d75c343aff811d0c2452f5e2bc6c45fc53179e4cc

Contents?: true

Size: 830 Bytes

Versions: 10

Compression:

Stored size: 830 Bytes

Contents

RSpec.describe Hyrax::Statistics::Works::ByResourceType do
  let(:service) { described_class.new }

  describe "#query" do
    before do
      create(:generic_work, resource_type: ['Conference Proceeding'])
      create(:generic_work, resource_type: ['Conference Proceeding'])
      create(:generic_work, resource_type: ['Image'])
      create(:generic_work, resource_type: ['Journal'])
    end

    subject { service.query }

    it "is a list of categories" do
      expect(subject).to eq [{ label: 'Conference Proceeding', data: 2 },
                             { label: 'Image', data: 1 },
                             { label: 'Journal', data: 1 }]
      expect(subject.to_json).to eq "[{\"label\":\"Conference Proceeding\",\"data\":2},{\"label\":\"Image\",\"data\":1},{\"label\":\"Journal\",\"data\":1}]"
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

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