gitlab-org--gitlab-foss/spec/features/security/project_access_spec.rb

475 lines
15 KiB
Ruby
Raw Normal View History

2011-10-08 17:36:38 -04:00
require 'spec_helper'
describe "Application access" do
describe "GET /" do
it { root_path.should be_allowed_for :admin }
it { root_path.should be_allowed_for :user }
it { root_path.should be_denied_for :visitor }
2011-10-08 17:36:38 -04:00
end
describe "GET /projects/new" do
it { new_project_path.should be_allowed_for :admin }
it { new_project_path.should be_allowed_for :user }
it { new_project_path.should be_denied_for :visitor }
2011-10-08 17:36:38 -04:00
end
describe "Project" do
Merge Request on forked projects The good: - You can do a merge request for a forked commit and it will merge properly (i.e. it does work). - Push events take into account merge requests on forked projects - Tests around merge_actions now present, spinach, and other rspec tests - Satellites now clean themselves up rather then recreate The questionable: - Events only know about target projects - Project's merge requests only hold on to MR's where they are the target - All operations performed in the satellite The bad: - Duplication between project's repositories and satellites (e.g. commits_between) (for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos) Fixes: Make test repos/satellites only create when needed -Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap) -project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually -fixed remote removal -How to merge renders properly -Update emails to show project/branches -Edit MR doesn't set target branch -Fix some failures on editing/creating merge requests, added a test -Added back a test around merge request observer -Clean up project_transfer_spec, Remove duplicate enable/disable observers -Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well -Signifant speed ups for tests -Update formatting ordering in notes_on_merge_requests -Remove wiki schema update Fixes for search/search results -Search results was using by_project for a list of projects, updated this to use in_projects -updated search results to reference the correct (target) project -udpated search results to print both sides of the merge request Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-04-25 10:15:33 -04:00
let(:project) { create(:project_with_code) }
2012-09-26 13:22:30 -04:00
Merge Request on forked projects The good: - You can do a merge request for a forked commit and it will merge properly (i.e. it does work). - Push events take into account merge requests on forked projects - Tests around merge_actions now present, spinach, and other rspec tests - Satellites now clean themselves up rather then recreate The questionable: - Events only know about target projects - Project's merge requests only hold on to MR's where they are the target - All operations performed in the satellite The bad: - Duplication between project's repositories and satellites (e.g. commits_between) (for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos) Fixes: Make test repos/satellites only create when needed -Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap) -project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually -fixed remote removal -How to merge renders properly -Update emails to show project/branches -Edit MR doesn't set target branch -Fix some failures on editing/creating merge requests, added a test -Added back a test around merge request observer -Clean up project_transfer_spec, Remove duplicate enable/disable observers -Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well -Signifant speed ups for tests -Update formatting ordering in notes_on_merge_requests -Remove wiki schema update Fixes for search/search results -Search results was using by_project for a list of projects, updated this to use in_projects -updated search results to reference the correct (target) project -udpated search results to print both sides of the merge request Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-04-25 10:15:33 -04:00
let(:master) { create(:user) }
let(:guest) { create(:user) }
2012-09-26 13:22:30 -04:00
let(:reporter) { create(:user) }
before do
2011-10-08 17:36:38 -04:00
# full access
2013-01-04 17:43:32 -05:00
project.team << [master, :master]
2012-09-26 13:22:30 -04:00
2011-10-08 17:36:38 -04:00
# readonly
2013-01-04 17:43:32 -05:00
project.team << [reporter, :reporter]
2011-10-08 17:36:38 -04:00
end
describe "GET /project_code" do
2012-09-26 13:22:30 -04:00
subject { project_path(project) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
it { should be_denied_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/tree/master" do
2013-01-04 17:49:43 -05:00
subject { project_tree_path(project, project.repository.root_ref) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
2011-10-08 17:36:38 -04:00
end
2012-09-26 13:22:30 -04:00
describe "GET /project_code/commits/master" do
2013-01-04 17:49:43 -05:00
subject { project_commits_path(project, project.repository.root_ref, limit: 1) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
2011-10-08 17:36:38 -04:00
end
2012-09-26 13:22:30 -04:00
describe "GET /project_code/commit/:sha" do
2013-01-04 17:43:32 -05:00
subject { project_commit_path(project, project.repository.commit) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
2011-10-08 17:36:38 -04:00
end
2012-09-26 13:22:30 -04:00
describe "GET /project_code/compare" do
subject { project_compare_index_path(project) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
2011-10-08 17:36:38 -04:00
end
describe "GET /project_code/team" do
2012-09-26 13:22:30 -04:00
subject { project_team_index_path(project) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
2011-10-08 17:36:38 -04:00
end
describe "GET /project_code/wall" do
2013-03-19 08:39:32 -04:00
subject { project_wall_path(project) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
2011-10-08 17:36:38 -04:00
end
describe "GET /project_code/blob" do
before do
2013-01-04 17:43:32 -05:00
commit = project.repository.commit
Merge Request on forked projects The good: - You can do a merge request for a forked commit and it will merge properly (i.e. it does work). - Push events take into account merge requests on forked projects - Tests around merge_actions now present, spinach, and other rspec tests - Satellites now clean themselves up rather then recreate The questionable: - Events only know about target projects - Project's merge requests only hold on to MR's where they are the target - All operations performed in the satellite The bad: - Duplication between project's repositories and satellites (e.g. commits_between) (for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos) Fixes: Make test repos/satellites only create when needed -Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap) -project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually -fixed remote removal -How to merge renders properly -Update emails to show project/branches -Edit MR doesn't set target branch -Fix some failures on editing/creating merge requests, added a test -Added back a test around merge request observer -Clean up project_transfer_spec, Remove duplicate enable/disable observers -Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well -Signifant speed ups for tests -Update formatting ordering in notes_on_merge_requests -Remove wiki schema update Fixes for search/search results -Search results was using by_project for a list of projects, updated this to use in_projects -updated search results to reference the correct (target) project -udpated search results to print both sides of the merge request Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-04-25 10:15:33 -04:00
path = commit.tree.contents.select { |i| i.is_a?(Grit::Blob) }.first.name
2012-09-26 13:22:30 -04:00
@blob_path = project_blob_path(project, File.join(commit.id, path))
2011-10-17 06:39:03 -04:00
end
2012-09-26 13:22:30 -04:00
it { @blob_path.should be_allowed_for master }
it { @blob_path.should be_allowed_for reporter }
it { @blob_path.should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { @blob_path.should be_denied_for guest }
2011-10-17 06:39:03 -04:00
it { @blob_path.should be_denied_for :user }
it { @blob_path.should be_denied_for :visitor }
2011-10-08 17:36:38 -04:00
end
describe "GET /project_code/edit" do
2012-09-26 13:22:30 -04:00
subject { edit_project_path(project) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_denied_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
2011-10-08 17:36:38 -04:00
end
2011-12-29 17:33:26 -05:00
describe "GET /project_code/deploy_keys" do
2012-09-26 13:22:30 -04:00
subject { project_deploy_keys_path(project) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_denied_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
2011-12-29 17:33:26 -05:00
end
describe "GET /project_code/issues" do
2012-09-26 13:22:30 -04:00
subject { project_issues_path(project) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
2011-10-08 17:36:38 -04:00
end
2011-10-16 17:07:10 -04:00
describe "GET /project_code/snippets" do
2012-09-26 13:22:30 -04:00
subject { project_snippets_path(project) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
2011-10-16 17:07:10 -04:00
end
2011-11-28 13:42:32 -05:00
describe "GET /project_code/merge_requests" do
2012-09-26 13:22:30 -04:00
subject { project_merge_requests_path(project) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
2011-11-28 13:42:32 -05:00
end
describe "GET /project_code/repository" do
2012-09-26 13:22:30 -04:00
subject { project_repository_path(project) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/repository/branches" do
2013-07-16 15:25:59 -04:00
subject { project_branches_path(project) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:43:42 -04:00
before do
# Speed increase
Project.any_instance.stub(:branches).and_return([])
end
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/repository/tags" do
2013-07-16 16:14:22 -04:00
subject { project_tags_path(project) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:43:42 -04:00
before do
# Speed increase
Project.any_instance.stub(:tags).and_return([])
end
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/hooks" do
2012-09-26 13:22:30 -04:00
subject { project_hooks_path(project) }
2012-08-25 13:43:55 -04:00
2012-09-26 13:22:30 -04:00
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
2012-09-26 13:22:30 -04:00
it { should be_denied_for guest }
2012-08-25 13:43:55 -04:00
it { should be_denied_for :user }
it { should be_denied_for :visitor }
end
2011-10-08 17:36:38 -04:00
end
describe "PublicProject" do
Merge Request on forked projects The good: - You can do a merge request for a forked commit and it will merge properly (i.e. it does work). - Push events take into account merge requests on forked projects - Tests around merge_actions now present, spinach, and other rspec tests - Satellites now clean themselves up rather then recreate The questionable: - Events only know about target projects - Project's merge requests only hold on to MR's where they are the target - All operations performed in the satellite The bad: - Duplication between project's repositories and satellites (e.g. commits_between) (for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos) Fixes: Make test repos/satellites only create when needed -Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap) -project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually -fixed remote removal -How to merge renders properly -Update emails to show project/branches -Edit MR doesn't set target branch -Fix some failures on editing/creating merge requests, added a test -Added back a test around merge request observer -Clean up project_transfer_spec, Remove duplicate enable/disable observers -Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well -Signifant speed ups for tests -Update formatting ordering in notes_on_merge_requests -Remove wiki schema update Fixes for search/search results -Search results was using by_project for a list of projects, updated this to use in_projects -updated search results to reference the correct (target) project -udpated search results to print both sides of the merge request Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-04-25 10:15:33 -04:00
let(:project) { create(:project_with_code) }
Merge Request on forked projects The good: - You can do a merge request for a forked commit and it will merge properly (i.e. it does work). - Push events take into account merge requests on forked projects - Tests around merge_actions now present, spinach, and other rspec tests - Satellites now clean themselves up rather then recreate The questionable: - Events only know about target projects - Project's merge requests only hold on to MR's where they are the target - All operations performed in the satellite The bad: - Duplication between project's repositories and satellites (e.g. commits_between) (for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos) Fixes: Make test repos/satellites only create when needed -Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap) -project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually -fixed remote removal -How to merge renders properly -Update emails to show project/branches -Edit MR doesn't set target branch -Fix some failures on editing/creating merge requests, added a test -Added back a test around merge request observer -Clean up project_transfer_spec, Remove duplicate enable/disable observers -Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well -Signifant speed ups for tests -Update formatting ordering in notes_on_merge_requests -Remove wiki schema update Fixes for search/search results -Search results was using by_project for a list of projects, updated this to use in_projects -updated search results to reference the correct (target) project -udpated search results to print both sides of the merge request Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-04-25 10:15:33 -04:00
let(:master) { create(:user) }
let(:guest) { create(:user) }
let(:reporter) { create(:user) }
Merge Request on forked projects The good: - You can do a merge request for a forked commit and it will merge properly (i.e. it does work). - Push events take into account merge requests on forked projects - Tests around merge_actions now present, spinach, and other rspec tests - Satellites now clean themselves up rather then recreate The questionable: - Events only know about target projects - Project's merge requests only hold on to MR's where they are the target - All operations performed in the satellite The bad: - Duplication between project's repositories and satellites (e.g. commits_between) (for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos) Fixes: Make test repos/satellites only create when needed -Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap) -project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually -fixed remote removal -How to merge renders properly -Update emails to show project/branches -Edit MR doesn't set target branch -Fix some failures on editing/creating merge requests, added a test -Added back a test around merge request observer -Clean up project_transfer_spec, Remove duplicate enable/disable observers -Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well -Signifant speed ups for tests -Update formatting ordering in notes_on_merge_requests -Remove wiki schema update Fixes for search/search results -Search results was using by_project for a list of projects, updated this to use in_projects -updated search results to reference the correct (target) project -udpated search results to print both sides of the merge request Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-04-25 10:15:33 -04:00
let(:admin) { create(:user) }
before do
# public project
project.public = true
project.save!
# full access
project.team << [master, :master]
# readonly
project.team << [reporter, :reporter]
end
describe "Project should be public" do
subject { project }
its(:public?) { should be_true }
end
describe "GET /project_code" do
subject { project_path(project) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/tree/master" do
subject { project_tree_path(project, project.repository.root_ref) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/commits/master" do
subject { project_commits_path(project, project.repository.root_ref, limit: 1) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/commit/:sha" do
subject { project_commit_path(project, project.repository.commit) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/compare" do
subject { project_compare_index_path(project) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/team" do
subject { project_team_index_path(project) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/wall" do
subject { project_wall_path(project) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/blob" do
before do
commit = project.repository.commit
Merge Request on forked projects The good: - You can do a merge request for a forked commit and it will merge properly (i.e. it does work). - Push events take into account merge requests on forked projects - Tests around merge_actions now present, spinach, and other rspec tests - Satellites now clean themselves up rather then recreate The questionable: - Events only know about target projects - Project's merge requests only hold on to MR's where they are the target - All operations performed in the satellite The bad: - Duplication between project's repositories and satellites (e.g. commits_between) (for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos) Fixes: Make test repos/satellites only create when needed -Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap) -project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually -fixed remote removal -How to merge renders properly -Update emails to show project/branches -Edit MR doesn't set target branch -Fix some failures on editing/creating merge requests, added a test -Added back a test around merge request observer -Clean up project_transfer_spec, Remove duplicate enable/disable observers -Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well -Signifant speed ups for tests -Update formatting ordering in notes_on_merge_requests -Remove wiki schema update Fixes for search/search results -Search results was using by_project for a list of projects, updated this to use in_projects -updated search results to reference the correct (target) project -udpated search results to print both sides of the merge request Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-04-25 10:15:33 -04:00
path = commit.tree.contents.select { |i| i.is_a?(Grit::Blob) }.first.name
@blob_path = project_blob_path(project, File.join(commit.id, path))
end
it { @blob_path.should be_allowed_for master }
it { @blob_path.should be_allowed_for reporter }
it { @blob_path.should be_allowed_for :admin }
it { @blob_path.should be_allowed_for guest }
it { @blob_path.should be_allowed_for :user }
it { @blob_path.should be_denied_for :visitor }
end
describe "GET /project_code/edit" do
subject { edit_project_path(project) }
it { should be_allowed_for master }
it { should be_denied_for reporter }
it { should be_allowed_for :admin }
it { should be_denied_for guest }
it { should be_denied_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/deploy_keys" do
subject { project_deploy_keys_path(project) }
it { should be_allowed_for master }
it { should be_denied_for reporter }
it { should be_allowed_for :admin }
it { should be_denied_for guest }
it { should be_denied_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/issues" do
subject { project_issues_path(project) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/snippets" do
subject { project_snippets_path(project) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/snippets/new" do
subject { new_project_snippet_path(project) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_denied_for guest }
it { should be_denied_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/merge_requests" do
subject { project_merge_requests_path(project) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/repository" do
subject { project_repository_path(project) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/repository/branches" do
2013-07-16 15:25:59 -04:00
subject { project_branches_path(project) }
before do
# Speed increase
Project.any_instance.stub(:branches).and_return([])
end
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/repository/tags" do
2013-07-16 16:14:22 -04:00
subject { project_tags_path(project) }
before do
# Speed increase
Project.any_instance.stub(:tags).and_return([])
end
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
describe "GET /project_code/hooks" do
subject { project_hooks_path(project) }
it { should be_allowed_for master }
it { should be_allowed_for reporter }
it { should be_allowed_for :admin }
it { should be_allowed_for guest }
it { should be_allowed_for :user }
it { should be_denied_for :visitor }
end
end
2011-10-08 17:36:38 -04:00
end