From bde41ee866d0fe0b1bb5ece1130fb6e24d95ad17 Mon Sep 17 00:00:00 2001 From: Mayra Cabrera Date: Wed, 12 Jun 2019 16:11:14 -0500 Subject: Add two new ActiveRecord models - Namespace::Storagestatistics will persist root namespace statistics - Namespace::AggregationSchedule will save information when a new update to the namespace statistics needs to be scheduled Both tables use 'namespace_id' as primary key --- spec/models/namespace/aggregation_schedule_spec.rb | 7 +++++++ spec/models/namespace/root_storage_statistics_spec.rb | 10 ++++++++++ spec/models/namespace_spec.rb | 2 ++ 3 files changed, 19 insertions(+) create mode 100644 spec/models/namespace/aggregation_schedule_spec.rb create mode 100644 spec/models/namespace/root_storage_statistics_spec.rb (limited to 'spec/models') 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 -- cgit v1.2.1