Sha256: d84b7e890d7666c99593441b8de76c9616a582399ccc4bcf95b2b6d898a78251

Contents?: true

Size: 1.84 KB

Versions: 18

Compression:

Stored size: 1.84 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Dor::Workflow::Response::Workflows do
  subject(:instance) { described_class.new(xml: xml) }

  describe '#pid' do
    subject { instance.pid }

    let(:xml) do
      <<~XML
        <workflows objectId="druid:mw971zk1113">
        </workflows>
      XML
    end
    it { is_expected.to eq 'druid:mw971zk1113' }
  end

  describe '#workflows' do
    subject { instance.workflows }

    let(:xml) do
      <<~XML
        <workflows objectId="druid:mw971zk1113">
          <workflow repository="dor" objectId="druid:mw971zk1113" id="assemblyWF">
          </workflow>
          <workflow repository="dor" objectId="druid:mw971zk1113" id="sdrPreservationWF">
          </workflow>
        </workflows>
      XML
    end

    it 'has children' do
      expect(subject).to all(be_kind_of Dor::Workflow::Response::Workflow)
      expect(subject.map(&:workflow_name)).to eq %w[assemblyWF sdrPreservationWF]
    end
  end

  describe '#errors_for' do
    subject { instance.errors_for(version: 2) }

    let(:xml) do
      <<~XML
        <workflows objectId="druid:mw971zk1113">
          <workflow repository="dor" objectId="druid:mw971zk1113" id="assemblyWF">
            <process version="1" status="error" errorMessage="err1" />
            <process version="2" status="error" errorMessage="err2" />
            <process version="2" status="complete" errorMessage="err3" />
          </workflow>
          <workflow repository="dor" objectId="druid:mw971zk1113" id="sdrPreservationWF">
            <process version="1" status="error" errorMessage="err4" />
            <process version="2" status="error" errorMessage="err5" />
            <process version="2" status="complete" errorMessage="err6" />
          </workflow>
        </workflows>
      XML
    end

    it { is_expected.to eq %w[err2 err5] }
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
dor-workflow-client-5.1.0 spec/models/response/workflows_spec.rb
dor-workflow-client-5.0.0 spec/models/response/workflows_spec.rb
dor-workflow-client-4.1.0 spec/models/response/workflows_spec.rb
dor-workflow-client-4.0.0 spec/models/response/workflows_spec.rb
dor-workflow-client-3.24.0 spec/models/response/workflows_spec.rb
dor-workflow-client-3.23.1 spec/models/response/workflows_spec.rb
dor-workflow-client-3.23.0 spec/models/response/workflows_spec.rb
dor-workflow-client-3.22.0 spec/models/response/workflows_spec.rb
dor-workflow-client-3.21.0 spec/models/response/workflows_spec.rb
dor-workflow-client-3.20.1 spec/models/response/workflows_spec.rb
dor-workflow-client-3.20.0 spec/models/response/workflows_spec.rb
dor-workflow-client-3.19.0 spec/models/response/workflows_spec.rb
dor-workflow-client-3.18.1 spec/models/response/workflows_spec.rb
dor-workflow-client-3.18.0 spec/models/response/workflows_spec.rb
dor-workflow-client-3.17.1 spec/models/response/workflows_spec.rb
dor-workflow-client-3.17.0 spec/models/response/workflows_spec.rb
dor-workflow-client-3.16.0 spec/models/response/workflows_spec.rb
dor-workflow-client-3.15.1 spec/models/response/workflows_spec.rb