Implement UsersProject project_access validation
This commit is contained in:
parent
640018ba55
commit
1ba28aaef8
6 changed files with 8 additions and 5 deletions
|
@ -56,7 +56,7 @@ describe SystemHook do
|
|||
user = create(:user)
|
||||
project = create(:project)
|
||||
with_resque do
|
||||
project.users << user
|
||||
project.add_access(user, :admin)
|
||||
end
|
||||
WebMock.should have_requested(:post, @system_hook.url).with(body: /user_add_to_team/).once
|
||||
end
|
||||
|
@ -64,7 +64,7 @@ describe SystemHook do
|
|||
it "project_destroy hook" do
|
||||
user = create(:user)
|
||||
project = create(:project)
|
||||
project.users << user
|
||||
project.add_access(user, :admin)
|
||||
with_resque do
|
||||
project.users_projects.clear
|
||||
end
|
||||
|
|
|
@ -29,6 +29,7 @@ describe UsersProject do
|
|||
it { should validate_uniqueness_of(:user_id).scoped_to(:project_id).with_message(/already exists/) }
|
||||
|
||||
it { should validate_presence_of(:project) }
|
||||
it { should ensure_inclusion_of(:project_access).in_array(UsersProject.access_roles.values) }
|
||||
end
|
||||
|
||||
describe "Delegate methods" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue