Commit 505eb780 authored by Marc Shaw's avatar Marc Shaw

Merge branch 'pl-project-import-service-spec' into 'master'

Refactor project import service spec to stub provider without details

See merge request gitlab-org/gitlab!81000
parents cc8c9716 7d534208
......@@ -199,12 +199,13 @@ RSpec.describe Projects::ImportService do
context 'with valid importer' do
before do
stub_github_omniauth_provider
provider = double(:provider).as_null_object
stub_omniauth_setting(providers: [provider])
project.import_url = 'https://github.com/vim/vim.git'
project.import_type = 'github'
allow(project).to receive(:import_data).and_return(double.as_null_object)
allow(project).to receive(:import_data).and_return(double(:import_data).as_null_object)
end
it 'succeeds if importer succeeds' do
......@@ -296,22 +297,5 @@ RSpec.describe Projects::ImportService do
subject.execute
end
end
def stub_github_omniauth_provider
provider = ActiveSupport::InheritableOptions.new(
'name' => 'github',
'app_id' => 'asd123',
'app_secret' => 'asd123',
'args' => {
'client_options' => {
'site' => 'https://github.com/api/v3',
'authorize_url' => 'https://github.com/login/oauth/authorize',
'token_url' => 'https://github.com/login/oauth/access_token'
}
}
)
stub_omniauth_setting(providers: [provider])
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