Skip to content

Commit

Permalink
Works and FileSets should support to_global_id
Browse files Browse the repository at this point in the history
So that you can send them to ActiveJob without writing a custom
serializer/deserializer.
  • Loading branch information
jcoyne committed Mar 30, 2016
1 parent 430cf42 commit e9c2367
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module FileSetBehavior
include CurationConcerns::RequiredMetadata
include CurationConcerns::Naming
include Hydra::AccessControls::Embargoable
include GlobalID::Identification

included do
attr_accessor :file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module CurationConcerns::WorkBehavior
include CurationConcerns::Naming
include CurationConcerns::RequiredMetadata
include Hydra::AccessControls::Embargoable
include GlobalID::Identification

included do
property :owner, predicate: RDF::URI.new('http://opaquenamespace.org/ns/hydra/owner'), multiple: false
Expand Down
6 changes: 6 additions & 0 deletions spec/models/file_set_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -613,4 +613,10 @@ def paranoid_edit_permissions
end
end
end

describe "#to_global_id" do
let(:file_set) { described_class.new(id: '123') }
subject { file_set.to_global_id }
it { is_expected.to be_kind_of GlobalID }
end
end
6 changes: 6 additions & 0 deletions spec/models/generic_work_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,10 @@
}.to change { FileSet.count }.by(-2)
end
end

describe "#to_global_id" do
let(:work) { described_class.new(id: '123') }
subject { work.to_global_id }
it { is_expected.to be_kind_of GlobalID }
end
end

0 comments on commit e9c2367

Please sign in to comment.