Sha256: 41e1bca2e488dc54e72928f75bb845e5f8899eb230d270bf31d2e79b0ebadc73

Contents?: true

Size: 1.1 KB

Versions: 26

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Dor::Workflow::Client::WorkflowTemplate do
  let(:mock_requestor) { instance_double(Dor::Workflow::Client::Requestor, request: data) }

  let(:routes) { described_class.new(requestor: mock_requestor) }

  describe '#retrieve' do
    subject(:workflow_template) { routes.retrieve('accessionWF') }
    let(:data) { '{"processes":[{"name":"start-assembly"},{"name":"content-metadata-create"}]}' }

    it 'returns a workflow template' do
      expect(workflow_template['processes']).to eq [{ 'name' => 'start-assembly' },
                                                    { 'name' => 'content-metadata-create' }]
      expect(mock_requestor).to have_received(:request).with('workflow_templates/accessionWF')
    end
  end

  describe '#all' do
    subject(:workflow_templates) { routes.all }
    let(:data) { '["assemblyWF","registrationWF"]' }

    it 'returns a list of templates' do
      expect(workflow_templates).to eq %w[assemblyWF registrationWF]
      expect(mock_requestor).to have_received(:request).with('workflow_templates')
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
dor-workflow-client-3.13.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.12.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.11.1 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.11.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.10.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.9.0 spec/workflow/client/workflow_template_spec.rb