diff options
author | Robert Speicher <robert@gitlab.com> | 2017-03-17 20:41:44 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-03-17 20:41:44 +0300 |
commit | 5409a3c5b7cb1aa66de7a8702b862556d7d49298 (patch) | |
tree | 589f6e9c8a0029c700bd367b77b05fbb24d5625a /spec/models/commit_spec.rb | |
parent | c1b4f800f3a0fb5cc5c5f7a121a499ba6ed128c1 (diff) | |
parent | c0a4f527db7d3e10f843468522d574cdb5427e86 (diff) |
Merge branch 'feature/use-gitaly-for-commit-show' into 'master'
Use Gitaly for CommitController#show
See merge request !9629
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r-- | spec/models/commit_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 4b449546a30..980a1b70ef5 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -388,4 +388,32 @@ eos expect(described_class.valid_hash?('a' * 41)).to be false end end + + describe '#raw_diffs' do + context 'Gitaly commit_raw_diffs feature enabled' do + before do + allow(Gitlab::GitalyClient).to receive(:feature_enabled?).with(:commit_raw_diffs).and_return(true) + end + + context 'when a truthy deltas_only is not passed to args' do + it 'fetches diffs from Gitaly server' do + expect(Gitlab::GitalyClient::Commit).to receive(:diff_from_parent). + with(commit) + + commit.raw_diffs + end + end + + context 'when a truthy deltas_only is passed to args' do + it 'fetches diffs using Rugged' do + opts = { deltas_only: true } + + expect(Gitlab::GitalyClient::Commit).not_to receive(:diff_from_parent) + expect(commit.raw).to receive(:diffs).with(opts) + + commit.raw_diffs(opts) + end + end + end + end end |