Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
Merge 41bb002 into 7b5e3b9
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Apr 18, 2019
2 parents 7b5e3b9 + 41bb002 commit e869d0b
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 78 deletions.
1 change: 0 additions & 1 deletion lib/dor-services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def logger
autoload :Describable
autoload :Publishable
autoload :Embargoable
autoload :Preservable
autoload :Eventable
autoload :Versionable
autoload :Discoverable
Expand Down
11 changes: 9 additions & 2 deletions lib/dor/models/abstract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ class Abstract < ::ActiveFedora::Base
include Rightsable
include Describable
include Versionable
include Processable
include Preservable

has_metadata name: 'provenanceMetadata',
type: ProvenanceMetadataDS,
label: 'Provenance Metadata'
has_metadata name: 'workflows',
type: Dor::WorkflowDs,
label: 'Workflows',
control_group: 'E',
autocreate: true

class_attribute :resource_indexer

Expand Down
11 changes: 0 additions & 11 deletions lib/dor/models/concerns/preservable.rb

This file was deleted.

15 changes: 0 additions & 15 deletions lib/dor/models/concerns/processable.rb

This file was deleted.

3 changes: 0 additions & 3 deletions lib/dor/models/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ class Item < Dor::Abstract
# Embargoable = Time limits and processes for embargoed materials.
# Governable = Relationships to collections and codified administrative policies.
# Identifiable = Object identity and source metadata.
# Itemizable = Hierarchical content metadata.
# Preservable = Provenance and technical metadata; preservation repository transfer.
# Processable = Workflow.
# Publishable = Transfer of metadata to discovery and access systems.
# Shelvable = Transfer of content to digital stacks.
# Geoable = Descriptive metadata for GIS in ISO 19139/19110.
Expand Down
4 changes: 0 additions & 4 deletions spec/indexers/describable_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
Class.new(Dor::Abstract) do
include Dor::Identifiable
include Dor::Describable
include Dor::Processable
# def self.name
# 'foo'
# end
end
end
before { stub_config }
Expand Down
8 changes: 1 addition & 7 deletions spec/indexers/processable_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@
require 'spec_helper'

RSpec.describe Dor::ProcessableIndexer do
let(:model) do
Class.new(Dor::Abstract) do
include Dor::Processable
end
end

before { stub_config }

after { unstub_config }

let(:obj) { instantiate_fixture('druid:ab123cd4567', model) }
let(:obj) { instantiate_fixture('druid:ab123cd4567', Dor::Item) }
let(:indexer) { described_class.new(resource: obj) }

describe '#simplified_status_code_disp_txt' do
Expand Down
1 change: 0 additions & 1 deletion spec/models/concerns/describable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
class DescribableItem < ActiveFedora::Base
include Dor::Identifiable
include Dor::Describable
include Dor::Processable
end
class SimpleItem < ActiveFedora::Base
include Dor::Describable
Expand Down
34 changes: 0 additions & 34 deletions spec/models/concerns/processable_spec.rb

This file was deleted.

29 changes: 29 additions & 0 deletions spec/models/item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,33 @@
expect(workflows.mimeType).to eq 'application/xml'
end
end

describe '#workflows' do
let(:item) { instantiate_fixture('druid:ab123cd4567', described_class) }

before do
stub_config
item.contentMetadata.content = '<contentMetadata/>'
end

it 'has a workflows datastream and workflows shortcut method' do
expect(item.datastreams['workflows']).to be_a(Dor::WorkflowDs)
expect(item.workflows).to eq(item.datastreams['workflows'])
end

it 'loads its content directly from the workflow service' do
expect(Dor::Config.workflow.client).to receive(:all_workflows_xml).with('druid:ab123cd4567').and_return('<workflows/>')
expect(item.workflows.content).to eq('<workflows/>')
end

it 'is able to invalidate the cache of its content' do
expect(Dor::Config.workflow.client).to receive(:all_workflows_xml).with('druid:ab123cd4567').and_return('<workflows/>')
expect(item.workflows.content).to eq('<workflows/>')
expect(item.workflows.content).to eq('<workflows/>') # should be cached copy
expect(Dor::Config.workflow.client).to receive(:all_workflows_xml).with('druid:ab123cd4567').and_return('<workflows>with some data</workflows>')
# pass refresh flag and should be refreshed copy
expect(item.workflows.content(true)).to eq('<workflows>with some data</workflows>')
expect(item.workflows.content).to eq('<workflows>with some data</workflows>')
end
end
end

0 comments on commit e869d0b

Please sign in to comment.