diff options
author | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-03-07 13:46:37 +0100 |
---|---|---|
committer | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-03-15 21:09:25 +0100 |
commit | a09323c9f5df69a60d00278dec64775821751711 (patch) | |
tree | 9ec7ce6bc5cad1e47c8258776b30d2988a116998 /spec | |
parent | 4231cfeba5f6de519a8609b8aa8a6880e38c2414 (diff) | |
download | gitlab-ce-a09323c9f5df69a60d00278dec64775821751711.tar.gz |
Fix broken specs
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/abuse_report_spec.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/spec/models/abuse_report_spec.rb b/spec/models/abuse_report_spec.rb index 4799bbaa57c..8d16239bcb1 100644 --- a/spec/models/abuse_report_spec.rb +++ b/spec/models/abuse_report_spec.rb @@ -13,7 +13,8 @@ require 'rails_helper' RSpec.describe AbuseReport, type: :model do - subject { create(:abuse_report) } + subject { create(:abuse_report) } + let(:user) { create(:user) } it { expect(subject).to be_valid } @@ -31,17 +32,13 @@ RSpec.describe AbuseReport, type: :model do describe '#remove_user' do it 'blocks the user' do - report = build(:abuse_report) - - allow(report.user).to receive(:destroy) - - expect { report.remove_user }.to change { report.user.blocked? }.to(true) + expect { subject.remove_user(user) }.to change { subject.user.blocked? }.to(true) end - it 'removes the user' do - report = build(:abuse_report) + it 'lets a worker delete the user' do + expect(DeleteUserWorker).to receive(:perform_async).with(user.id, subject.user.id, force: true) - expect { report.remove_user }.to change { User.count }.by(-1) + subject.remove_user(user) end end |