Sha256: 915794f117f36e56827887cf6fb3f3a8741af3409075d7923f871a0c6814dfdd

Contents?: true

Size: 1.3 KB

Versions: 66

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

describe CurationConcerns::VersionPresenter, :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(:presenter) { described_class.new(resource_version) }

  describe "#label" do
    subject { presenter.label }
    it { is_expected.to eq 'version1' }
  end

  describe "#uri" do
    subject { presenter.uri }
    it { is_expected.to eq 'http://example.com/version1' }
  end

  describe "#created" do
    before do
      # Stub out the local timezone to (+08:00)
      t2 = Time.new(2014, 12, 8, 18, 3, 18, 8)
      allow_any_instance_of(Time).to receive(:getlocal).and_return(t2)
    end
    subject { presenter.created }
    it { is_expected.to eq "December 8th, 2014 18:03" }
  end

  describe "#current?" do
    subject { presenter.current? }
    it { is_expected.to be false }

    context "when current! is set" do
      before { presenter.current! }
      it { is_expected.to be true }
    end
  end

  describe "#committer" do
    before do
      VersionCommitter.create(version_id: resource_version.uri, committer_login: 'jill')
    end
    subject { presenter.committer }
    it { is_expected.to eq 'jill' }
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.7.7 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-2.0.0 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-2.0.0.rc2 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.7.6 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.7.5 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.7.4 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.7.3 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.7.2 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-2.0.0.rc1 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.7.1 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.7.0 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.7.0.beta1 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.6.3 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.6.2 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.6.1 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.6.0 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.5.0 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.4.0 spec/presenters/curation_concerns/version_presenter_spec.rb
curation_concerns-1.3.3 spec/presenters/curation_concerns/version_presenter_spec.rb