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

RSpec.describe UserAccount, type: :model do
  it { should have_secure_password }
  it { should have_one(:cart) }
  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