BigW Consortium Gitlab

users_project_spec.rb 577 Bytes
Newer Older
gitlabhq committed
1 2 3 4 5 6 7 8 9
require 'spec_helper'

describe UsersProject do
  describe "Associations" do
    it { should belong_to(:project) }
    it { should belong_to(:user) }
  end

  describe "Validation" do
10 11
    let!(:users_project) { create(:users_project) }

gitlabhq committed
12
    it { should validate_presence_of(:user_id) }
13
    it { should validate_uniqueness_of(:user_id).scoped_to(:project_id).with_message(/already exists/) }
14

gitlabhq committed
15 16 17
    it { should validate_presence_of(:project_id) }
  end

Nihad Abbasov committed
18
  describe "Delegate methods" do
gitlabhq committed
19 20 21 22
    it { should respond_to(:user_name) }
    it { should respond_to(:user_email) }
  end
end