diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-10-19 22:14:57 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-10-19 22:14:57 +0300 |
commit | 2fabd1a123e2bcbf8f372679cacd50fc1da11252 (patch) | |
tree | 670b838c7196b84ed434e6dcfa735c19c4121357 /spec/controllers/projects | |
parent | 357c794a49843ca9984642ddd091612e3200a8e3 (diff) | |
download | gitlab-ce-2fabd1a123e2bcbf8f372679cacd50fc1da11252.tar.gz |
Change the order of tested methods in project_members_controller_spec
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r-- | spec/controllers/projects/project_members_controller_spec.rb | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/spec/controllers/projects/project_members_controller_spec.rb b/spec/controllers/projects/project_members_controller_spec.rb index ea56bd72912..8519ebc1d5f 100644 --- a/spec/controllers/projects/project_members_controller_spec.rb +++ b/spec/controllers/projects/project_members_controller_spec.rb @@ -4,50 +4,6 @@ describe Projects::ProjectMembersController do let(:user) { create(:user) } let(:project) { create(:project, :public) } - describe 'POST apply_import' do - let(:another_project) { create(:project, :private) } - let(:member) { create(:user) } - - before do - project.team << [user, :master] - another_project.team << [member, :guest] - sign_in(user) - end - - shared_context 'import applied' do - before do - post(:apply_import, namespace_id: project.namespace, - project_id: project, - source_project_id: another_project.id) - end - end - - context 'when user can access source project members' do - before { another_project.team << [user, :guest] } - include_context 'import applied' - - it 'imports source project members' do - expect(project.team_members).to include member - expect(response).to set_flash.to 'Successfully imported' - expect(response).to redirect_to( - namespace_project_project_members_path(project.namespace, project) - ) - end - end - - context 'when user is not member of a source project' do - include_context 'import applied' - - it 'does not import team members' do - expect(project.team_members).not_to include member - end - - it 'responds with not found' do - expect(response.status).to eq 404 - end - end - end - describe 'GET index' do it 'renders index with 200 status code' do get :index, namespace_id: project.namespace, project_id: project @@ -228,4 +184,48 @@ describe Projects::ProjectMembersController do end end end + + describe 'POST apply_import' do + let(:another_project) { create(:project, :private) } + let(:member) { create(:user) } + + before do + project.team << [user, :master] + another_project.team << [member, :guest] + sign_in(user) + end + + shared_context 'import applied' do + before do + post(:apply_import, namespace_id: project.namespace, + project_id: project, + source_project_id: another_project.id) + end + end + + context 'when user can access source project members' do + before { another_project.team << [user, :guest] } + include_context 'import applied' + + it 'imports source project members' do + expect(project.team_members).to include member + expect(response).to set_flash.to 'Successfully imported' + expect(response).to redirect_to( + namespace_project_project_members_path(project.namespace, project) + ) + end + end + + context 'when user is not member of a source project' do + include_context 'import applied' + + it 'does not import team members' do + expect(project.team_members).not_to include member + end + + it 'responds with not found' do + expect(response.status).to eq 404 + end + end + end end |