Sha256: 84be4d7759100bdaba5b72e46e06ebed51f0efb2ca47899cb81980d81d29affb

Contents?: true

Size: 1.15 KB

Versions: 10

Compression:

Stored size: 1.15 KB

Contents

describe ContentDepositorChangeEventJob do
  let(:user) { create(:user) }
  let(:another_user) { create(:user) }
  let(:generic_work) { create(:generic_work, title: ['BethsMac'], user: user) }
  let(:mock_time) { Time.zone.at(1) }
  let(:event) do
    { action: "User <a href=\"/users/#{user.to_param}\">#{user.user_key}</a> " \
                          "has transferred <a href=\"/concern/generic_works/#{generic_work.id}\">BethsMac</a> " \
                          "to user <a href=\"/users/#{another_user.to_param}\">#{another_user.user_key}</a>",
      timestamp: '1' }
  end
  before do
    allow(Time).to receive(:now).at_least(:once).and_return(mock_time)
  end

  it "logs the event to the proxy depositor's profile, the depositor's dashboard, and the FileSet" do
    expect do
      described_class.perform_now(generic_work, another_user)
    end.to change { user.profile_events.length }.by(1)
      .and change { another_user.events.length }.by(1)
      .and change { generic_work.events.length }.by(1)

    expect(user.profile_events.first).to eq(event)
    expect(another_user.events.first).to eq(event)
    expect(generic_work.events.first).to eq(event)
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 spec/jobs/content_depositor_change_event_job_spec.rb
hyrax-1.1.0 spec/jobs/content_depositor_change_event_job_spec.rb
hyrax-1.0.5 spec/jobs/content_depositor_change_event_job_spec.rb
hyrax-1.0.4 spec/jobs/content_depositor_change_event_job_spec.rb
hyrax-1.0.3 spec/jobs/content_depositor_change_event_job_spec.rb
hyrax-1.0.2 spec/jobs/content_depositor_change_event_job_spec.rb
hyrax-1.0.1 spec/jobs/content_depositor_change_event_job_spec.rb
hyrax-1.0.0.rc2 spec/jobs/content_depositor_change_event_job_spec.rb
hyrax-1.0.0.rc1 spec/jobs/content_depositor_change_event_job_spec.rb
test_hyrax-0.0.1.alpha spec/jobs/content_depositor_change_event_job_spec.rb