Commit eff1b7831a6a0ee857cb095bb9e17f8bc84915b1

Authored by AntonioTerceiro
1 parent 3e0600f2

ActionItem24: checkpoint



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1156 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/my_profile/cms_controller.rb
... ... @@ -63,6 +63,7 @@ class CmsController < MyProfileController
63 63 end
64 64 @article.parent = parent
65 65 end
  66 +
66 67 @article.profile = profile
67 68 @article.last_changed_by = user
68 69 if request.post?
... ...
app/helpers/cms_helper.rb
... ... @@ -15,7 +15,7 @@ module CmsHelper
15 15 icon
16 16 else
17 17 if File.exists?(File.join(RAILS_ROOT, 'public', 'images', 'icons-mime', "#{icon}.png"))
18   - "icons-mime/#{icon}"
  18 + "icons-mime/#{icon}.png"
19 19 else
20 20 "icons-mime/unknown.png"
21 21 end
... ...
app/models/uploaded_file.rb
  1 +# Article type that handles uploaded files.
  2 +#
  3 +# Limitation: only file metadata are versioned. Only the latest version
  4 +# of the file itself is kept. (FIXME?)
1 5 class UploadedFile < Article
2 6  
3 7 # FIXME need to define min/max file size
... ...
test/functional/cms_controller_test.rb
... ... @@ -169,7 +169,14 @@ class CmsControllerTest &lt; Test::Unit::TestCase
169 169 end
170 170  
171 171 should 'be able to update an uploaded file' do
172   - flunk 'pending'
  172 + post :new, :type => UploadedFile.name, :profile => profile.identifier, :article => { :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain')}
  173 +
  174 + file = profile.articles.find(:first)
  175 + assert_equal 'test.txt', file.name
  176 +
  177 + post :edit, :profile => profile.identifier, :id => file.id, :article => { :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain')}
  178 +
  179 + assert_equal 2, file.versions(true).size
173 180 end
174 181  
175 182 should 'offer to create children' do
... ...
test/functional/enterprise_editor_controller_test.rb
... ... @@ -15,7 +15,7 @@ class EnterpriseEditorControllerTest &lt; Test::Unit::TestCase
15 15 ent1 = Enterprise.create!(:identifier => 'test_enterprise1', :name => 'Test enteprise1')
16 16 get 'index', :profile => 'test_enterprise1'
17 17  
18   - assert_response :success
  18 + assert_response 403
19 19 assert_template 'access_denied.rhtml'
20 20 end
21 21  
... ... @@ -26,7 +26,7 @@ class EnterpriseEditorControllerTest &lt; Test::Unit::TestCase
26 26  
27 27 get 'index', :profile => 'test_enterprise'
28 28  
29   - assert_response :success
  29 + assert_response 403
30 30 assert @controller.send(:profile)
31 31 assert_equal ent.identifier, @controller.send(:profile).identifier
32 32 assert_template 'access_denied.rhtml'
... ...
test/functional/profile_members_controller_test.rb
... ... @@ -18,7 +18,7 @@ class ProfileMembersControllerTest &lt; Test::Unit::TestCase
18 18  
19 19 get 'index', :profile => 'test_enterprise'
20 20  
21   - assert_response :success
  21 + assert_response 403
22 22 assert_template 'access_denied.rhtml'
23 23 end
24 24  
... ...