Commit 80898d91 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'zj-chat-teams-unique' into 'master'

Namespace can have only one chat team

See merge request !9769
parents 08223299 7fb2d94e
class ChatTeam < ActiveRecord::Base
validates :team_id, presence: true
validates :namespace, uniqueness: true
belongs_to :namespace
end
FactoryGirl.define do
factory :chat_team, class: ChatTeam do
sequence :team_id do |n|
"abcdefghijklm#{n}"
end
namespace factory: :group
end
end
require 'spec_helper'
describe ChatTeam, type: :model do
subject { create(:chat_team) }
# Associations
it { is_expected.to belong_to(:namespace) }
# Validations
it { is_expected.to validate_uniqueness_of(:namespace) }
# Fields
it { is_expected.to respond_to(:name) }
it { is_expected.to respond_to(:team_id) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment