summaryrefslogtreecommitdiff
path: root/spec/models/user_account_spec.rb
blob: 6466fe80e2f44706540846c32da2c1c0c984405e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require 'rails_helper'

RSpec.describe UserAccount, type: :model do
  it { should have_secure_password }
  it { should validate_presence_of(:email) }
  it { should validate_presence_of(:first_name) }
  it { should validate_presence_of(:last_name) }
  it { should validate_inclusion_of(:role).in_array(%w[master regular]) }

  describe '#full_name' do
    it "renders the user's full name" do
      user = create(:user_account, first_name: 'Mobius', last_name: 'One')
      expect(user.full_name).to eq('Mobius One')
    end
  end
end