summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-07-25 17:26:52 -0400
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-08-07 23:33:40 -0400
commite363fbf71a7874de2352740b3f33350e5ec4cf54 (patch)
tree4868c4cb0b05272a3fb6a4e35b2f8d73d8778f02 /spec/lib
parentc21ae07e331ca14605410555d0582f14cb661bb6 (diff)
downloadgitlab-ce-e363fbf71a7874de2352740b3f33350e5ec4cf54.tar.gz
Move `deltas` and `diff_from_parents` logic to Gitlab::Git::Commit
This helps keep the abstraction layers simpler, and also keep the interface of those methods consistent, in case of implementation changes.
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb4
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb2
-rw-r--r--spec/lib/gitlab/gitaly_client/commit_service_spec.rb12
3 files changed, 5 insertions, 13 deletions
diff --git a/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb b/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb
index 18843cbe992..f4dfa53f050 100644
--- a/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb
+++ b/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb
@@ -170,7 +170,7 @@ describe Gitlab::BackgroundMigration::DeserializeMergeRequestDiffsAndCommits do
context 'when the merge request diffs are Rugged::Patch instances' do
let(:commits) { merge_request_diff.commits.map(&:to_hash) }
let(:first_commit) { merge_request.project.repository.commit(merge_request_diff.head_commit_sha) }
- let(:diffs) { first_commit.diff_from_parent.patches }
+ let(:diffs) { first_commit.rugged_diff_from_parent.patches }
let(:expected_diffs) { [] }
include_examples 'updated MR diff'
@@ -179,7 +179,7 @@ describe Gitlab::BackgroundMigration::DeserializeMergeRequestDiffsAndCommits do
context 'when the merge request diffs are Rugged::Diff::Delta instances' do
let(:commits) { merge_request_diff.commits.map(&:to_hash) }
let(:first_commit) { merge_request.project.repository.commit(merge_request_diff.head_commit_sha) }
- let(:diffs) { first_commit.diff_from_parent.deltas }
+ let(:diffs) { first_commit.rugged_diff_from_parent.deltas }
let(:expected_diffs) { [] }
include_examples 'updated MR diff'
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index 23a77865aff..858616117d5 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -759,7 +759,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
let(:options) { { ref: 'master', path: ['PROCESS.md', 'README.md'] } }
def commit_files(commit)
- commit.diff_from_parent.deltas.flat_map do |delta|
+ commit.rugged_diff_from_parent.deltas.flat_map do |delta|
[delta.old_file[:path], delta.new_file[:path]].uniq.compact
end
end
diff --git a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb
index a6c48c178b3..f4a715e43d6 100644
--- a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb
+++ b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb
@@ -46,18 +46,10 @@ describe Gitlab::GitalyClient::CommitService do
end
end
- it 'returns a Gitlab::Git::DiffCollection' do
+ it 'returns a Gitlab::GitalyClient::DiffStitcher' do
ret = client.diff_from_parent(commit)
- expect(ret).to be_kind_of(Gitlab::Git::DiffCollection)
- end
-
- it 'passes options to Gitlab::Git::DiffCollection' do
- options = { max_files: 31, max_lines: 13, from_gitaly: true }
-
- expect(Gitlab::Git::DiffCollection).to receive(:new).with(kind_of(Enumerable), options)
-
- client.diff_from_parent(commit, options)
+ expect(ret).to be_kind_of(Gitlab::GitalyClient::DiffStitcher)
end
end