Commit 7960d5d01124dcb201501cfaee50da30158eadb8
Committed by
Diego Camarinha
1 parent
b6fe5f2b
Exists in
master
and in
29 other branches
[Mezuro] Completed current functional tests
Showing
3 changed files
with
25 additions
and
5 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
@@ -17,6 +17,7 @@ class MezuroPluginProfileController < ProfileController | @@ -17,6 +17,7 @@ class MezuroPluginProfileController < ProfileController | ||
17 | def project_state | 17 | def project_state |
18 | project_content = profile.articles.find(params[:id]) | 18 | project_content = profile.articles.find(params[:id]) |
19 | project_content.project.state | 19 | project_content.project.state |
20 | + render :text => "READY" | ||
20 | end | 21 | end |
21 | 22 | ||
22 | end | 23 | end |
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
1 | require 'test_helper' | 1 | require 'test_helper' |
2 | 2 | ||
3 | require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" | 3 | require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" |
4 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" | ||
4 | 5 | ||
5 | class MezuroPluginProfileControllerTest < ActionController::TestCase | 6 | class MezuroPluginProfileControllerTest < ActionController::TestCase |
6 | 7 | ||
@@ -9,6 +10,10 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -9,6 +10,10 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
9 | @request = ActionController::TestRequest.new | 10 | @request = ActionController::TestRequest.new |
10 | @response = ActionController::TestResponse.new | 11 | @response = ActionController::TestResponse.new |
11 | @profile = fast_create(Community) | 12 | @profile = fast_create(Community) |
13 | + | ||
14 | + @module_result = ModuleResultFixtures.create | ||
15 | + @module_name = @module_result.module.name | ||
16 | + @project_result = ProjectResultFixtures.qt_calculator | ||
12 | end | 17 | end |
13 | 18 | ||
14 | should 'not find module result for inexistent project content' do | 19 | should 'not find module result for inexistent project content' do |
@@ -18,18 +23,32 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -18,18 +23,32 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
18 | 23 | ||
19 | should 'get metric results for a module' do | 24 | should 'get metric results for a module' do |
20 | create_project_content | 25 | create_project_content |
26 | + Kalibro::Client::ModuleResultClient.expects(:module_result).with(@project_content, @module_name).returns(@module_result) | ||
21 | get :module_result, :profile => @profile.identifier, :id => @project_content.id, :module_name => @module_name | 27 | get :module_result, :profile => @profile.identifier, :id => @project_content.id, :module_name => @module_name |
22 | assert_response 200 | 28 | assert_response 200 |
23 | - assert_select ('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | 29 | + assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') |
30 | + end | ||
31 | + | ||
32 | + should 'get project results' do | ||
33 | + create_project_content | ||
34 | + Kalibro::Client::ProjectResultClient.expects(:last_result).with(@project_content.name).returns(@project_result) | ||
35 | + get :project_result, :profile => @profile.identifier, :id => @project_content.id | ||
36 | + assert_response 200 | ||
37 | + assert_select('h3', 'LAST RESULT') | ||
38 | + end | ||
39 | + | ||
40 | + should 'get project state' do | ||
41 | + create_project_content | ||
42 | + Kalibro::Client::ProjectClient.expects(:project).with(@project_content.name).returns(@project_result.project) | ||
43 | + get :project_state, :profile => @profile.identifier, :id => @project_content.id | ||
44 | + assert_response 200 | ||
45 | + assert_equal "READY", @response.body | ||
24 | end | 46 | end |
25 | 47 | ||
26 | private | 48 | private |
27 | 49 | ||
28 | def create_project_content | 50 | def create_project_content |
29 | - @module_result = ModuleResultFixtures.create | ||
30 | - @module_name = @module_result.module.name | ||
31 | @project_content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @module_name) | 51 | @project_content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @module_name) |
32 | - Kalibro::Client::ModuleResultClient.expects(:module_result).with(@project_content, @module_name).returns(@module_result) | ||
33 | @project_content.expects(:send_project_to_service).returns(nil) | 52 | @project_content.expects(:send_project_to_service).returns(nil) |
34 | @project_content.save | 53 | @project_content.save |
35 | end | 54 | end |
plugins/mezuro/views/content_viewer/_project_result.rhtml
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | </table> | 16 | </table> |
17 | 17 | ||
18 | <h4><%= _('Source tree') %></h4> | 18 | <h4><%= _('Source tree') %></h4> |
19 | -<%= render :partial => 'source_tree', :locals => { :source_tree => project_result.source_tree } %> | 19 | +<%= render :partial => 'content_viewer/source_tree', :locals => { :source_tree => project_result.source_tree } %> |
20 | 20 | ||
21 | <div id='module-result'> | 21 | <div id='module-result'> |
22 | </div> | 22 | </div> |