2019-10-29 02:06:14 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-12-15 11:31:14 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
# Shared examples for a resource inside a Project
|
|
|
|
#
|
|
|
|
# By default it tests all the default REST actions: index, create, new, edit,
|
|
|
|
# show, update, and destroy. You can remove actions by customizing the
|
|
|
|
# `actions` variable.
|
|
|
|
#
|
|
|
|
# It also expects a `controller` variable to be available which defines both
|
|
|
|
# the path to the resource as well as the controller name.
|
|
|
|
#
|
|
|
|
# Examples
|
|
|
|
#
|
|
|
|
# # Default behavior
|
|
|
|
# it_behaves_like 'RESTful project resources' do
|
|
|
|
# let(:controller) { 'issues' }
|
|
|
|
# end
|
|
|
|
#
|
|
|
|
# # Customizing actions
|
|
|
|
# it_behaves_like 'RESTful project resources' do
|
|
|
|
# let(:actions) { [:index] }
|
|
|
|
# let(:controller) { 'issues' }
|
|
|
|
# end
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.shared_examples 'importer routing' do
|
2016-12-15 11:31:14 -05:00
|
|
|
let(:except_actions) { [] }
|
2018-11-07 11:44:21 -05:00
|
|
|
let(:is_realtime) { false }
|
|
|
|
|
|
|
|
before do
|
|
|
|
except_actions.push(is_realtime ? :jobs : :realtime_changes)
|
|
|
|
end
|
2016-12-15 11:31:14 -05:00
|
|
|
|
|
|
|
it 'to #create' do
|
|
|
|
expect(post("/import/#{provider}")).to route_to("import/#{provider}#create") unless except_actions.include?(:create)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'to #new' do
|
|
|
|
expect(get("/import/#{provider}/new")).to route_to("import/#{provider}#new") unless except_actions.include?(:new)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'to #status' do
|
|
|
|
expect(get("/import/#{provider}/status")).to route_to("import/#{provider}#status") unless except_actions.include?(:status)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'to #callback' do
|
|
|
|
expect(get("/import/#{provider}/callback")).to route_to("import/#{provider}#callback") unless except_actions.include?(:callback)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'to #jobs' do
|
|
|
|
expect(get("/import/#{provider}/jobs")).to route_to("import/#{provider}#jobs") unless except_actions.include?(:jobs)
|
|
|
|
end
|
2018-11-07 11:44:21 -05:00
|
|
|
|
|
|
|
it 'to #realtime_changes' do
|
|
|
|
expect(get("/import/#{provider}/realtime_changes")).to route_to("import/#{provider}#realtime_changes") unless except_actions.include?(:realtime_changes)
|
|
|
|
end
|
2016-12-15 11:31:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
# personal_access_token_import_github POST /import/github/personal_access_token(.:format) import/github#personal_access_token
|
|
|
|
# status_import_github GET /import/github/status(.:format) import/github#status
|
|
|
|
# callback_import_github GET /import/github/callback(.:format) import/github#callback
|
2018-11-07 11:44:21 -05:00
|
|
|
# realtime_changes_import_github GET /import/github/realtime_changes(.:format) import/github#jobs
|
2016-12-15 11:31:14 -05:00
|
|
|
# import_github POST /import/github(.:format) import/github#create
|
|
|
|
# new_import_github GET /import/github/new(.:format) import/github#new
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe Import::GithubController, 'routing' do
|
2016-12-15 11:31:14 -05:00
|
|
|
it_behaves_like 'importer routing' do
|
|
|
|
let(:provider) { 'github' }
|
2018-11-07 11:44:21 -05:00
|
|
|
let(:is_realtime) { true }
|
2016-12-15 11:31:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'to #personal_access_token' do
|
|
|
|
expect(post('/import/github/personal_access_token')).to route_to('import/github#personal_access_token')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# personal_access_token_import_gitea POST /import/gitea/personal_access_token(.:format) import/gitea#personal_access_token
|
|
|
|
# status_import_gitea GET /import/gitea/status(.:format) import/gitea#status
|
2018-11-07 11:44:21 -05:00
|
|
|
# realtime_changes_import_gitea GET /import/gitea/realtime_changes(.:format) import/gitea#jobs
|
2016-12-15 11:31:14 -05:00
|
|
|
# import_gitea POST /import/gitea(.:format) import/gitea#create
|
|
|
|
# new_import_gitea GET /import/gitea/new(.:format) import/gitea#new
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe Import::GiteaController, 'routing' do
|
2016-12-15 11:31:14 -05:00
|
|
|
it_behaves_like 'importer routing' do
|
|
|
|
let(:except_actions) { [:callback] }
|
|
|
|
let(:provider) { 'gitea' }
|
2018-11-07 11:44:21 -05:00
|
|
|
let(:is_realtime) { true }
|
2016-12-15 11:31:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'to #personal_access_token' do
|
|
|
|
expect(post('/import/gitea/personal_access_token')).to route_to('import/gitea#personal_access_token')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-07-16 20:09:37 -04:00
|
|
|
# status_import_gitlab GET /import/gitlab/status(.:format) import/gitlab#status
|
|
|
|
# callback_import_gitlab GET /import/gitlab/callback(.:format) import/gitlab#callback
|
|
|
|
# realtime_changes_import_gitlab GET /import/gitlab/realtime_changes(.:format) import/gitlab#realtime_changes
|
|
|
|
# import_gitlab POST /import/gitlab(.:format) import/gitlab#create
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe Import::GitlabController, 'routing' do
|
2016-12-15 11:31:14 -05:00
|
|
|
it_behaves_like 'importer routing' do
|
|
|
|
let(:except_actions) { [:new] }
|
|
|
|
let(:provider) { 'gitlab' }
|
2020-07-16 20:09:37 -04:00
|
|
|
let(:is_realtime) { true }
|
2016-12-15 11:31:14 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-07-16 20:09:37 -04:00
|
|
|
# status_import_bitbucket GET /import/bitbucket/status(.:format) import/bitbucket#status
|
|
|
|
# callback_import_bitbucket GET /import/bitbucket/callback(.:format) import/bitbucket#callback
|
|
|
|
# realtime_changes_import_bitbucket GET /import/bitbucket/realtime_changes(.:format) import/bitbucket#realtime_changes
|
|
|
|
# import_bitbucket POST /import/bitbucket(.:format) import/bitbucket#create
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe Import::BitbucketController, 'routing' do
|
2016-12-15 11:31:14 -05:00
|
|
|
it_behaves_like 'importer routing' do
|
|
|
|
let(:except_actions) { [:new] }
|
|
|
|
let(:provider) { 'bitbucket' }
|
2020-07-16 20:09:37 -04:00
|
|
|
let(:is_realtime) { true }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# status_import_bitbucket_server GET /import/bitbucket_server/status(.:format) import/bitbucket_server#status
|
|
|
|
# callback_import_bitbucket_server GET /import/bitbucket_server/callback(.:format) import/bitbucket_server#callback
|
|
|
|
# realtime_changes_import_bitbucket_server GET /import/bitbucket_server/realtime_changes(.:format) import/bitbucket_server#realtime_changes
|
|
|
|
# new_import_bitbucket_server GET /import/bitbucket_server/new(.:format) import/bitbucket_server#new
|
|
|
|
# import_bitbucket_server POST /import/bitbucket_server(.:format) import/bitbucket_server#create
|
|
|
|
RSpec.describe Import::BitbucketServerController, 'routing' do
|
|
|
|
it_behaves_like 'importer routing' do
|
|
|
|
let(:provider) { 'bitbucket_server' }
|
|
|
|
let(:is_realtime) { true }
|
2016-12-15 11:31:14 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-07-16 20:09:37 -04:00
|
|
|
# status_import_fogbugz GET /import/fogbugz/status(.:format) import/fogbugz#status
|
|
|
|
# callback_import_fogbugz POST /import/fogbugz/callback(.:format) import/fogbugz#callback
|
|
|
|
# realtime_changes_import_fogbugz GET /import/fogbugz/realtime_changes(.:format) import/fogbugz#realtime_changes
|
|
|
|
# new_user_map_import_fogbugz GET /import/fogbugz/user_map(.:format) import/fogbugz#new_user_map
|
|
|
|
# create_user_map_import_fogbugz POST /import/fogbugz/user_map(.:format) import/fogbugz#create_user_map
|
|
|
|
# import_fogbugz POST /import/fogbugz(.:format) import/fogbugz#create
|
|
|
|
# new_import_fogbugz GET /import/fogbugz/new(.:format) import/fogbugz#new
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe Import::FogbugzController, 'routing' do
|
2016-12-15 11:31:14 -05:00
|
|
|
it_behaves_like 'importer routing' do
|
|
|
|
let(:except_actions) { [:callback] }
|
|
|
|
let(:provider) { 'fogbugz' }
|
2020-07-16 20:09:37 -04:00
|
|
|
let(:is_realtime) { true }
|
2016-12-15 11:31:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'to #callback' do
|
|
|
|
expect(post("/import/fogbugz/callback")).to route_to("import/fogbugz#callback")
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'to #new_user_map' do
|
|
|
|
expect(get('/import/fogbugz/user_map')).to route_to('import/fogbugz#new_user_map')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'to #create_user_map' do
|
|
|
|
expect(post('/import/fogbugz/user_map')).to route_to('import/fogbugz#create_user_map')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# import_gitlab_project POST /import/gitlab_project(.:format) import/gitlab_projects#create
|
|
|
|
# POST /import/gitlab_project(.:format) import/gitlab_projects#create
|
|
|
|
# new_import_gitlab_project GET /import/gitlab_project/new(.:format) import/gitlab_projects#new
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe Import::GitlabProjectsController, 'routing' do
|
2016-12-15 11:31:14 -05:00
|
|
|
it 'to #create' do
|
|
|
|
expect(post('/import/gitlab_project')).to route_to('import/gitlab_projects#create')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'to #new' do
|
|
|
|
expect(get('/import/gitlab_project/new')).to route_to('import/gitlab_projects#new')
|
|
|
|
end
|
|
|
|
end
|
2019-04-23 10:27:01 -04:00
|
|
|
|
|
|
|
# new_import_phabricator GET /import/phabricator/new(.:format) import/phabricator#new
|
|
|
|
# import_phabricator POST /import/phabricator(.:format) import/phabricator#create
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe Import::PhabricatorController, 'routing' do
|
2019-04-23 10:27:01 -04:00
|
|
|
it 'to #create' do
|
|
|
|
expect(post("/import/phabricator")).to route_to("import/phabricator#create")
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'to #new' do
|
|
|
|
expect(get("/import/phabricator/new")).to route_to("import/phabricator#new")
|
|
|
|
end
|
|
|
|
end
|