File tree Expand file tree Collapse file tree 5 files changed +15
-13
lines changed
spec/unit/modulesync/git_service Expand file tree Collapse file tree 5 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -8,14 +8,14 @@ def self.instantiate(type:, options:)
88 endpoint = options [ :base_url ] || ENV . fetch ( 'GITHUB_BASE_URL' , 'https://api.github.com' )
99 token = options [ :token ] || ENV [ 'GITHUB_TOKEN' ]
1010 raise ModuleSync ::Error , 'No GitHub token specified to create a pull request' if token . nil?
11- require 'modulesync/pr /github'
12- return ModuleSync ::PR ::GitHub . new ( token , endpoint )
11+ require 'modulesync/git_service /github'
12+ ModuleSync ::GitService ::GitHub . new ( token , endpoint )
1313 when :gitlab
1414 endpoint = options [ :base_url ] || ENV . fetch ( 'GITLAB_BASE_URL' , 'https://gitlab.com/api/v4' )
1515 token = options [ :token ] || ENV [ 'GITLAB_TOKEN' ]
1616 raise ModuleSync ::Error , 'No GitLab token specified to create a merge request' if token . nil?
17- require 'modulesync/pr /gitlab'
18- return ModuleSync ::PR ::GitLab . new ( token , endpoint )
17+ require 'modulesync/git_service /gitlab'
18+ ModuleSync ::GitService ::GitLab . new ( token , endpoint )
1919 else
2020 raise ModuleSync ::Error , "Unable to manage a PR/MR for Git service: '#{ type } '"
2121 end
Original file line number Diff line number Diff line change 44require 'modulesync/util'
55
66module ModuleSync
7- module PR
7+ module GitService
88 # GitHub creates and manages pull requests on github.com or GitHub
99 # Enterprise installations.
1010 class GitHub
Original file line number Diff line number Diff line change 44require 'modulesync/util'
55
66module ModuleSync
7- module PR
7+ module GitService
88 # GitLab creates and manages merge requests on gitlab.com or private GitLab
99 # installations.
1010 class GitLab
Original file line number Diff line number Diff line change 11require 'spec_helper'
2- require 'modulesync/pr/github'
32
4- describe ModuleSync ::PR ::GitHub do
3+ require 'modulesync/git_service/github'
4+
5+ describe ModuleSync ::GitService ::GitHub do
56 context '::open_pull_request' do
67 before ( :each ) do
78 @git_repo = 'test/modulesync'
1617
1718 @client = double ( )
1819 allow ( Octokit ::Client ) . to receive ( :new ) . and_return ( @client )
19- @it = ModuleSync ::PR ::GitHub . new ( 'test' , 'https://api.github.com' )
20+ @it = ModuleSync ::GitService ::GitHub . new ( 'test' , 'https://api.github.com' )
2021 end
2122
2223 it 'submits PR when --pr is set' do
Original file line number Diff line number Diff line change 11require 'spec_helper'
2- require 'modulesync/pr/gitlab'
32
4- describe ModuleSync ::PR ::GitLab do
3+ require 'modulesync/git_service/gitlab'
4+
5+ describe ModuleSync ::GitService ::GitLab do
56 context '::open_pull_request' do
67 before ( :each ) do
78 @git_repo = 'test/modulesync'
89 @namespace , @repo_name = @git_repo . split ( '/' )
910 @options = {
1011 :pr => true ,
11- :pr_title => 'Test PR is submitted' ,
12+ :pr_title => 'Test MR is submitted' ,
1213 :branch => 'test' ,
1314 :message => 'Hello world' ,
1415 :pr_auto_merge => false ,
1516 }
1617
1718 @client = double ( )
1819 allow ( Gitlab ::Client ) . to receive ( :new ) . and_return ( @client )
19- @it = ModuleSync ::PR ::GitLab . new ( 'test' , 'https://gitlab.com/api/v4' )
20+ @it = ModuleSync ::GitService ::GitLab . new ( 'test' , 'https://gitlab.com/api/v4' )
2021 end
2122
2223 it 'submits MR when --pr is set' do
You can’t perform that action at this time.
0 commit comments