Commit 7f7688d6141f5928f0b7ac6592045d437fd714ad
Committed by
Rafael Manzo
1 parent
08b04c72
Exists in
master
and in
29 other branches
[Mezuro] Fixed 'get project tree' tests
Showing
1 changed file
with
13 additions
and
15 deletions
Show diff stats
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
... | ... | @@ -54,9 +54,10 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase |
54 | 54 | assert_select('h3', 'ERROR') |
55 | 55 | end |
56 | 56 | |
57 | - should 'get project results' do | |
57 | + should 'get project results without date' do | |
58 | 58 | create_project_content |
59 | 59 | Kalibro::Client::ProjectResultClient.expects(:last_result).with(@name).returns(@project_result) |
60 | + Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) | |
60 | 61 | get :project_result, :profile => @profile.identifier, :id => @content.id |
61 | 62 | assert_response 200 |
62 | 63 | assert_select('h4', 'Last Result') |
... | ... | @@ -64,11 +65,9 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase |
64 | 65 | |
65 | 66 | should 'get project results from a specific date' do |
66 | 67 | create_project_content |
67 | - client = mock | |
68 | - Kalibro::Client::ProjectResultClient.expects(:new).returns(client) | |
69 | - client.expects(:has_results_before).returns(true) | |
70 | - client.expects(:last_result_before).returns(@project_result) | |
71 | - get :project_result, :profile => @profile.identifier, :id => @content.id, :date => "2012-04-13T20:39:41+04:00" | |
68 | + mock_project_result | |
69 | + Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) | |
70 | + get :project_result, :profile => @profile.identifier, :id => @content.id, :date => @project_result.date | |
72 | 71 | assert_response 200 |
73 | 72 | end |
74 | 73 | |
... | ... | @@ -93,22 +92,21 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase |
93 | 92 | assert_response 200 |
94 | 93 | end |
95 | 94 | |
96 | - should 'get project tree' do | |
95 | + should 'get project tree without date' do | |
97 | 96 | create_project_content |
98 | 97 | Kalibro::Client::ProjectResultClient.expects(:last_result).with(@name).returns(@project_result) |
99 | - get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @name | |
100 | - assert_response 200 | |
101 | - assert_select('h2', /Qt-Calculator/) | |
98 | + Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) | |
99 | + get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @name | |
100 | + assert_response 200 | |
101 | + assert_select('h2', /Qt-Calculator/) | |
102 | 102 | end |
103 | 103 | |
104 | 104 | should 'get project tree from a specific date' do |
105 | 105 | create_project_content |
106 | - client = mock | |
107 | - Kalibro::Client::ProjectResultClient.expects(:new).returns(client) | |
108 | - client.expects(:has_results_before).returns(true) | |
109 | - client.expects(:last_result_before).returns(@project_result) | |
106 | + mock_project_result | |
107 | + Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) | |
110 | 108 | get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @name, :date => "2012-04-13T20:39:41+04:00" |
111 | - assert_response 200 | |
109 | + assert_response 200 | |
112 | 110 | end |
113 | 111 | |
114 | 112 | private | ... | ... |