Commit b4fe5a76 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix UsersGroup specs

parent fcc1ba5b
...@@ -18,7 +18,7 @@ class UsersGroup < ActiveRecord::Base ...@@ -18,7 +18,7 @@ class UsersGroup < ActiveRecord::Base
attr_accessible :group_access, :user_id attr_accessible :group_access, :user_id
belongs_to :user belongs_to :user
belongs_to :project belongs_to :group
scope :guests, -> { where(group_access: GUEST) } scope :guests, -> { where(group_access: GUEST) }
scope :reporters, -> { where(group_access: REPORTER) } scope :reporters, -> { where(group_access: REPORTER) }
......
...@@ -13,10 +13,10 @@ describe UsersGroup do ...@@ -13,10 +13,10 @@ describe UsersGroup do
describe "Validation" do describe "Validation" do
let!(:users_group) { create(:users_group) } let!(:users_group) { create(:users_group) }
it { should validate_presence_of(:user) } it { should validate_presence_of(:user_id) }
it { should validate_uniqueness_of(:user_id).scoped_to(:group_id).with_message(/already exists/) } it { should validate_uniqueness_of(:user_id).scoped_to(:group_id).with_message(/already exists/) }
it { should validate_presence_of(:group) } it { should validate_presence_of(:group_id) }
it { should ensure_inclusion_of(:group_access).in_array(UsersGroup.group_access_roles.values) } it { should ensure_inclusion_of(:group_access).in_array(UsersGroup.group_access_roles.values) }
end end
......
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