2016-11-16 08:56:30 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe ChatName do
|
2016-11-16 08:56:30 -05:00
|
|
|
subject { create(:chat_name) }
|
|
|
|
|
|
|
|
it { is_expected.to belong_to(:service) }
|
|
|
|
it { is_expected.to belong_to(:user) }
|
|
|
|
|
|
|
|
it { is_expected.to validate_presence_of(:user) }
|
|
|
|
it { is_expected.to validate_presence_of(:service) }
|
|
|
|
it { is_expected.to validate_presence_of(:team_id) }
|
|
|
|
it { is_expected.to validate_presence_of(:chat_id) }
|
|
|
|
|
|
|
|
it { is_expected.to validate_uniqueness_of(:user_id).scoped_to(:service_id) }
|
|
|
|
it { is_expected.to validate_uniqueness_of(:chat_id).scoped_to(:service_id, :team_id) }
|
|
|
|
end
|