github.com/scorpionis/hub@v2.2.1+incompatible/features/apply.feature (about) 1 Feature: hub apply 2 Background: 3 Given I am in "git://github.com/mislav/dotfiles.git" git repo 4 And I am "mislav" on github.com with OAuth token "OTOKEN" 5 And I make a commit 6 7 Scenario: Apply a local patch 8 When I run `hub apply some.patch` 9 Then the git command should be unchanged 10 And the file "README.md" should not exist 11 12 Scenario: Apply commits from pull request 13 Given the GitHub API server: 14 """ 15 get('/repos/mislav/dotfiles/pulls/387') { 16 halt 400 unless request.env['HTTP_ACCEPT'] == 'application/vnd.github.v3.patch;charset=utf-8' 17 generate_patch "Create a README" 18 } 19 """ 20 When I successfully run `hub apply -3 https://github.com/mislav/dotfiles/pull/387` 21 Then there should be no output 22 Then a file named "README.md" should exist 23 24 Scenario: Apply commits when TMPDIR is empty 25 Given $TMPDIR is "" 26 Given the GitHub API server: 27 """ 28 get('/repos/mislav/dotfiles/pulls/387') { 29 halt 400 unless request.env['HTTP_ACCEPT'] == 'application/vnd.github.v3.patch;charset=utf-8' 30 generate_patch "Create a README" 31 } 32 """ 33 When I successfully run `hub apply https://github.com/mislav/dotfiles/pull/387` 34 Then a file named "README.md" should exist 35 36 Scenario: Enterprise repo 37 Given I am in "git://git.my.org/mislav/dotfiles.git" git repo 38 And I am "mislav" on git.my.org with OAuth token "FITOKEN" 39 And "git.my.org" is a whitelisted Enterprise host 40 Given the GitHub API server: 41 """ 42 get('/api/v3/repos/mislav/dotfiles/pulls/387') { 43 halt 400 unless request.env['HTTP_ACCEPT'] == 'application/vnd.github.v3.patch;charset=utf-8' 44 generate_patch "Create a README" 45 } 46 """ 47 When I successfully run `hub apply https://git.my.org/mislav/dotfiles/pull/387` 48 Then a file named "README.md" should exist 49 50 Scenario: Apply patch from commit 51 Given the GitHub API server: 52 """ 53 get('/repos/davidbalbert/dotfiles/commits/fdb9921') { 54 halt 400 unless request.env['HTTP_ACCEPT'] == 'application/vnd.github.v3.patch;charset=utf-8' 55 generate_patch "Create a README" 56 } 57 """ 58 When I successfully run `hub apply https://github.com/davidbalbert/dotfiles/commit/fdb9921` 59 Then a file named "README.md" should exist 60 61 Scenario: Apply patch from gist 62 Given the GitHub API server: 63 """ 64 get('/gists/8da7fb575debd88c54cf', :host_name => 'api.github.com') { 65 json :files => { 66 'file.diff' => { 67 :raw_url => "https://gist.github.com/raw/8da7fb575debd88c54cf/SHA/file.diff" 68 } 69 } 70 } 71 get('/raw/8da7fb575debd88c54cf/SHA/file.diff', :host_name => 'gist.github.com') { 72 halt 400 unless request.env['HTTP_ACCEPT'] == 'text/plain;charset=utf-8' 73 generate_patch "Create a README" 74 } 75 """ 76 When I successfully run `hub apply https://gist.github.com/8da7fb575debd88c54cf` 77 Then a file named "README.md" should exist