owner_cannot_leave_project_spec.rb and owner_cannot_request_access_to_his_project_spec.rb don't test the right thing
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
The tests:
- https://gitlab.com/gitlab-org/gitlab-ce/blob/bbb044e116fcc67368338e287065f60adb8d1f84/spec/features/projects/members/owner_cannot_leave_project_spec.rb and
- https://gitlab.com/gitlab-org/gitlab-ce/blob/8c8bdb79e53d04f7a9dbb9ff8d575f1f9111b371/spec/features/projects/members/owner_cannot_request_access_to_his_project_spec.rb
check that a string is not present in the page. However, if you change expect(page).not_to have_content 'Request Access' to the opposite - expect(page).to have_content 'Request Access', let the test fail and check the HTML output then you will notice that 404 page is rendered (which indeed does not contain the given string).
This happens, because the user does not have access to the project. project.team << [owner, :owner] does not work. In fact, it fails silently here - https://gitlab.com/gitlab-org/gitlab-ce/blob/8c8bdb79e53d04f7a9dbb9ff8d575f1f9111b371/app/models/members/project_member.rb#L36 because roles_hash does not include :owner.