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/support/shared_examples/lib/gitlab/repository_size_checker_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/lib/gitlab/repository_size_checker_shared_examples.rb59
1 files changed, 41 insertions, 18 deletions
diff --git a/spec/support/shared_examples/lib/gitlab/repository_size_checker_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/repository_size_checker_shared_examples.rb
index bb909ffe82a..30413f206f8 100644
--- a/spec/support/shared_examples/lib/gitlab/repository_size_checker_shared_examples.rb
+++ b/spec/support/shared_examples/lib/gitlab/repository_size_checker_shared_examples.rb
@@ -17,35 +17,58 @@ RSpec.shared_examples 'checker size not over limit' do
end
RSpec.shared_examples 'checker size exceeded' do
- context 'when current size is below or equal to the limit' do
- let(:current_size) { 50 }
+ context 'when no change size provided' do
+ context 'when current size is below the limit' do
+ let(:current_size) { limit - 1 }
- it 'returns zero' do
- expect(subject.exceeded_size).to eq(0)
+ it 'returns zero' do
+ expect(subject.exceeded_size).to eq(0)
+ end
end
- end
- context 'when current size is over the limit' do
- let(:current_size) { 51 }
+ context 'when current size is equal to the limit' do
+ let(:current_size) { limit }
- it 'returns zero' do
- expect(subject.exceeded_size).to eq(1.megabytes)
+ it 'returns zero' do
+ expect(subject.exceeded_size).to eq(0)
+ end
end
- end
- context 'when change size will be over the limit' do
- let(:current_size) { 50 }
+ context 'when current size is over the limit' do
+ let(:current_size) { limit + 1 }
+ let(:total_repository_size_excess) { 1 }
- it 'returns zero' do
- expect(subject.exceeded_size(1.megabytes)).to eq(1.megabytes)
+ it 'returns a positive number' do
+ expect(subject.exceeded_size).to eq(1.megabyte)
+ end
end
end
- context 'when change size will not be over the limit' do
- let(:current_size) { 49 }
+ context 'when a change size is provided' do
+ let(:change_size) { 1.megabyte }
+
+ context 'when change size will be over the limit' do
+ let(:current_size) { limit }
+
+ it 'returns a positive number' do
+ expect(subject.exceeded_size(change_size)).to eq(1.megabyte)
+ end
+ end
+
+ context 'when change size will be at the limit' do
+ let(:current_size) { limit - 1 }
+
+ it 'returns zero' do
+ expect(subject.exceeded_size(change_size)).to eq(0)
+ end
+ end
+
+ context 'when change size will be under the limit' do
+ let(:current_size) { limit - 2 }
- it 'returns zero' do
- expect(subject.exceeded_size(1.megabytes)).to eq(0)
+ it 'returns zero' do
+ expect(subject.exceeded_size(change_size)).to eq(0)
+ end
end
end
end