Commit e421a80381b6ac0434157eef825637e75f50b8fe

Authored by Diego Camarinha
Committed by Paulo Meireles
1 parent c9b381b9

[Mezuro] Created new method result_history and updated tests

plugins/mezuro/lib/mezuro_plugin/project_content.rb
@@ -30,6 +30,10 @@ class MezuroPlugin::ProjectContent < Article @@ -30,6 +30,10 @@ class MezuroPlugin::ProjectContent < Article
30 @module_client ||= module_result_client.module_result(project.name, module_name, project_result.date) 30 @module_client ||= module_result_client.module_result(project.name, module_name, project_result.date)
31 end 31 end
32 32
  33 + def result_history(module_name)
  34 + @result_history ||= module_result_client.result_history(project.name, module_name)
  35 + end
  36 +
33 def module_result_client 37 def module_result_client
34 @module_result_client ||= Kalibro::Client::ModuleResultClient.new 38 @module_result_client ||= Kalibro::Client::ModuleResultClient.new
35 end 39 end
plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb
@@ -68,6 +68,14 @@ class ProjectContentTest < ActiveSupport::TestCase @@ -68,6 +68,14 @@ class ProjectContentTest < ActiveSupport::TestCase
68 assert_equal module_result, @content.module_result(nil) 68 assert_equal module_result, @content.module_result(nil)
69 end 69 end
70 70
  71 + should 'get result history' do
  72 + module_name = 'Qt-Calculator'
  73 + module_result_client = mock
  74 + @content.expects(:module_result_client).returns(module_result_client)
  75 + module_result_client.expects(:result_history).with(@project.name, module_name)
  76 + @content.result_history(module_name)
  77 + end
  78 +
71 should 'send project to service after saving' do 79 should 'send project to service after saving' do
72 @content.expects :send_project_to_service 80 @content.expects :send_project_to_service
73 @content.run_callbacks :after_save 81 @content.run_callbacks :after_save