diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2019-06-26 15:06:23 +0300 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2019-06-26 15:06:23 +0300 |
commit | 069cd1ca7e6204e9441ca7b9f7f45831dfd786f4 (patch) | |
tree | 3d771164b2693eb12141bc69cc372b9ba8561f64 /spec | |
parent | beb1c9aa85ee24183edc5c8eb7958eaa67406712 (diff) | |
parent | bde41ee866d0fe0b1bb5ece1130fb6e24d95ad17 (diff) |
Merge branch '62214-migrations-and-models' into 'master'
Step 1 of !28996: Adds models and migrations for Namespaces statistics
See merge request gitlab-org/gitlab-ce!29570
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 |