Commit f21dd0b78e776da01d524a5c8407cfc01c4c12d6
Committed by
Rafael Manzo
1 parent
3c279a31
Exists in
master
and in
29 other branches
[Mezuro] Trying to create tests for periodicity
Showing
2 changed files
with
11 additions
and
1 deletions
Show diff stats
plugins/mezuro/lib/mezuro_plugin/project_content.rb
@@ -29,7 +29,7 @@ class MezuroPlugin::ProjectContent < Article | @@ -29,7 +29,7 @@ class MezuroPlugin::ProjectContent < Article | ||
29 | 29 | ||
30 | def get_date_result(date) | 30 | def get_date_result(date) |
31 | client = Kalibro::Client::ProjectResultClient.new | 31 | client = Kalibro::Client::ProjectResultClient.new |
32 | - @project_result ||= client.has_results_before(name, date) ? client.last_result_before(name, date) : client.first_result_after(name, date) | 32 | + @project_result ||= Kalibro::Client::ProjectResultClient.has_results_before(name, date) ? Kalibro::Client::ProjectResultClient.last_result_before(name, date) : Kalibro::Client::ProjectResultClient.first_result_after(name, date) |
33 | end | 33 | end |
34 | 34 | ||
35 | def module_result(module_name) | 35 | def module_result(module_name) |
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
@@ -21,6 +21,8 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -21,6 +21,8 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
21 | @name = @project.name | 21 | @name = @project.name |
22 | 22 | ||
23 | @date = "2012-04-13T20:39:41+04:00" | 23 | @date = "2012-04-13T20:39:41+04:00" |
24 | + | ||
25 | + @date = "2012-04-13T20:39:41+04:00" | ||
24 | end | 26 | end |
25 | 27 | ||
26 | should 'not find module result for inexistent project content' do | 28 | should 'not find module result for inexistent project content' do |
@@ -65,6 +67,14 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -65,6 +67,14 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
65 | 67 | ||
66 | should 'get project results from a specific date' do | 68 | should 'get project results from a specific date' do |
67 | create_project_content | 69 | create_project_content |
70 | +#client = mock | ||
71 | +#Kalibro::Client::ProjectResultClient.expects(:new).returns(client) | ||
72 | + Kalibro::Client::ProjectResultClient.expects(:has_results_before).with(@name, @date).returns(true) | ||
73 | + Kalibro::Client::ProjectResultClient.expects(:last_result_before).with(@name, @date).returns(@project_result) | ||
74 | + assert_response 200 | ||
75 | + end | ||
76 | + | ||
77 | + create_project_content | ||
68 | mock_project_result | 78 | mock_project_result |
69 | Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) | 79 | Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) |
70 | get :project_result, :profile => @profile.identifier, :id => @content.id, :date => @project_result.date | 80 | get :project_result, :profile => @profile.identifier, :id => @content.id, :date => @project_result.date |