diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-11-16 14:56:30 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-11-16 14:56:30 +0100 |
commit | d64183e1fa26ab77107e3a2a20be1fe4df3a1875 (patch) | |
tree | 00d7b51545c116ce67bb857fd1003ea381250584 /spec/models/chat_name_spec.rb | |
parent | c60437786bfe43344b4a5eb040437f73f37c6396 (diff) | |
download | gitlab-ce-d64183e1fa26ab77107e3a2a20be1fe4df3a1875.tar.gz |
Add most of specs for chat names
Diffstat (limited to 'spec/models/chat_name_spec.rb')
-rw-r--r-- | spec/models/chat_name_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/chat_name_spec.rb b/spec/models/chat_name_spec.rb new file mode 100644 index 00000000000..b02971cab82 --- /dev/null +++ b/spec/models/chat_name_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe ChatName, models: true do + 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 |