hydra-works icon indicating copy to clipboard operation
hydra-works copied to clipboard

Hydra::Works::AddFileToFileSet #find_or_create_file_for_rdf_uri fails to create original_file association

Open elrayle opened this issue 6 years ago • 0 comments

Descriptive summary

AddFileToFileSet is supposed to be able to process the use the file is playing in the fileset as either a symbol or a URI. But the code in the two methods that create the file through ActiveFedora are not equivalent. The find_or_create_file_for_rdf_uri method fails to create the original_file association which is needed to be able to reference the file from the fileset using the_file_set.original_file.

Expected behavior

Whether calling AddToFileSet with type as URI or symbol, it is expected that after the add, there will be an association method that can be used to access the file in the fileset.

the_file_set.original_file # is defined and returns the File

Actual behavior

the_file_set.original_file # raises method not found for original_file

find_or_create_file_for_symbol correctly creates original_file association

find_or_create_file_for_rdf_uri fails to create original_file association

Steps to reproduce the behavior

  let(:file_set) { Hydra::Works::FileSet.new }
  let(:type)  { RDF::URI.new('http://pcdm.org/use#originalFile') }
  let(:file)                { File.open(File.join(fixture_path, filename)) }

    it 'adds association method' do
      described_class.call(file_set, file, type)
      expect(file_set).to respond_to :original_file
    end

elrayle avatar Jun 21 '19 18:06 elrayle