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/models/concerns/limitable_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/models/concerns/limitable_shared_examples.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/support/shared_examples/models/concerns/limitable_shared_examples.rb b/spec/support/shared_examples/models/concerns/limitable_shared_examples.rb
index 0ff0895b861..3d393e6dcb5 100644
--- a/spec/support/shared_examples/models/concerns/limitable_shared_examples.rb
+++ b/spec/support/shared_examples/models/concerns/limitable_shared_examples.rb
@@ -1,6 +1,30 @@
# frozen_string_literal: true
RSpec.shared_examples 'includes Limitable concern' do
+ describe '#exceeds_limits?' do
+ let(:plan_limits) { create(:plan_limits, :default_plan) }
+
+ context 'without plan limits configured' do
+ it { expect(subject.exceeds_limits?).to eq false }
+ end
+
+ context 'without plan limits configured' do
+ before do
+ plan_limits.update!(subject.class.limit_name => 1)
+ end
+
+ it { expect(subject.exceeds_limits?).to eq false }
+
+ context 'with an existing model' do
+ before do
+ subject.clone.save!
+ end
+
+ it { expect(subject.exceeds_limits?).to eq true }
+ end
+ end
+ end
+
describe 'validations' do
let(:plan_limits) { create(:plan_limits, :default_plan) }