Commit 84bde6fa5fc398080aab6bba03927a44fbb7e8cf

Authored by Alessandro Palmeira
1 parent 9cbf9d37

[Mezuro] Removed unnecessary lines on processing test

plugins/mezuro/test/unit/kalibro/processing_test.rb
1 require "test_helper" 1 require "test_helper"
2 2
3 require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/processing_fixtures" 3 require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/processing_fixtures"
4 -#TODO arrumar os testes de unidade  
5 class ProcessingTest < ActiveSupport::TestCase 4 class ProcessingTest < ActiveSupport::TestCase
6 5
7 def setup 6 def setup
@@ -11,12 +10,12 @@ class ProcessingTest &lt; ActiveSupport::TestCase @@ -11,12 +10,12 @@ class ProcessingTest &lt; ActiveSupport::TestCase
11 @repository_id = 31 10 @repository_id = 31
12 end 11 end
13 12
14 - should 'create project result from hash' do 13 + should 'create processing from hash' do
15 assert_equal @hash[:results_root_id], Kalibro::Processing.new(@hash).results_root_id 14 assert_equal @hash[:results_root_id], Kalibro::Processing.new(@hash).results_root_id
16 assert_equal @hash[:process_time].first[:state], Kalibro::Processing.new(@hash).process_times.first.state 15 assert_equal @hash[:process_time].first[:state], Kalibro::Processing.new(@hash).process_times.first.state
17 end 16 end
18 17
19 - should 'convert project result to hash' do 18 + should 'convert processing to hash' do
20 assert_equal @hash, @processing.to_hash 19 assert_equal @hash, @processing.to_hash
21 end 20 end
22 21
@@ -94,56 +93,4 @@ class ProcessingTest &lt; ActiveSupport::TestCase @@ -94,56 +93,4 @@ class ProcessingTest &lt; ActiveSupport::TestCase
94 assert_equal @processing.id, Kalibro::Processing.last_processing_before(@repository_id, @processing.date).id 93 assert_equal @processing.id, Kalibro::Processing.last_processing_before(@repository_id, @processing.date).id
95 end 94 end
96 95
97 -=begin  
98 - should 'get processing of a repository' do  
99 - Kalibro::Processing.expects(:has_ready_processing).with(@repository.id).returns(true)  
100 - Kalibro::Processing.expects(:last_ready_processing_of).with(@repository.id).returns(@processing)  
101 - assert_equal @processing, @project_content.processing(@repository.id)  
102 - end  
103 -  
104 - should 'get not ready processing of a repository' do  
105 - Kalibro::Processing.expects(:has_ready_processing).with(@repository.id).returns(false)  
106 - Kalibro::Processing.expects(:last_processing_of).with(@repository.id).returns(@processing)  
107 - assert_equal @processing, @project_content.processing(@repository.id)  
108 - end  
109 -  
110 - should 'get processing of a repository after date' do  
111 - Kalibro::Processing.expects(:has_processing_after).with(@repository.id, @date).returns(true)  
112 - Kalibro::Processing.expects(:first_processing_after).with(@repository.id, @date).returns(@processing)  
113 - assert_equal @processing, @project_content.processing_with_date(@repository.id, @date)  
114 - end  
115 -  
116 - should 'get processing of a repository before date' do  
117 - Kalibro::Processing.expects(:has_processing_after).with(@repository.id, @date).returns(false)  
118 - Kalibro::Processing.expects(:has_processing_before).with(@repository.id, @date).returns(true)  
119 - Kalibro::Processing.expects(:last_processing_before).with(@repository.id, @date).returns(@processing)  
120 - assert_equal @processing, @project_content.processing_with_date(@repository.id, @date)  
121 - end  
122 -  
123 - should 'get module result' do  
124 - @project_content.expects(:processing).with(@repository.id).returns(@processing)  
125 - Kalibro::ModuleResult.expects(:find).with(@processing.results_root_id).returns(@module_result)  
126 - assert_equal @module_result, @project_content.module_result(@repository.id)  
127 -  
128 - end  
129 -  
130 - should 'get module result with date' do  
131 - @project_content.expects(:processing_with_date).with(@repository.id,@date.to_s).returns(@processing)  
132 - Kalibro::ModuleResult.expects(:find).with(@processing.results_root_id).returns(@module_result)  
133 - assert_equal @module_result, @project_content.module_result(@repository.id, @date.to_s)  
134 - end  
135 -  
136 - should 'get result history' do  
137 - Kalibro::MetricResult.expects(:history_of).with(@module_result.id).returns([@date_metric_result])  
138 - assert_equal [@date_metric_result], @project_content.result_history(@module_result.id)  
139 - end  
140 -  
141 - should 'add error to base when the module_result does not exist' do  
142 - Kalibro::MetricResult.expects(:history_of).with(@module_result.id).raises(Kalibro::Errors::RecordNotFound)  
143 - assert_nil @project_content.errors[:base]  
144 - @project_content.result_history(@module_result.id)  
145 - assert_not_nil @project_content.errors[:base]  
146 - end  
147 -=end  
148 -  
149 end 96 end