diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-05-17 08:12:33 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-05-17 08:12:33 +0000 |
commit | 48877dfc7e9579674e8b768cc69c7bf2ef40bace (patch) | |
tree | 9dbc77848cce6749c2c6e514f795d303203f93dc /spec/controllers | |
parent | 2f7e0aba2fec30be86f2f6048fdb50e93b4365c8 (diff) | |
parent | dfdd88151092fde3e32729dd466ad9ba44e158c6 (diff) | |
download | gitlab-ce-48877dfc7e9579674e8b768cc69c7bf2ef40bace.tar.gz |
Merge branch 'zj-workhorse-commit-patch-diff' into 'master'
Workhorse to send raw diff and patch for commits
Closes gitaly#1196
See merge request gitlab-org/gitlab-ce!18974
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/commit_controller_spec.rb | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb index 694c64ae1ad..003fec8ac68 100644 --- a/spec/controllers/projects/commit_controller_spec.rb +++ b/spec/controllers/projects/commit_controller_spec.rb @@ -79,41 +79,18 @@ describe Projects::CommitController do end describe "as diff" do - include_examples "export as", :diff - let(:format) { :diff } + it "triggers workhorse to serve the request" do + go(id: commit.id, format: :diff) - it "should really only be a git diff" do - go(id: '66eceea0db202bb39c4e445e8ca28689645366c5', format: format) - - expect(response.body).to start_with("diff --git") - end - - it "is only be a git diff without whitespace changes" do - go(id: '66eceea0db202bb39c4e445e8ca28689645366c5', format: format, w: 1) - - expect(response.body).to start_with("diff --git") - - # without whitespace option, there are more than 2 diff_splits for other formats - diff_splits = assigns(:diffs).diff_files.first.diff.diff.split("\n") - expect(diff_splits.length).to be <= 2 + expect(response.headers[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-diff:") end end describe "as patch" do - include_examples "export as", :patch - let(:format) { :patch } - let(:commit2) { project.commit('498214de67004b1da3d820901307bed2a68a8ef6') } - - it "is a git email patch" do - go(id: commit2.id, format: format) - - expect(response.body).to start_with("From #{commit2.id}") - end - it "contains a git diff" do - go(id: commit2.id, format: format) + go(id: commit.id, format: :patch) - expect(response.body).to match(/^diff --git/) + expect(response.headers[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-format-patch:") end end |