Commit 1ec7f711828071d6d49875ac231d979ecdf1ff40
1 parent
7827bc78
Exists in
master
and in
29 other branches
ActionItem114: adding not_found template
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@823 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
9 additions
and
10 deletions
Show diff stats
app/controllers/profile_admin/profile_editor_controller.rb
| 1 | class ProfileEditorController < ProfileAdminController | 1 | class ProfileEditorController < ProfileAdminController |
| 2 | + protect [:index, :edit], 'edit_profile', :profile | ||
| 2 | helper :profile | 3 | helper :profile |
| 3 | 4 | ||
| 4 | needs_profile | 5 | needs_profile |
| 5 | 6 | ||
| 6 | design_editor :holder => 'profile', :autosave => true, :block_types => :block_types | 7 | design_editor :holder => 'profile', :autosave => true, :block_types => :block_types |
| 7 | 8 | ||
| 8 | - protect [:index, :edit], 'edit_profile', :profile | ||
| 9 | - | ||
| 10 | def block_types | 9 | def block_types |
| 11 | { | 10 | { |
| 12 | 'ListBlock' => _("List of People"), | 11 | 'ListBlock' => _("List of People"), |
test/fixtures/role_assignments.yml
| @@ -4,8 +4,8 @@ one: | @@ -4,8 +4,8 @@ one: | ||
| 4 | accessor_id: 4 | 4 | accessor_id: 4 |
| 5 | accessor_type: 'Profile' | 5 | accessor_type: 'Profile' |
| 6 | role_id: 2 | 6 | role_id: 2 |
| 7 | - resource_id: 5 | ||
| 8 | - resource_type: 'Profile' | 7 | + resource_id: 1 |
| 8 | + resource_type: 'Environment' | ||
| 9 | two: | 9 | two: |
| 10 | id: 2 | 10 | id: 2 |
| 11 | accessor_id: 1 | 11 | accessor_id: 1 |
test/functional/profile_editor_controller_test.rb
| @@ -9,16 +9,14 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | @@ -9,16 +9,14 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | ||
| 9 | @controller = ProfileEditorController.new | 9 | @controller = ProfileEditorController.new |
| 10 | @request = ActionController::TestRequest.new | 10 | @request = ActionController::TestRequest.new |
| 11 | @response = ActionController::TestResponse.new | 11 | @response = ActionController::TestResponse.new |
| 12 | + login_as('ze') | ||
| 12 | end | 13 | end |
| 13 | 14 | ||
| 14 | def test_index | 15 | def test_index |
| 15 | - profile = Person.new | ||
| 16 | - profile.person_info.name = 'a test profile' | ||
| 17 | - profile.person_info.address = 'my address' | ||
| 18 | - profile.person_info.contact_information = 'my contact information' | ||
| 19 | - @controller.instance_variable_set('@profile', profile) | 16 | + profile = Profile.create(:name => 'a test profile', :identifier => 'test_profile') |
| 20 | 17 | ||
| 21 | - get :index, :profile => 'test_profile' | 18 | + get :index, :profile => profile.identifier |
| 19 | + assert_template :index | ||
| 22 | assert_response :success | 20 | assert_response :success |
| 23 | assert_not_nil assigns(:profile) | 21 | assert_not_nil assigns(:profile) |
| 24 | 22 |