Skip to content

Instantly share code, notes, and snippets.

@owenthereal
Last active August 29, 2015 13:56
Show Gist options
  • Save owenthereal/8809130 to your computer and use it in GitHub Desktop.
Save owenthereal/8809130 to your computer and use it in GitHub Desktop.
diff features/alias.feature /Users/owen_ou/src/hub/features/alias.feature
10c10
< eval "$(gh alias -s)"\n
---
> eval "$(hub alias -s)"\n
20c20
< eval (gh alias -s)\n
---
> eval (hub alias -s)\n
30c30
< eval "$(gh alias -s)"\n
---
> eval "$(hub alias -s)"\n
38c38
< alias git=gh\n
---
> alias git=hub\n
46c46
< alias git=gh\n
---
> alias git=hub\n
54c54
< alias git=gh\n
---
> alias git=hub\n
62c62
< gh alias: unsupported shell
---
> hub alias: unsupported shell
diff features/authentication.feature /Users/owen_ou/src/hub/features/authentication.feature
9c9
< get('/authorizations') { json [] }
---
> get('/authorizations') { '[]' }
12,14c12
< unless auth.credentials == %w[mislav kitty]
< halt 401, json(:error => 'error')
< end
---
> halt 401 unless auth.credentials == %w[mislav kitty]
19,21c17
< unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
< halt 401, json(:error => 'error')
< end
---
> halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
25,27c21
< unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
< halt 401, json(:error => 'error')
< end
---
> halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
37,39c31,33
< And the file "../home/.config/gh" should contain "mislav"
< And the file "../home/.config/gh" should contain "OTOKEN"
< #And the file "../home/.config/gh" should have mode "0600"
---
> And the file "../home/.config/hub" should contain "user: MiSlAv"
> And the file "../home/.config/hub" should contain "oauth_token: OTOKEN"
> And the file "../home/.config/hub" should have mode "0600"
47,50c41
< unless auth.credentials == %w[mislav kitty]
< halt 401, json(:error => 'error')
< end
<
---
> halt 401 unless auth.credentials == %w[mislav kitty]
53c44
< {:token => 'OTOKEN', :app => {:url => 'http://owenou.com/gh'}}
---
> {:token => 'OTOKEN', :app => {:url => 'http://hub.github.com/'}}
68c59
< And the file "../home/.config/gh" should contain "OTOKEN"
---
> And the file "../home/.config/hub" should contain "oauth_token: OTOKEN"
76,78c67
< unless auth.credentials == %w[mislav kitty]
< halt 401, json(:error => 'error')
< end
---
> halt 401 unless auth.credentials == %w[mislav kitty]
80c69
< {:token => 'OTOKEN', :app => {:url => 'http://owenou.com/gh'}}
---
> {:token => 'OTOKEN', :app => {:url => 'http://hub.github.com/'}}
94c83
< And the file "../home/.config/gh" should contain "OTOKEN"
---
> And the file "../home/.config/hub" should contain "oauth_token: OTOKEN"
102,104c91
< unless auth.credentials == %w[mislav kitty]
< halt 401, json(:error => 'auth error')
< end
---
> halt 401 unless auth.credentials == %w[mislav kitty]
110c97
< Then the stderr should contain "401 - Error: auth error"
---
> Then the stderr should contain "Error creating repository: Unauthorized (HTTP 401)"
112c99
< #And the file "../home/.config/gh" should not exist
---
> And the file "../home/.config/hub" should not exist
120,123c107
< unless auth.credentials == %w[mislav kitty]
< halt 401, json(:error => 'error')
< end
<
---
> halt 401 unless auth.credentials == %w[mislav kitty]
125,126c109,110
< response.headers['X-GitHub-OTP'] = "required; application"
< halt 401, json(:error => 'two-factor authorization OTP code')
---
> response.headers['X-GitHub-OTP'] = "required;application"
> halt 401
128,130c112
<
< json [
< ]
---
> json [ ]
134,141c116,117
< unless auth.credentials == %w[mislav kitty]
< halt 401, json(:error => 'error')
< end
<
< unless params[:scopes]
< halt 412, json(:error => 'error')
< end
<
---
> halt 401 unless auth.credentials == %w[mislav kitty]
> halt 412 unless params[:scopes]
143,144c119,120
< response.headers['X-GitHub-OTP'] = "required; application"
< halt 401, json(:error => 'two-factor authentication OTP code')
---
> response.headers['X-GitHub-OTP'] = "required;application"
> halt 401
146d121
<
149d123
<
153d126
<
165c138
< And the file "../home/.config/gh" should contain "OTOKEN"
---
> And the file "../home/.config/hub" should contain "oauth_token: OTOKEN"
174c147
< halt 412, json(:error => 'error')
---
> status 412
179,180c152,153
< response.headers['X-GitHub-OTP'] = "required; application"
< halt 401, json(:error => 'error')
---
> response.headers['X-GitHub-OTP'] = "required;application"
> halt 401
184c157
< :app => {:url => 'http://owenou.com/gh'}
---
> :app => {:url => 'http://hub.github.com/'}
201c174
< And the file "../home/.config/gh" should contain "OTOKEN"
---
> And the file "../home/.config/hub" should contain "oauth_token: OTOKENSMS"
203d175
< @wip
207c179
< get('/authorizations') { json [] }
---
> get('/authorizations') { '[]' }
215,220c187
< post('/user/repos') {
< unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
< halt 401, json(:error => 'error')
< end
< json :full_name => 'mislav/dotfiles'
< }
---
> get('/repos/mislav/dotfiles') { status 200 }
227,228c194,195
< And the file "../home/.config/gh" should contain "mislav"
< And the file "../home/.config/gh" should contain "OTOKEN"
---
> And the file "../home/.config/hub" should contain "user: mislav"
> And the file "../home/.config/hub" should contain "oauth_token: OTOKEN"
diff features/browse.feature /Users/owen_ou/src/hub/features/browse.feature
6c6
< When I successfully run `hub browse -p mislav/dotfiles`
---
> When I successfully run `hub browse mislav/dotfiles`
12c12
< When I successfully run `hub browse -p dotfiles`
---
> When I successfully run `hub browse dotfiles`
18c18
< When I successfully run `hub browse -p dotfiles`
---
> When I successfully run `hub browse dotfiles`
22c22
< When I successfully run `hub browse -p mislav/dotfiles issues`
---
> When I successfully run `hub browse mislav/dotfiles issues`
26c26
< When I successfully run `hub browse -p mislav/dotfiles wiki`
---
> When I successfully run `hub browse mislav/dotfiles wiki`
30c30
< When I successfully run `hub browse -p mislav/dotfiles commits`
---
> When I successfully run `hub browse mislav/dotfiles commits`
34c34
< When I successfully run `hub browse -p mislav/dotfiles commit/4173c3b`
---
> When I successfully run `hub browse mislav/dotfiles commit/4173c3b`
38c38
< When I successfully run `hub browse -u -p mislav/dotfiles`
---
> When I successfully run `hub browse -u mislav/dotfiles`
50c50
< When I successfully run `hub browse commit/abcd1234`
---
> When I successfully run `hub browse -- commit/abcd1234`
83c83
< When I successfully run `hub browse commits`
---
> When I successfully run `hub browse -- commits`
100c100
< When I successfully run `hub browse commits`
---
> When I successfully run `hub browse -- commits`
105c105
< When I successfully run `hub browse pages`
---
> When I successfully run `hub browse -- pages`
108d107
< @wip
diff features/checkout.feature /Users/owen_ou/src/hub/features/checkout.feature
17c17
< :repo => { :id => 1, :private => false }
---
> :repo => { :private => false }
31c31
< :repo => { :id => 1, :private => false }
---
> :repo => { :private => false }
45c45
< :repo => { :id => 1, :private => true }
---
> :repo => { :private => true }
59c59
< :repo => { :id => 1, :private => false }
---
> :repo => { :private => false }
73c73
< :repo => { :id => 1, :private => false }
---
> :repo => { :private => false }
diff features/ci_status.feature /Users/owen_ou/src/hub/features/ci_status.feature
17c17
< When I run `hub ci-status -v the_sha`
---
> When I run `hub ci-status the_sha -v`
diff features/clone.feature /Users/owen_ou/src/hub/features/clone.feature
95c95
< When I successfully run `hub clone -p rtomayko/ronn --noop`
---
> When I successfully run `hub --noop clone -p rtomayko/ronn`
128d127
< @wip
141d139
< @wip
diff features/compare.feature /Users/owen_ou/src/hub/features/compare.feature
11c11
< Scenario: Compare complex branch
---
> Scenario: Compare complex branch
21c21
< git compare [-u] [USER] [<START>...]<END>
---
> hub compare [USER] [<START>...]<END>
31c31
< git compare [-u] [USER] [<START>...]<END>
---
> hub compare [USER] [<START>...]<END>
diff features/create.feature /Users/owen_ou/src/hub/features/create.feature
10c10
< assert :private => nil
---
> assert :private => false
104c104
< get('/repos/mislav/dotfiles') { json :url => "foo" }
---
> get('/repos/mislav/dotfiles') { status 200 }
diff features/fork.feature /Users/owen_ou/src/hub/features/fork.feature
10,24c10,12
< before do
< unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
< status 401
< json :message => "I haz fail!"
< end
< end
<
< get('/repos/mislav/dotfiles') do
< status 404
< json :message => "I haz fail!"
< end
<
< post('/repos/evilchelu/dotfiles/forks') do
< json :html_url => "https://github.com/mislav/coral/pull/12"
< end
---
> before { halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN' }
> get('/repos/mislav/dotfiles', :host_name => 'api.github.com') { 404 }
> post('/repos/evilchelu/dotfiles/forks', :host_name => 'api.github.com') { '' }
28c16,31
< And "git remote add -f mislav git@github.com:mislav/dotfiles.git" should be run
---
> And "git remote add -f mislav git://github.com/evilchelu/dotfiles.git" should be run
> And "git remote set-url mislav git@github.com:mislav/dotfiles.git" should be run
> And the url for "mislav" should be "git@github.com:mislav/dotfiles.git"
>
> Scenario: Fork the repository when origin URL is private
> Given the "origin" remote has url "git@github.com:evilchelu/dotfiles.git"
> Given the GitHub API server:
> """
> before { halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN' }
> get('/repos/mislav/dotfiles', :host_name => 'api.github.com') { 404 }
> post('/repos/evilchelu/dotfiles/forks', :host_name => 'api.github.com') { '' }
> """
> When I successfully run `hub fork`
> Then the output should contain exactly "new remote: mislav\n"
> And "git remote add -f mislav ssh://git@github.com/evilchelu/dotfiles.git" should be run
> And "git remote set-url mislav git@github.com:mislav/dotfiles.git" should be run
34,36c37
< post('/repos/evilchelu/dotfiles/forks') do
< json :repo => "repo"
< end
---
> post('/repos/evilchelu/dotfiles/forks') { '' }
45,48c46
< post('/repos/evilchelu/dotfiles/forks') do
< status 500
< json(:error => "I haz fail!")
< end
---
> post('/repos/evilchelu/dotfiles/forks') { halt 500 }
54c52
< 500 - Error: I haz fail!\n
---
> Error creating fork: Internal Server Error (HTTP 500)\n
88,92c86
< before do
< unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN'
< halt 401, json(:message => "I haz fail!")
< end
< end
---
> before { halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token OTOKEN' }
99c93
< 401 - I haz fail!
---
> Error creating fork: Unauthorized (HTTP 401)\n
105c99
< post('/repos/evilchelu/dotfiles/forks') { json :repo => 'repo' }
---
> post('/repos/evilchelu/dotfiles/forks') { '' }
116c110
< And the stderr should contain "Aborted: the origin remote doesn't point to a GitHub repository"
---
> And the stderr should contain "fatal: Not a git repository"
122c116
< And the stderr should contain:
---
> And the stderr should contain exactly:
124c118
< Aborted: the origin remote doesn't point to a GitHub repository
---
> Error: repository under 'origin' remote is not a GitHub project\n
130,136c124,125
< before do
< unless request.env['HTTP_AUTHORIZATION'] == 'token FITOKEN'
< status 401
< json :error => 'error'
< end
< end
< post('/api/v3/repos/evilchelu/dotfiles/forks') { json :repo => 'repo' }
---
> before { halt 401 unless request.env['HTTP_AUTHORIZATION'] == 'token FITOKEN' }
> post('/api/v3/repos/evilchelu/dotfiles/forks', :host_name => 'git.my.org') { '' }
diff features/merge.feature /Users/owen_ou/src/hub/features/merge.feature
14c14
< :repo => {:id => 1, :private => false}
---
> :repo => {:private => false}
37c37
< :repo => {:id => 1, :private => false}
---
> :repo => {:private => false}
58c58
< :repo => {:id => 1, :private => true}
---
> :repo => {:private => true}
diff features/pull_request.feature /Users/owen_ou/src/hub/features/pull_request.feature
37a38
> halt 400 if request.content_charset != 'utf-8'
45d45
< @wip
65c65
< post('/repos/origin/coral/pulls') { halt 404, json(:error => 'error') }
---
> post('/repos/origin/coral/pulls') { 404 }
69,73d68
< #Then the stderr should contain:
< #"""
< #Error creating pull request: Not Found (HTTP 404)
< #Are you sure that github.com/origin/coral exists?
< #"""
76c71,72
< 404 - Error: error
---
> Error creating pull request: Not Found (HTTP 404)
> Are you sure that github.com/origin/coral exists?
83c79
< halt 400 unless request.user_agent.include?('Octokit')
---
> halt 400 unless request.user_agent.include?('Hub')
136d131
< @wip
145,150c140
< if params[:title].include?("fail")
< status 422
< json(:message => "I haz fail!")
< return
< end
<
---
> halt 422 if params[:title].include?("fail")
160c150
< 422 - I haz fail!\n
---
> Error creating pull request: Unprocessable Entity (HTTP 422)\n
169d158
< @wip
194c183
< Then the stderr should contain "error using text editor for editing message"
---
> Then the stderr should contain "error using text editor for pull request message"
370c359,360
< 422 - I haz fail!\n
---
> Error creating pull request: Unprocessable Entity (HTTP 422)
> I haz fail!\n
383c373,377
< Then the output should contain exactly "https://github.com/mislav/coral/pull/92\n"
---
> Then the output should contain exactly:
> """
> https://github.com/mislav/coral/pull/92
> Warning: Issue to pull request conversion is deprecated and might not work in the future.\n
> """
446d439
< @wip
diff features/remote_add.feature /Users/owen_ou/src/hub/features/remote_add.feature
44d43
< @wip
diff features/steps.rb /Users/owen_ou/src/hub/features/steps.rb
4c4
< run_silent %(git config --global gh.protocol https)
---
> run_silent %(git config --global hub.protocol https)
12c12
< run_silent %(git config --global --add gh.host "#{host}")
---
> run_silent %(git config --global --add hub.host "#{host}")
30,33c30,32
< entry = {'user' => name, 'host' => host}
< entry['access_token'] = token if token
< cfg.delete_if { |i| i['user'] == name && i['host'] == host }
< cfg << entry
---
> entry = {'user' => name}
> entry['oauth_token'] = token if token
> cfg[host.downcase] = [entry]
111d109
< set_env 'GH_API_HOST', "http://127.0.0.1:#{@server.port}"
Common subdirectories: features/support and /Users/owen_ou/src/hub/features/support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment