Commit 7fb2d94e authored by Z.J. van de Weg's avatar Z.J. van de Weg

Namespace can have only one chat team

parent df55d35f
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