Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/snippet_spec.rb')
-rw-r--r--spec/models/snippet_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb
index 8ce3718e3c1..9cced1f24ab 100644
--- a/spec/models/snippet_spec.rb
+++ b/spec/models/snippet_spec.rb
@@ -696,6 +696,23 @@ describe Snippet do
end
end
+ describe '#repository_size_checker' do
+ subject { build(:personal_snippet) }
+
+ let(:checker) { subject.repository_size_checker }
+ let(:current_size) { 60 }
+
+ before do
+ allow(subject.repository).to receive(:_uncached_size).and_return(current_size)
+ end
+
+ it 'sets up size checker', :aggregate_failures do
+ expect(checker.current_size).to eq(current_size.megabytes)
+ expect(checker.limit).to eq(Gitlab::CurrentSettings.snippet_size_limit)
+ expect(checker.enabled?).to be_truthy
+ end
+ end
+
describe '#can_cache_field?' do
using RSpec::Parameterized::TableSyntax