-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
submodule_add.feature
73 lines (68 loc) · 2.67 KB
/
submodule_add.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Feature: hub submodule add
Background:
Given I am "mislav" on github.com with OAuth token "OTOKEN"
Given I am in "dotfiles" git repo
# make existing repo in subdirectory so git clone isn't triggered
Given a git repo in "vendor/grit"
And I cd to "vendor/grit"
And I make 1 commit
And I cd to "../.."
Scenario: Add public submodule
Given the GitHub API server:
"""
get('/repos/mojombo/grit') {
json :private => false,
:name => 'grit', :owner => { :login => 'mojombo' },
:permissions => { :push => false }
}
"""
When I successfully run `hub submodule add mojombo/grit vendor/grit`
Then the "vendor/grit" submodule url should be "https://github.com/mojombo/grit.git"
And the output should contain exactly:
"""
Adding existing repo at 'vendor/grit' to the index\n
"""
Scenario: Add private submodule
Given the GitHub API server:
"""
get('/repos/mojombo/grit') {
json :private => false,
:name => 'grit', :owner => { :login => 'mojombo' },
:permissions => { :push => false }
}
"""
When I successfully run `hub submodule add -p mojombo/grit vendor/grit`
Then the "vendor/grit" submodule url should be "https://github.com/mojombo/grit.git"
Scenario: A submodule for my own repo is public nevertheless
Given the GitHub API server:
"""
get('/repos/mislav/grit') {
json :private => false,
:name => 'grit', :owner => { :login => 'mislav' },
:permissions => { :push => true }
}
"""
When I successfully run `hub submodule add grit vendor/grit`
Then the "vendor/grit" submodule url should be "https://github.com/mislav/grit.git"
Scenario: Add submodule with arguments
Given the GitHub API server:
"""
get('/repos/mojombo/grit') {
json :private => false,
:name => 'grit', :owner => { :login => 'mojombo' },
:permissions => { :push => false }
}
"""
When I successfully run `hub submodule add -b foo --name grit mojombo/grit vendor/grit`
Then "git submodule add -b foo --name grit https://github.com/mojombo/grit.git vendor/grit" should be run
Scenario: Add submodule with branch
Given the GitHub API server:
"""
get('/repos/mojombo/grit') {
json :private => false,
:name => 'grit', :owner => { :login => 'mojombo' },
:permissions => { :push => false }
}
"""
When I successfully run `hub submodule add --branch foo mojombo/grit vendor/grit`
Then "git submodule add --branch foo https://github.com/mojombo/grit.git vendor/grit" should be run