Sha256: 7a6276177c2a8d8919594ac4ebd3a09011faa12ec0444eea823aed8b037eeee8

Contents?: true

Size: 903 Bytes

Versions: 6

Compression:

Stored size: 903 Bytes

Contents

require 'spec_helper'

describe Sufia::VersionListPresenter, :no_clean do
  let(:resource_version) do
    ActiveFedora::VersionsGraph::ResourceVersion.new.tap do |v|
      v.uri = 'http://example.com/version1'
      v.label = 'version1'
      v.created = '2014-12-09T02:03:18.296Z'
    end
  end

  let(:resource_version2) do
    ActiveFedora::VersionsGraph::ResourceVersion.new.tap do |v|
      v.uri = 'http://example.com/version2'
      v.label = 'version2'
      v.created = '2014-12-19T02:03:18.296Z'
    end
  end

  subject { described_class.new([resource_version, resource_version2]) }

  describe "#each" do
    it "yields version_presenters" do
      versions_descending = []
      subject.each do |v|
        expect(v).to be_kind_of Sufia::VersionPresenter
        versions_descending.push(v.label)
      end
      expect(versions_descending).to eq ['version2', 'version1']
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sufia-6.7.0 spec/presenters/sufia/version_list_presenter_spec.rb
sufia-6.6.1 spec/presenters/sufia/version_list_presenter_spec.rb
sufia-6.6.0 spec/presenters/sufia/version_list_presenter_spec.rb
sufia-6.5.0 spec/presenters/sufia/version_list_presenter_spec.rb
sufia-6.4.0 spec/presenters/sufia/version_list_presenter_spec.rb
sufia-6.3.0 spec/presenters/sufia/version_list_presenter_spec.rb