Commit eff1b7831a6a0ee857cb095bb9e17f8bc84915b1
1 parent
3e0600f2
Exists in
master
and in
22 other branches
ActionItem24: checkpoint
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1156 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
6 changed files
with
17 additions
and
5 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
@@ -63,6 +63,7 @@ class CmsController < MyProfileController | @@ -63,6 +63,7 @@ class CmsController < MyProfileController | ||
63 | end | 63 | end |
64 | @article.parent = parent | 64 | @article.parent = parent |
65 | end | 65 | end |
66 | + | ||
66 | @article.profile = profile | 67 | @article.profile = profile |
67 | @article.last_changed_by = user | 68 | @article.last_changed_by = user |
68 | if request.post? | 69 | if request.post? |
app/helpers/cms_helper.rb
@@ -15,7 +15,7 @@ module CmsHelper | @@ -15,7 +15,7 @@ module CmsHelper | ||
15 | icon | 15 | icon |
16 | else | 16 | else |
17 | if File.exists?(File.join(RAILS_ROOT, 'public', 'images', 'icons-mime', "#{icon}.png")) | 17 | if File.exists?(File.join(RAILS_ROOT, 'public', 'images', 'icons-mime', "#{icon}.png")) |
18 | - "icons-mime/#{icon}" | 18 | + "icons-mime/#{icon}.png" |
19 | else | 19 | else |
20 | "icons-mime/unknown.png" | 20 | "icons-mime/unknown.png" |
21 | end | 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 | class UploadedFile < Article | 5 | class UploadedFile < Article |
2 | 6 | ||
3 | # FIXME need to define min/max file size | 7 | # FIXME need to define min/max file size |
test/functional/cms_controller_test.rb
@@ -169,7 +169,14 @@ class CmsControllerTest < Test::Unit::TestCase | @@ -169,7 +169,14 @@ class CmsControllerTest < Test::Unit::TestCase | ||
169 | end | 169 | end |
170 | 170 | ||
171 | should 'be able to update an uploaded file' do | 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 | end | 180 | end |
174 | 181 | ||
175 | should 'offer to create children' do | 182 | should 'offer to create children' do |
test/functional/enterprise_editor_controller_test.rb
@@ -15,7 +15,7 @@ class EnterpriseEditorControllerTest < Test::Unit::TestCase | @@ -15,7 +15,7 @@ class EnterpriseEditorControllerTest < Test::Unit::TestCase | ||
15 | ent1 = Enterprise.create!(:identifier => 'test_enterprise1', :name => 'Test enteprise1') | 15 | ent1 = Enterprise.create!(:identifier => 'test_enterprise1', :name => 'Test enteprise1') |
16 | get 'index', :profile => 'test_enterprise1' | 16 | get 'index', :profile => 'test_enterprise1' |
17 | 17 | ||
18 | - assert_response :success | 18 | + assert_response 403 |
19 | assert_template 'access_denied.rhtml' | 19 | assert_template 'access_denied.rhtml' |
20 | end | 20 | end |
21 | 21 | ||
@@ -26,7 +26,7 @@ class EnterpriseEditorControllerTest < Test::Unit::TestCase | @@ -26,7 +26,7 @@ class EnterpriseEditorControllerTest < Test::Unit::TestCase | ||
26 | 26 | ||
27 | get 'index', :profile => 'test_enterprise' | 27 | get 'index', :profile => 'test_enterprise' |
28 | 28 | ||
29 | - assert_response :success | 29 | + assert_response 403 |
30 | assert @controller.send(:profile) | 30 | assert @controller.send(:profile) |
31 | assert_equal ent.identifier, @controller.send(:profile).identifier | 31 | assert_equal ent.identifier, @controller.send(:profile).identifier |
32 | assert_template 'access_denied.rhtml' | 32 | assert_template 'access_denied.rhtml' |
test/functional/profile_members_controller_test.rb
@@ -18,7 +18,7 @@ class ProfileMembersControllerTest < Test::Unit::TestCase | @@ -18,7 +18,7 @@ class ProfileMembersControllerTest < Test::Unit::TestCase | ||
18 | 18 | ||
19 | get 'index', :profile => 'test_enterprise' | 19 | get 'index', :profile => 'test_enterprise' |
20 | 20 | ||
21 | - assert_response :success | 21 | + assert_response 403 |
22 | assert_template 'access_denied.rhtml' | 22 | assert_template 'access_denied.rhtml' |
23 | end | 23 | end |
24 | 24 |