From c72e0722a984621e4d7d78dbef8579feaa85a4f9 Mon Sep 17 00:00:00 2001 From: Alessandro Palmeira + Carlos Morais Date: Fri, 17 Feb 2012 12:08:42 -0200 Subject: [PATCH] [Mezuro] Added partials in controller --- plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb | 12 ++++++++++++ plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+), 0 deletions(-) diff --git a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb index 57acebb..1e7f1c0 100644 --- a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb +++ b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb @@ -14,6 +14,18 @@ class MezuroPluginProfileController < ProfileController render :partial => 'content_viewer/project_result', :locals => { :project_result => project_result } end + def project_error + content = profile.articles.find(params[:id]) + project = content.project + render :partial => 'content_viewer/project_error', :locals => { :project => project } + end + + def project_processing + content = profile.articles.find(params[:id]) + project = content.project + render :partial => 'content_viewer/project_processing', :locals => { :project => project } + end + def project_state content = profile.articles.find(params[:id]) project = content.project diff --git a/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb b/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb index 5cda00e..366c318 100644 --- a/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb +++ b/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb @@ -2,6 +2,7 @@ require 'test_helper' require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/error_fixtures" class MezuroPluginProfileControllerTest < ActionController::TestCase @@ -46,6 +47,24 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase assert_equal @project.state, @response.body end + should 'get project error' do + create_project_content + Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) + @project.expects(:error).returns(ErrorFixtures.create) + get :project_error, :profile => @profile.identifier, :id => @content.id + assert_response 200 + assert_select('h3', 'ERROR') + end + + should 'get project processing' do + create_project_content + Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) + @project.expects(:state).returns("LOADING") + get :project_processing, :profile => @profile.identifier, :id => @content.id + assert_response 200 + assert_select('h3', 'Service is loading Qt-Calculator...') + end + should 'get error state if project has error' do create_project_content Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) -- libgit2 0.21.2