Sha256: 7da4efbea0d97254d74809fa03c8625716bc664e272dc7a6f072ca0217a20f85

Contents?: true

Size: 1.49 KB

Versions: 15

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'

describe CurationConcerns::Actors::FileActor do
  include ActionDispatch::TestProcess
  include CurationConcerns::FactoryHelpers

  let(:user) { create(:user) }
  let(:file_set) { create(:file_set) }
  let(:relation) { create(:file_set) }
  let(:actor) { described_class.new(file_set, 'remastered', user) }
  let(:uploaded_file) { fixture_file_upload('/world.png', 'image/png') }

  describe '#ingest_file' do
    it 'calls ingest file job' do
      expect(IngestFileJob).to receive(:perform_later).with(file_set, /world\.png$/, 'image/png', user, 'remastered')
      actor.ingest_file(uploaded_file)
    end
  end

  describe '#revert_to' do
    let(:revision_id)      { 'asdf1234' }
    let(:previous_version) { mock_file_factory }
    let(:file_path)        { 'path/to/working_file' }

    before do
      allow(file_set).to receive(:remastered).and_return(previous_version)
      allow(previous_version).to receive(:restore_version).with(revision_id)
      allow(previous_version).to receive(:original_name).and_return('original_name')
    end

    it 'reverts to a previous version of a file' do
      expect(CurationConcerns::VersioningService).to receive(:create).with(previous_version, user)
      expect(CurationConcerns::WorkingDirectory).to receive(:copy_repository_resource_to_working_directory).with(previous_version, file_set.id).and_return(file_path)
      expect(CharacterizeJob).to receive(:perform_later).with(file_set, file_path)
      actor.revert_to(revision_id)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
curation_concerns-1.4.0 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.3.3 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.3.2 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.3.1 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.3.0 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.2.0 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.1.2 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.1.1 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.1.0 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.0.0 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.0.0.beta10 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.0.0.beta9 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.0.0.beta8 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.0.0.beta7 spec/actors/curation_concerns/file_actor_spec.rb
curation_concerns-1.0.0.beta6 spec/actors/curation_concerns/file_actor_spec.rb