Commit c72e0722a984621e4d7d78dbef8579feaa85a4f9
Committed by
Carlos Morais
1 parent
3a92026d
Exists in
master
and in
29 other branches
[Mezuro] Added partials in controller
Showing
2 changed files
with
31 additions
and
0 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
| ... | ... | @@ -14,6 +14,18 @@ class MezuroPluginProfileController < ProfileController |
| 14 | 14 | render :partial => 'content_viewer/project_result', :locals => { :project_result => project_result } |
| 15 | 15 | end |
| 16 | 16 | |
| 17 | + def project_error | |
| 18 | + content = profile.articles.find(params[:id]) | |
| 19 | + project = content.project | |
| 20 | + render :partial => 'content_viewer/project_error', :locals => { :project => project } | |
| 21 | + end | |
| 22 | + | |
| 23 | + def project_processing | |
| 24 | + content = profile.articles.find(params[:id]) | |
| 25 | + project = content.project | |
| 26 | + render :partial => 'content_viewer/project_processing', :locals => { :project => project } | |
| 27 | + end | |
| 28 | + | |
| 17 | 29 | def project_state |
| 18 | 30 | content = profile.articles.find(params[:id]) |
| 19 | 31 | project = content.project | ... | ... |
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
| ... | ... | @@ -2,6 +2,7 @@ require 'test_helper' |
| 2 | 2 | |
| 3 | 3 | require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" |
| 4 | 4 | require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" |
| 5 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/error_fixtures" | |
| 5 | 6 | |
| 6 | 7 | class MezuroPluginProfileControllerTest < ActionController::TestCase |
| 7 | 8 | |
| ... | ... | @@ -46,6 +47,24 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase |
| 46 | 47 | assert_equal @project.state, @response.body |
| 47 | 48 | end |
| 48 | 49 | |
| 50 | + should 'get project error' do | |
| 51 | + create_project_content | |
| 52 | + Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) | |
| 53 | + @project.expects(:error).returns(ErrorFixtures.create) | |
| 54 | + get :project_error, :profile => @profile.identifier, :id => @content.id | |
| 55 | + assert_response 200 | |
| 56 | + assert_select('h3', 'ERROR') | |
| 57 | + end | |
| 58 | + | |
| 59 | + should 'get project processing' do | |
| 60 | + create_project_content | |
| 61 | + Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) | |
| 62 | + @project.expects(:state).returns("LOADING") | |
| 63 | + get :project_processing, :profile => @profile.identifier, :id => @content.id | |
| 64 | + assert_response 200 | |
| 65 | + assert_select('h3', 'Service is loading Qt-Calculator...') | |
| 66 | + end | |
| 67 | + | |
| 49 | 68 | should 'get error state if project has error' do |
| 50 | 69 | create_project_content |
| 51 | 70 | Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) | ... | ... |