diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories/namespace/aggregation_schedules.rb | 7 | ||||
-rw-r--r-- | spec/factories/namespace/root_storage_statistics.rb | 7 | ||||
-rw-r--r-- | spec/factories/namespaces.rb | 8 | ||||
-rw-r--r-- | spec/models/namespace/aggregation_schedule_spec.rb | 7 | ||||
-rw-r--r-- | spec/models/namespace/root_storage_statistics_spec.rb | 10 | ||||
-rw-r--r-- | spec/models/namespace_spec.rb | 2 |
6 files changed, 41 insertions, 0 deletions
diff --git a/spec/factories/namespace/aggregation_schedules.rb b/spec/factories/namespace/aggregation_schedules.rb new file mode 100644 index 00000000000..c172c3360e2 --- /dev/null +++ b/spec/factories/namespace/aggregation_schedules.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :namespace_aggregation_schedules, class: Namespace::AggregationSchedule do + namespace + end +end diff --git a/spec/factories/namespace/root_storage_statistics.rb b/spec/factories/namespace/root_storage_statistics.rb new file mode 100644 index 00000000000..54c5921eb44 --- /dev/null +++ b/spec/factories/namespace/root_storage_statistics.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :namespace_root_storage_statistics, class: Namespace::RootStorageStatistics do + namespace + end +end diff --git a/spec/factories/namespaces.rb b/spec/factories/namespaces.rb index 6feafa5ece9..0cfc6e3aa46 100644 --- a/spec/factories/namespaces.rb +++ b/spec/factories/namespaces.rb @@ -19,5 +19,13 @@ FactoryBot.define do owner.namespace = namespace end end + + trait :with_aggregation_schedule do + association :aggregation_schedule, factory: :namespace_aggregation_schedules + end + + trait :with_root_storage_statistics do + association :root_storage_statistics, factory: :namespace_root_storage_statistics + end end end diff --git a/spec/models/namespace/aggregation_schedule_spec.rb b/spec/models/namespace/aggregation_schedule_spec.rb new file mode 100644 index 00000000000..5ba7547ff4d --- /dev/null +++ b/spec/models/namespace/aggregation_schedule_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Namespace::AggregationSchedule, type: :model do + it { is_expected.to belong_to :namespace } +end diff --git a/spec/models/namespace/root_storage_statistics_spec.rb b/spec/models/namespace/root_storage_statistics_spec.rb new file mode 100644 index 00000000000..f6fb5af5aae --- /dev/null +++ b/spec/models/namespace/root_storage_statistics_spec.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Namespace::RootStorageStatistics, type: :model do + it { is_expected.to belong_to :namespace } + it { is_expected.to have_one(:route).through(:namespace) } + + it { is_expected.to delegate_method(:all_projects).to(:namespace) } +end diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index d80183af33e..30e49cf204f 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -15,6 +15,8 @@ describe Namespace do it { is_expected.to have_many :project_statistics } it { is_expected.to belong_to :parent } it { is_expected.to have_many :children } + it { is_expected.to have_one :root_storage_statistics } + it { is_expected.to have_one :aggregation_schedule } end describe 'validations' do |