Commit 5daad7da authored by Rémy Coutable's avatar Rémy Coutable

Reduce CE/EE diff in spec/controllers/projects/imports_controller_spec.rb

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent e42d97f5
require 'spec_helper'
describe Projects::ImportsController do
let(:user) { create(:user) }
let(:project) { create(:project) }
before do
sign_in(user)
project.add_master(user)
end
context 'POST #create' do
context 'mirror user is not the current user' do
it 'should only assign the current user' do
allow_any_instance_of(EE::Project).to receive(:add_import_job)
new_user = create(:user)
project.add_master(new_user)
post :create, namespace_id: project.namespace.to_param,
project_id: project,
project: { mirror: true, mirror_user_id: new_user.id, import_url: 'http://local.dev' },
format: :json
expect(project.reload.mirror).to eq(true)
expect(project.reload.mirror_user.id).to eq(user.id)
end
end
end
end
......@@ -11,13 +11,6 @@ describe Projects::ImportsController do
describe 'GET #show' do
context 'when repository does not exists' do
let(:project) { create(:project) }
before do
sign_in(user)
project.add_master(user)
end
it 'renders template' do
get :show, namespace_id: project.namespace.to_param, project_id: project
......@@ -126,23 +119,4 @@ describe Projects::ImportsController do
end
end
end
context 'POST #create' do
context 'mirror user is not the current user' do
it 'should only assign the current user' do
allow_any_instance_of(EE::Project).to receive(:add_import_job)
new_user = create(:user)
project.add_master(new_user)
post :create, namespace_id: project.namespace.to_param,
project_id: project,
project: { mirror: true, mirror_user_id: new_user.id, import_url: 'http://local.dev' },
format: :json
expect(project.reload.mirror).to eq(true)
expect(project.reload.mirror_user.id).to eq(user.id)
end
end
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