1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/spec/models/account_spec.rb

59 lines
1.2 KiB
Ruby

# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Account do
subject { create :personal_account }
it { is_expected.to belong_to(:person).optional }
it do
is_expected.to \
have_one(:user)
.dependent(:restrict_with_exception)
end
it do
is_expected.to \
have_many(:account_telegram_contacts)
.dependent(:restrict_with_exception)
end
it do
is_expected.to \
have_many(:own_membership_apps)
.class_name('MembershipApp')
.dependent(:restrict_with_exception)
end
it do
is_expected.to \
have_many(:passport_confirmations)
.dependent(:restrict_with_exception)
end
it { is_expected.not_to validate_presence_of :person }
it { is_expected.not_to validate_presence_of :user }
pending '.guests'
pending '#guest?'
describe '#add_role' do
context 'to guest account' do
subject { create :guest_account }
let(:result) { subject.add_role :superuser }
specify do
expect { result }.to \
raise_error RuntimeError, 'can not add role to guest account'
end
specify do
expect { result rescue nil }.not_to(
change { subject.roles.reload.count },
)
end
end
end
end