summaryrefslogtreecommitdiff
path: root/spec/models/spam_log_spec.rb
blob: c4ec7625cb0ca3d31ed5ad771e5d2cdb88e52c9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require 'spec_helper'

describe SpamLog, models: true do
  describe 'associations' do
    it { is_expected.to belong_to(:user) }
  end

  describe 'validations' do
    it { is_expected.to validate_presence_of(:user) }
  end

  describe '#remove_user' do
    it 'blocks the user' do
      spam_log = build(:spam_log)

      expect { spam_log.remove_user }.to change { spam_log.user.blocked? }.to(true)
    end

    it 'removes the user' do
      spam_log = build(:spam_log)

      expect { spam_log.remove_user }.to change { User.count }.by(-1)
    end
  end
end