From 610185864fa1b019f1e5b8d9db0eacd4ab1540fb Mon Sep 17 00:00:00 2001 From: Heitor Reis Date: Tue, 27 Jan 2015 14:15:19 -0200 Subject: [PATCH] Fixed unit tests --- Gemfile.lock | 4 ++-- spec/helpers/processings_helper_spec.rb | 2 +- spec/models/module_result_spec.rb | 7 ++++--- spec/models/reading_group_spec.rb | 4 ---- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3f5d27e..94b93e3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,8 @@ GIT remote: https://github.com/mezuro/kalibro_client - revision: 190e8b25819846b52eb1faff07f20f3a3ecad4c9 + revision: c87d4e5b55f768ba4e59f964ac9d8dcea94216d6 specs: - kalibro_client (1.0.0) + kalibro_client (0.0.1) activesupport (>= 2.2.1) faraday_middleware (~> 0.9.0) diff --git a/spec/helpers/processings_helper_spec.rb b/spec/helpers/processings_helper_spec.rb index eb80256..fc607a4 100644 --- a/spec/helpers/processings_helper_spec.rb +++ b/spec/helpers/processings_helper_spec.rb @@ -21,7 +21,7 @@ describe ProcessingsHelper, :type => :helper do let(:range_snapshot_10dot1_to_15) { FactoryGirl.build(:range_snapshot, {beginning: 10.1, end: 15.0}) } before :each do - metric_result.expects(:metric_configuration).returns(metric_result.metric_configuration) + metric_result.expects(:metric_configuration).returns(metric_configuration) metric_configuration.expects(:kalibro_ranges). returns([range_snapshot_1_to_5, range_snapshot_5dot1_to_10, diff --git a/spec/models/module_result_spec.rb b/spec/models/module_result_spec.rb index 925db53..42f0026 100644 --- a/spec/models/module_result_spec.rb +++ b/spec/models/module_result_spec.rb @@ -6,20 +6,21 @@ describe ModuleResult, :type => :model do describe 'metric_history' do let(:date_module_result) {FactoryGirl.build(:date_module_result)} - let!(:metric_result) { FactoryGirl.build(:metric_result, metric_configuration: FactoryGirl.build(:another_metric_configuration)) } + let(:metric_configuration) { FactoryGirl.build(:another_metric_configuration) } + let!(:metric_result) { FactoryGirl.build(:metric_result, metric_configuration: metric_configuration) } let(:processing) {FactoryGirl.build(:processing)} let(:repository) {FactoryGirl.build(:repository)} before :each do subject.expects(:processing).returns(processing) - metric_result.expects(:metric_configuration).returns(metric_result.metric_configuration) + metric_result.expects(:metric_configuration).returns(metric_configuration) processing.expects(:repository).returns(repository) repository.expects(:module_result_history_of).with(subject).returns([date_module_result]) ModuleResult.any_instance.expects(:metric_results).returns([metric_result]) end it 'should return the history for the given metric name' do - expect(subject.metric_history(metric_result.metric_configuration.metric.name)).to eq({date_module_result.date => metric_result.value}) + expect(subject.metric_history(metric_configuration.metric.name)).to eq({date_module_result.date => metric_result.value}) end end end diff --git a/spec/models/reading_group_spec.rb b/spec/models/reading_group_spec.rb index 9707d9b..b078814 100644 --- a/spec/models/reading_group_spec.rb +++ b/spec/models/reading_group_spec.rb @@ -6,10 +6,6 @@ describe ReadingGroup, :type => :model do before :each do @subject = FactoryGirl.build(:reading_group) end - - it 'should return false' do - expect(@subject.persisted?).to eq(false) - end end describe 'update' do -- libgit2 0.21.2