From 0d0cddc9ce20c5a7d8a2723d0aa620ca184a711a Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 31 Mar 2020 12:08:09 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/lib/feature/gitaly_spec.rb | 10 ++++++++++ spec/lib/gitlab/git/tree_spec.rb | 9 +++++++++ 2 files changed, 19 insertions(+) (limited to 'spec/lib') diff --git a/spec/lib/feature/gitaly_spec.rb b/spec/lib/feature/gitaly_spec.rb index afb522d05e1..08651c42276 100644 --- a/spec/lib/feature/gitaly_spec.rb +++ b/spec/lib/feature/gitaly_spec.rb @@ -32,5 +32,15 @@ describe Feature::Gitaly do it { is_expected.to be_a(Hash) } it { is_expected.to eq("gitaly-feature-mep-mep" => "true") } + + context 'when table does not exist' do + before do + allow(::Gitlab::Database).to receive(:cached_table_exists?).and_return(false) + end + + it 'returns an empty Hash' do + expect(subject).to eq({}) + end + end end end diff --git a/spec/lib/gitlab/git/tree_spec.rb b/spec/lib/gitlab/git/tree_spec.rb index d82acad866c..b254dd3f036 100644 --- a/spec/lib/gitlab/git/tree_spec.rb +++ b/spec/lib/gitlab/git/tree_spec.rb @@ -39,7 +39,10 @@ describe Gitlab::Git::Tree, :seed_helper do it { expect(dir.flat_path).to eq('encoding') } context :subdir do + # rubocop: disable Rails/FindBy + # This is not ActiveRecord where..first let(:subdir) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID, 'files').first } + # rubocop: enable Rails/FindBy it { expect(subdir).to be_kind_of Gitlab::Git::Tree } it { expect(subdir.id).to eq('a1e8f8d745cc87e3a9248358d9352bb7f9a0aeba') } @@ -50,7 +53,10 @@ describe Gitlab::Git::Tree, :seed_helper do end context :subdir_file do + # rubocop: disable Rails/FindBy + # This is not ActiveRecord where..first let(:subdir_file) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID, 'files/ruby').first } + # rubocop: enable Rails/FindBy it { expect(subdir_file).to be_kind_of Gitlab::Git::Tree } it { expect(subdir_file.id).to eq('7e3e39ebb9b2bf433b4ad17313770fbe4051649c') } @@ -63,7 +69,10 @@ describe Gitlab::Git::Tree, :seed_helper do context :flat_path do let(:filename) { 'files/flat/path/correct/content.txt' } let(:oid) { create_file(filename) } + # rubocop: disable Rails/FindBy + # This is not ActiveRecord where..first let(:subdir_file) { Gitlab::Git::Tree.where(repository, oid, 'files/flat').first } + # rubocop: enable Rails/FindBy let(:repository_rugged) { Rugged::Repository.new(File.join(SEED_STORAGE_PATH, TEST_REPO_PATH)) } it { expect(subdir_file.flat_path).to eq('files/flat/path/correct') } -- cgit v1.2.3