Sha256: 5753e568555661f16167dc0fe061d75ada54319b7751f43279a0f01a2eeea1e9

Contents?: true

Size: 1.08 KB

Versions: 18

Compression:

Stored size: 1.08 KB

Contents

describe ContentDeleteEventJob do
  let(:user) { create(:user) }
  let(:mock_time) { Time.zone.at(1) }
  let(:event) do
    {
      action: "User <a href=\"/users/#{user.to_param}\">#{user.user_key}</a> has deleted object '#{curation_concern.id}'",
      timestamp: '1'
    }
  end

  before do
    allow(Time).to receive(:now).and_return(mock_time)
  end

  context 'with a FileSet' do
    let(:curation_concern) { create(:file_set, title: ['Hamlet'], user: user) }

    it "logs the event to the depositor's profile" do
      expect do
        described_class.perform_now(curation_concern.id, user)
      end.to change { user.profile_events.length }.by(1)
      expect(user.profile_events.first).to eq(event)
    end
  end

  context 'with a Work' do
    let(:curation_concern) { create(:generic_work, title: ['BethsMac'], user: user) }

    it "logs the event to the depositor's profile" do
      expect do
        described_class.perform_now(curation_concern.id, user)
      end.to change { user.profile_events.length }.by(1)
      expect(user.profile_events.first).to eq(event)
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
hyrax-1.1.1 spec/jobs/content_delete_event_job_spec.rb
hyrax-1.1.0 spec/jobs/content_delete_event_job_spec.rb
sufia-7.4.1 spec/jobs/content_delete_event_job_spec.rb
hyrax-1.0.5 spec/jobs/content_delete_event_job_spec.rb
sufia-7.4.0 spec/jobs/content_delete_event_job_spec.rb
hyrax-1.0.4 spec/jobs/content_delete_event_job_spec.rb
hyrax-1.0.3 spec/jobs/content_delete_event_job_spec.rb
hyrax-1.0.2 spec/jobs/content_delete_event_job_spec.rb
hyrax-1.0.1 spec/jobs/content_delete_event_job_spec.rb
hyrax-1.0.0.rc2 spec/jobs/content_delete_event_job_spec.rb
sufia-7.3.1 spec/jobs/content_delete_event_job_spec.rb
hyrax-1.0.0.rc1 spec/jobs/content_delete_event_job_spec.rb
sufia-7.3.0 spec/jobs/content_delete_event_job_spec.rb
sufia-7.3.0.rc3 spec/jobs/content_delete_event_job_spec.rb
sufia-7.3.0.rc2 spec/jobs/content_delete_event_job_spec.rb
sufia-7.3.0.rc1 spec/jobs/content_delete_event_job_spec.rb
test_hyrax-0.0.1.alpha spec/jobs/content_delete_event_job_spec.rb
sufia-7.2.0 spec/jobs/content_delete_event_job_spec.rb