From 8bf9a57a9e7a1cc1237c454d47834d381108e4af Mon Sep 17 00:00:00 2001 From: Heitor Reis Date: Thu, 1 Oct 2015 14:21:01 -0300 Subject: [PATCH] Rename MetricResult to TreeMetricResult on unit tests --- app/models/module_result.rb | 2 +- spec/factories/metric_results.rb | 24 ------------------------ spec/factories/tree_metric_results.rb | 24 ++++++++++++++++++++++++ spec/helpers/processings_helper_spec.rb | 2 +- spec/models/module_result_spec.rb | 4 ++-- 5 files changed, 28 insertions(+), 28 deletions(-) delete mode 100644 spec/factories/metric_results.rb create mode 100644 spec/factories/tree_metric_results.rb diff --git a/app/models/module_result.rb b/app/models/module_result.rb index 2f06d06..2472b48 100644 --- a/app/models/module_result.rb +++ b/app/models/module_result.rb @@ -1,6 +1,6 @@ class ModuleResult < KalibroClient::Entities::Processor::ModuleResult def metric_history(name) - history = KalibroClient::Entities::Processor::MetricResult.history_of(name, self.id, processing.repository_id) + history = KalibroClient::Entities::Processor::TreeMetricResult.history_of(name, self.id, processing.repository_id) grade_history = Hash.new history.each { |date_metric_result| grade_history[date_metric_result.date] = date_metric_result.metric_result.value } diff --git a/spec/factories/metric_results.rb b/spec/factories/metric_results.rb deleted file mode 100644 index 046995a..0000000 --- a/spec/factories/metric_results.rb +++ /dev/null @@ -1,24 +0,0 @@ -# This file is part of KalibroEntities -# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -FactoryGirl.define do - factory :metric_result, class: KalibroClient::Entities::Processor::MetricResult do - id "42" - metric_configuration { FactoryGirl.build(:metric_configuration_with_id) } - value "10.0" - aggregated_value "21" - end -end diff --git a/spec/factories/tree_metric_results.rb b/spec/factories/tree_metric_results.rb new file mode 100644 index 0000000..503e341 --- /dev/null +++ b/spec/factories/tree_metric_results.rb @@ -0,0 +1,24 @@ +# This file is part of KalibroEntities +# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +FactoryGirl.define do + factory :metric_result, class: KalibroClient::Entities::Processor::TreeMetricResult do + id "42" + metric_configuration { FactoryGirl.build(:metric_configuration_with_id) } + value "10.0" + aggregated_value "21" + end +end diff --git a/spec/helpers/processings_helper_spec.rb b/spec/helpers/processings_helper_spec.rb index f9796de..c4fb995 100644 --- a/spec/helpers/processings_helper_spec.rb +++ b/spec/helpers/processings_helper_spec.rb @@ -17,7 +17,7 @@ describe ProcessingsHelper, :type => :helper do end end - describe 'find_range_snapshot', pending: 'broke after kalibro client major update' do + describe 'find_range_snapshot' do let(:metric_configuration) { FactoryGirl.build(:metric_configuration_with_id)} let(:metric_result) { FactoryGirl.build(:metric_result, {value: 6.0, metric_configuration: metric_configuration})} diff --git a/spec/models/module_result_spec.rb b/spec/models/module_result_spec.rb index 796d17f..208420c 100644 --- a/spec/models/module_result_spec.rb +++ b/spec/models/module_result_spec.rb @@ -4,7 +4,7 @@ describe ModuleResult, :type => :model do describe 'methods' do subject { FactoryGirl.build(:module_result) } - describe 'metric_history', pending: 'broke after kalibro client major update' do + describe 'metric_history' do let(:date_module_result) {FactoryGirl.build(:date_module_result)} let(:metric_configuration) { FactoryGirl.build(:another_metric_configuration_with_id) } let!(:metric_result) { FactoryGirl.build(:metric_result, metric_configuration: metric_configuration) } @@ -13,7 +13,7 @@ describe ModuleResult, :type => :model do before :each do subject.expects(:processing).returns(processing) date_module_result.expects(:metric_result).returns(metric_result) - KalibroClient::Entities::Processor::MetricResult.expects(:history_of).with(metric_configuration.metric.name, subject.id, processing.repository_id).returns([date_module_result]) + KalibroClient::Entities::Processor::TreeMetricResult.expects(:history_of).with(metric_configuration.metric.name, subject.id, processing.repository_id).returns([date_module_result]) end it 'should return the history for the given metric name' do -- libgit2 0.21.2