summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-07-20 17:51:04 +0200
committerZ.J. van de Weg <git@zjvandeweg.nl>2016-12-01 13:54:02 +0100
commite038928234db133bb9dcb214b124a32027a13b27 (patch)
treeef3f2e7c003963dd7777eccf1a487067a9b17e71 /spec
parent43c8788e7bd4c705bc8215ea2409b21a19d090f7 (diff)
downloadgitlab-ce-commit-patch-diff-workhorse.tar.gz
Workhorse now sents raw commit diffs and patchescommit-patch-diff-workhorse
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/commit_controller_spec.rb35
-rw-r--r--spec/models/commit_spec.rb1
2 files changed, 6 insertions, 30 deletions
diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb
index 646b097d74e..8da5bfe1d7a 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-show-commit:")
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)
+ it "triggers workhorse to serve the request" do
+ 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-show-commit:")
end
end
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index e3bb3482d67..75c2e6ac7a7 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -120,7 +120,6 @@ eos
it { is_expected.to respond_to(:diffs) }
it { is_expected.to respond_to(:tree) }
it { is_expected.to respond_to(:id) }
- it { is_expected.to respond_to(:to_patch) }
end
describe '#closes_issues' do