Commit fac2efa57992551b80171f828604db7434e9771e
Committed by
Rafael Manzo
1 parent
3e12b2c0
Exists in
master
and in
28 other branches
[Mezuro] Fixed 'get module result from service' test
Showing
2 changed files
with
10 additions
and
12 deletions
Show diff stats
plugins/mezuro/lib/mezuro_plugin/project_content.rb
| ... | ... | @@ -20,10 +20,6 @@ class MezuroPlugin::ProjectContent < Article |
| 20 | 20 | def project |
| 21 | 21 | @project ||= Kalibro::Client::ProjectClient.project(name) |
| 22 | 22 | end |
| 23 | - | |
| 24 | - def project | |
| 25 | - @project ||= Kalibro::Client::ProjectClient.project(name) | |
| 26 | - end | |
| 27 | 23 | |
| 28 | 24 | def project_result |
| 29 | 25 | @project_result ||= Kalibro::Client::ProjectResultClient.last_result(name) | ... | ... |
plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb
| ... | ... | @@ -44,15 +44,17 @@ class ProjectContentTest < ActiveSupport::TestCase |
| 44 | 44 | end |
| 45 | 45 | |
| 46 | 46 | should 'get module result from service' do |
| 47 | - module_name = 'My module name' | |
| 48 | - module_result = mock | |
| 49 | - module_result_client = mock | |
| 50 | - project_result = mock | |
| 51 | - @content.expects(:project_result).returns(project_result) | |
| 47 | + Kalibro::Client::ProjectClient.expects(:project).with(@content.name).returns(@project) | |
| 48 | + | |
| 49 | + project_result = mock | |
| 52 | 50 | project_result.expects(:date).returns('12/04/2012') |
| 53 | - @content.expects(:module_result_client).returns(module_result_client) | |
| 54 | - module_result_client.expects(:module_result).with(@project.name, module_name, '12/04/2012'). | |
| 55 | - returns(module_result) | |
| 51 | + Kalibro::Client::ProjectResultClient.expects(:last_result).with(@content.name).returns(project_result) | |
| 52 | + | |
| 53 | + module_name = 'My module name' | |
| 54 | + module_result_client = mock | |
| 55 | + module_result = Kalibro::Entities::ModuleResult.new | |
| 56 | + Kalibro::Client::ModuleResultClient.expects(:new).returns(module_result_client) | |
| 57 | + module_result_client.expects(:module_result).with(@project.name, module_name, '12/04/2012').returns(module_result) | |
| 56 | 58 | assert_equal module_result, @content.module_result(module_name) |
| 57 | 59 | end |
| 58 | 60 | ... | ... |