summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/git/tree_spec.rb
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-07-24 14:36:31 +0100
committerPhil Hughes <me@iamphill.com>2017-07-24 14:36:31 +0100
commit4d2be5bbec25d60a8d478bda5bc83159f2c845b1 (patch)
treec3c28a833ccd2a6628d928acee44e62ccfcc6fd8 /spec/lib/gitlab/git/tree_spec.rb
parent1a2d180e3dfd8bdad94766a2e8b1195288c2b146 (diff)
parentd4c4dec80dc3abd39116440a3c291c19b27258e1 (diff)
downloadgitlab-ce-4d2be5bbec25d60a8d478bda5bc83159f2c845b1.tar.gz
Merge branch 'master' into sidebar-fly-out-sub-nav
Diffstat (limited to 'spec/lib/gitlab/git/tree_spec.rb')
-rw-r--r--spec/lib/gitlab/git/tree_spec.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/lib/gitlab/git/tree_spec.rb b/spec/lib/gitlab/git/tree_spec.rb
index 4b76a43e6b5..98ddd3c3664 100644
--- a/spec/lib/gitlab/git/tree_spec.rb
+++ b/spec/lib/gitlab/git/tree_spec.rb
@@ -1,8 +1,9 @@
require "spec_helper"
describe Gitlab::Git::Tree, seed_helper: true do
+ let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) }
+
context :repo do
- let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) }
let(:tree) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID) }
it { expect(tree).to be_kind_of Array }
@@ -74,4 +75,24 @@ describe Gitlab::Git::Tree, seed_helper: true do
it { expect(submodule.name).to eq('gitlab-shell') }
end
end
+
+ describe '#where' do
+ context 'with gitaly disabled' do
+ before do
+ allow(Gitlab::GitalyClient).to receive(:feature_enabled?).and_return(false)
+ end
+
+ it 'calls #tree_entries_from_rugged' do
+ expect(described_class).to receive(:tree_entries_from_rugged)
+
+ described_class.where(repository, SeedRepo::Commit::ID, '/')
+ end
+ end
+
+ it 'gets the tree entries from GitalyClient' do
+ expect_any_instance_of(Gitlab::GitalyClient::CommitService).to receive(:tree_entries)
+
+ described_class.where(repository, SeedRepo::Commit::ID, '/')
+ end
+ end
end