Commit 8217f53682962ad6c033b46cd3b55a28339397fc
Committed by
Paulo Meireles
1 parent
f49af0dd
Exists in
master
and in
29 other branches
adding controller to ajax result
Showing
3 changed files
with
42 additions
and
1 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
0 → 100644
| @@ -0,0 +1,9 @@ | @@ -0,0 +1,9 @@ | ||
| 1 | +class MezuroPluginProfileController < ProfileController | ||
| 2 | + | ||
| 3 | + def metrics | ||
| 4 | + project = profile.articles.find(params[:id]) | ||
| 5 | + module_name = params[:module_name] | ||
| 6 | + render :partial => 'content_viewer/module_result', :locals => { :module_result => project.module_result(module_name) } | ||
| 7 | + end | ||
| 8 | + | ||
| 9 | +end |
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
0 → 100644
| @@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
| 1 | +require 'test_helper' | ||
| 2 | + | ||
| 3 | +class MezuroPluginProfileControllerTest < ActiveSupport::TestCase | ||
| 4 | + | ||
| 5 | + def setup | ||
| 6 | + @controller = MezuroPluginProfileController.new | ||
| 7 | + @request = ActionController::TestRequest.new | ||
| 8 | + @response = ActionController::TestResponse.new | ||
| 9 | + @profile = fast_create(Community) | ||
| 10 | + @profile_id = @profile.identifier | ||
| 11 | + end | ||
| 12 | + | ||
| 13 | + def test_metrics_for_unknown_module | ||
| 14 | + get :metrics, :profile => @profile_id, :id => 0 | ||
| 15 | + assert_response 404 | ||
| 16 | + end | ||
| 17 | + | ||
| 18 | + # TODO | ||
| 19 | + # def test_metrics_for_known_module | ||
| 20 | + # @project = create_project(profile) | ||
| 21 | + # @controller.stubs(:find_project).returns(@project) | ||
| 22 | + # get :metrics, :profile => @profile_id, :id => project.id, :module_name => _ | ||
| 23 | + # assert_ | ||
| 24 | + # end | ||
| 25 | + | ||
| 26 | + protected | ||
| 27 | + | ||
| 28 | + # returns a new ProjectContent for the given profile | ||
| 29 | + def create_project(profile) | ||
| 30 | + | ||
| 31 | + end | ||
| 32 | + | ||
| 33 | +end |
plugins/mezuro/test/mezuro_test.rb
| 1 | require "test_helper" | 1 | require "test_helper" |
| 2 | -require File.dirname(__FILE__) + '/../../../test/test_helper' | ||
| 3 | require File.dirname(__FILE__) + '/../controllers/mezuro_plugin_myprofile_controller' | 2 | require File.dirname(__FILE__) + '/../controllers/mezuro_plugin_myprofile_controller' |
| 4 | 3 | ||
| 5 | class MezuroTest < ActiveSupport::TestCase | 4 | class MezuroTest < ActiveSupport::TestCase |