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/namespace_spec.rb')
-rw-r--r--spec/models/namespace_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 647e279bf83..ed0b9063e32 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -285,6 +285,17 @@ RSpec.describe Namespace do
end
end
+ describe '.top_most' do
+ let_it_be(:namespace) { create(:namespace) }
+ let_it_be(:sub_namespace) { create(:namespace, parent: namespace) }
+
+ subject { described_class.top_most.ids }
+
+ it 'only contains root namespace' do
+ is_expected.to eq([namespace.id])
+ end
+ end
+
describe '#ancestors_upto' do
let(:parent) { create(:group) }
let(:child) { create(:group, parent: parent) }
@@ -1449,4 +1460,24 @@ RSpec.describe Namespace do
end
end
end
+
+ describe '#recent?' do
+ subject { namespace.recent? }
+
+ context 'when created more than 90 days ago' do
+ before do
+ namespace.update_attribute(:created_at, 91.days.ago)
+ end
+
+ it { is_expected.to be(false) }
+ end
+
+ context 'when created less than 90 days ago' do
+ before do
+ namespace.update_attribute(:created_at, 89.days.ago)
+ end
+
+ it { is_expected.to be(true) }
+ end
+ end
end