diff options
author | Rémy Coutable <remy@rymai.me> | 2016-01-13 19:46:38 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-01-13 19:46:38 +0100 |
commit | 33ea09bdf9c05c60438f03ac1fe94b52615cd05e (patch) | |
tree | 93e4f76b5f03f6c5d24c0ee5aef849acc9bfa253 /spec/models | |
parent | 0c10aee59677e2dadfef6538a74fe1e28fcdd37e (diff) | |
parent | 1202355703b9357e85fffa308a25c86576f7bfa0 (diff) | |
download | gitlab-ce-33ea09bdf9c05c60438f03ac1fe94b52615cd05e.tar.gz |
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into fix/private-references
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/abuse_report_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/abuse_report_spec.rb b/spec/models/abuse_report_spec.rb index 46cab1644c7..f9be8fcbcfe 100644 --- a/spec/models/abuse_report_spec.rb +++ b/spec/models/abuse_report_spec.rb @@ -29,6 +29,22 @@ RSpec.describe AbuseReport, type: :model do it { is_expected.to validate_uniqueness_of(:user_id) } end + 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) + end + + it 'removes the user' do + report = build(:abuse_report) + + expect { report.remove_user }.to change { User.count }.by(-1) + end + end + describe '#notify' do it 'delivers' do expect(AbuseReportMailer).to receive(:notify).with(subject.id). |