summaryrefslogtreecommitdiff
path: root/spec/models/users/banned_user_spec.rb
blob: b55c4821d05ce627e226f5921226a5f453bf73a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Users::BannedUser do
  describe 'relationships' do
    it { is_expected.to belong_to(:user) }
  end

  describe 'validations' do
    before do
      create(:user, :banned)
    end

    it { is_expected.to validate_presence_of(:user) }

    it 'validates uniqueness of banned user id' do
      is_expected.to validate_uniqueness_of(:user_id).with_message("banned user already exists")
    end
  end
end