From 7a976bab4fb382675daea3a5126e75c479dbd623 Mon Sep 17 00:00:00 2001 From: Yuri Rudman Date: Fri, 18 Oct 2019 12:07:48 -0400 Subject: [PATCH] added test coverage for TenanatQuota.format_quota_value --- spec/models/tenant_quota_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/models/tenant_quota_spec.rb b/spec/models/tenant_quota_spec.rb index 0f8d380ea36b..38ac24ef8ab0 100644 --- a/spec/models/tenant_quota_spec.rb +++ b/spec/models/tenant_quota_spec.rb @@ -244,6 +244,19 @@ end end + describe ".format_quota_value" do + let(:quota_name) { "cpu_allocated" } + let(:quota_description) { "Allocated Virtual CPUs" } + + it "returns quota description if field to format is 'tenant_quotas.name'" do + expect(described_class.format_quota_value("tenant_quotas.name", "something", quota_name )).to eq(quota_description) + end + + it "returns quota description if field to format is 'tenant_quotas.description'" do + expect(described_class.format_quota_value("tenant_quotas.description", "something", quota_name )).to eq(quota_description) + end + end + describe "#quota_hash" do it "has cpu_allocated attributes" do expect(described_class.new(:tenant => tenant, :name => "cpu_allocated", :value => 4096).tap(&:valid?).quota_hash).to eq(