Sha256: d34a1e48296b2c29c470f0e3416cfab0ff938ab02bea95bcb036adaaf0b2dac0

Contents?: true

Size: 797 Bytes

Versions: 9

Compression:

Stored size: 797 Bytes

Contents

require 'spec_helper'

RSpec.describe Hyrax::Admin::RepositoryGrowthPresenter do
  let(:instance) { described_class.new }

  describe "#to_json" do
    subject { instance.to_json }
    let(:works) do
      instance_double(Hyrax::Statistics::Works::OverTime,
                      points: [['2017-02-16', '12']])
    end
    let(:collections) do
      instance_double(Hyrax::Statistics::Collections::OverTime,
                      points: [['2017-02-16', '3']])
    end

    before do
      allow(Hyrax::Statistics::Works::OverTime).to receive(:new).and_return(works)
      allow(Hyrax::Statistics::Collections::OverTime).to receive(:new).and_return(collections)
    end

    it "returns points" do
      expect(subject).to eq "[{\"y\":\"2017-02-16\",\"a\":\"12\",\"b\":\"3\"}]"
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hyrax-1.1.1 spec/presenters/hyrax/admin/repository_growth_presenter_spec.rb
hyrax-1.1.0 spec/presenters/hyrax/admin/repository_growth_presenter_spec.rb
hyrax-1.0.5 spec/presenters/hyrax/admin/repository_growth_presenter_spec.rb
hyrax-1.0.4 spec/presenters/hyrax/admin/repository_growth_presenter_spec.rb
hyrax-1.0.3 spec/presenters/hyrax/admin/repository_growth_presenter_spec.rb
hyrax-1.0.2 spec/presenters/hyrax/admin/repository_growth_presenter_spec.rb
hyrax-1.0.1 spec/presenters/hyrax/admin/repository_growth_presenter_spec.rb
hyrax-1.0.0.rc2 spec/presenters/hyrax/admin/repository_growth_presenter_spec.rb
hyrax-1.0.0.rc1 spec/presenters/hyrax/admin/repository_growth_presenter_spec.rb