29 lines
786 B
Ruby
29 lines
786 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe TelegramChat do
|
|
subject { create :telegram_chat }
|
|
|
|
it do
|
|
is_expected.to \
|
|
have_one(:account_telegram_contact)
|
|
.dependent(:restrict_with_exception)
|
|
end
|
|
|
|
it { is_expected.to validate_presence_of :remote_id }
|
|
it { is_expected.to validate_presence_of :chat_type }
|
|
|
|
it { is_expected.not_to validate_presence_of :title }
|
|
it { is_expected.not_to validate_presence_of :username }
|
|
it { is_expected.not_to validate_presence_of :first_name }
|
|
it { is_expected.not_to validate_presence_of :last_name }
|
|
|
|
it { is_expected.to validate_uniqueness_of :remote_id }
|
|
|
|
it do
|
|
is_expected.to \
|
|
validate_inclusion_of(:chat_type)
|
|
.in_array(%w[private group supergroup channel])
|
|
end
|
|
end
|