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-5.1.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-5.0.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-4.1.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-4.0.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.24.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.23.1 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.23.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.22.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.21.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.20.1 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.20.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.19.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.18.1 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.18.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.17.1 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.17.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.16.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.15.1 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.15.0 spec/workflow/client/workflow_template_spec.rb
dor-workflow-client-3.14.0 spec/workflow/client/workflow_template_spec.rb