Commit f21dd0b78e776da01d524a5c8407cfc01c4c12d6

Authored by Diego Camarinha
Committed by Rafael Manzo
1 parent 3c279a31

[Mezuro] Trying to create tests for periodicity

plugins/mezuro/lib/mezuro_plugin/project_content.rb
... ... @@ -29,7 +29,7 @@ class MezuroPlugin::ProjectContent < Article
29 29  
30 30 def get_date_result(date)
31 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 33 end
34 34  
35 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 21 @name = @project.name
22 22  
23 23 @date = "2012-04-13T20:39:41+04:00"
  24 +
  25 + @date = "2012-04-13T20:39:41+04:00"
24 26 end
25 27  
26 28 should 'not find module result for inexistent project content' do
... ... @@ -65,6 +67,14 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase
65 67  
66 68 should 'get project results from a specific date' do
67 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 78 mock_project_result
69 79 Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project)
70 80 get :project_result, :profile => @profile.identifier, :id => @content.id, :date => @project_result.date
... ...