Sha256: 5ff6d792e3c125ed5cbd4b5d81d313d7c8937da38eadf83077de0526910dcca8
Contents?: true
Size: 1.08 KB
Versions: 8
Compression:
Stored size: 1.08 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) { { 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' } } 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
8 entries across 8 versions & 1 rubygems