2011-10-08 21:36:38 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe UsersProject do
|
|
|
|
describe "Associations" do
|
|
|
|
it { should belong_to(:project) }
|
|
|
|
it { should belong_to(:user) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "Validation" do
|
2012-08-29 15:36:02 +00:00
|
|
|
let!(:users_project) { create(:users_project) }
|
|
|
|
|
2011-10-08 21:36:38 +00:00
|
|
|
it { should validate_presence_of(:user_id) }
|
2012-09-06 21:05:23 +00:00
|
|
|
it { should validate_uniqueness_of(:user_id).scoped_to(:project_id).with_message(/already exists/) }
|
2012-08-29 15:36:02 +00:00
|
|
|
|
2011-10-08 21:36:38 +00:00
|
|
|
it { should validate_presence_of(:project_id) }
|
|
|
|
end
|
|
|
|
|
2011-10-26 13:46:25 +00:00
|
|
|
describe "Delegate methods" do
|
2011-10-08 21:36:38 +00:00
|
|
|
it { should respond_to(:user_name) }
|
|
|
|
it { should respond_to(:user_email) }
|
|
|
|
end
|
|
|
|
end
|