Sha256: 8dbbdfdd8afcdbe45514e4de512b6fe63d78b0bec85fe64df5c8bd28e27f99e1

Contents?: true

Size: 1.85 KB

Versions: 12

Compression:

Stored size: 1.85 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(:workflows) { 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(workflows).to all(be_kind_of Dor::Workflow::Response::Workflow)
      expect(workflows.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

12 entries across 12 versions & 1 rubygems

Version Path
dor-workflow-client-7.7.0 spec/dor/workflow/response/workflows_spec.rb
dor-workflow-client-7.6.1 spec/dor/workflow/response/workflows_spec.rb
dor-workflow-client-7.6.0 spec/dor/workflow/response/workflows_spec.rb
dor-workflow-client-7.5.0 spec/dor/workflow/response/workflows_spec.rb
dor-workflow-client-7.4.0 spec/dor/workflow/response/workflows_spec.rb
dor-workflow-client-7.3.0 spec/dor/workflow/response/workflows_spec.rb
dor-workflow-client-7.2.0 spec/dor/workflow/response/workflows_spec.rb
dor-workflow-client-7.1.0 spec/dor/workflow/response/workflows_spec.rb
dor-workflow-client-7.0.2 spec/dor/workflow/response/workflows_spec.rb
dor-workflow-client-7.0.1 spec/dor/workflow/response/workflows_spec.rb
dor-workflow-client-7.0.0 spec/dor/workflow/response/workflows_spec.rb
dor-workflow-client-6.0.0 spec/dor/workflow/response/workflows_spec.rb