Commit a87bef107465346a83dabbabfdd1c8c25e0b161c

Authored by AntonioTerceiro
1 parent fcc76897

ActionItem16: listing past validations



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@874 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/profile_admin/enterprise_validation_controller.rb
@@ -34,6 +34,10 @@ class EnterpriseValidationController < ProfileAdminController @@ -34,6 +34,10 @@ class EnterpriseValidationController < ProfileAdminController
34 end 34 end
35 end 35 end
36 36
  37 + def list_processed
  38 + @processed_validations = profile.processed_validations
  39 + end
  40 +
37 def view_processed 41 def view_processed
38 @processed = profile.find_processed_validation(params[:id]) 42 @processed = profile.find_processed_validation(params[:id])
39 unless @processed 43 unless @processed
test/functional/enterprise_validation_test.rb
@@ -6,8 +6,8 @@ class EnterpriseValidationController; def rescue_action(e) raise e end; end @@ -6,8 +6,8 @@ class EnterpriseValidationController; def rescue_action(e) raise e end; end
6 6
7 class EnterpriseValidationControllerTest < Test::Unit::TestCase 7 class EnterpriseValidationControllerTest < Test::Unit::TestCase
8 8
9 -# all_fixtures:users  
10 -all_fixtures 9 + all_fixtures
  10 +
11 def setup 11 def setup
12 @controller = EnterpriseValidationController.new 12 @controller = EnterpriseValidationController.new
13 @request = ActionController::TestRequest.new 13 @request = ActionController::TestRequest.new
@@ -68,7 +68,15 @@ all_fixtures @@ -68,7 +68,15 @@ all_fixtures
68 end 68 end
69 69
70 should 'list validations already processed' do 70 should 'list validations already processed' do
71 - flunk 'not yet' 71 + processed_validations = [CreateEnterprise.new]
  72 + @org.expects(:processed_validations).returns(processed_validations)
  73 +
  74 + get :list_processed, :profile => 'myorg'
  75 +
  76 + assert_same processed_validations, assigns(:processed_validations)
  77 +
  78 + assert_response :success
  79 + assert_template 'list_processed'
72 end 80 end
73 81
74 should 'be able to display a validation that was already processed' do 82 should 'be able to display a validation that was already processed' do