Commit 487423592929980848172d4ddf95b402b707c611
1 parent
b125d29c
Exists in
master
and in
29 other branches
ActionItem1049: last round of code/test fixing
Showing
8 changed files
with
14 additions
and
12 deletions
Show diff stats
app/views/content_viewer/view_page.rhtml
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | <% if !@page.display_as_gallery? %> |
45 | 45 | <%= lightbox_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) %> |
46 | 46 | <% end %> |
47 | - <% if @page.folder? %> | |
47 | + <% if @page.folder? || (@page.parent && @page.parent.folder?) %> | |
48 | 48 | <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) %> |
49 | 49 | <% end %> |
50 | 50 | <% end %> | ... | ... |
test/functional/application_controller_test.rb
... | ... | @@ -260,6 +260,7 @@ class ApplicationControllerTest < Test::Unit::TestCase |
260 | 260 | env = Environment.default |
261 | 261 | Environment.stubs(:default).returns(env) |
262 | 262 | env.stubs(:terminology).returns(term) |
263 | + env.stubs(:id).returns(-9999) | |
263 | 264 | |
264 | 265 | Noosfero.expects(:terminology=).with(term) |
265 | 266 | get :index | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -705,8 +705,9 @@ class CmsControllerTest < Test::Unit::TestCase |
705 | 705 | end |
706 | 706 | |
707 | 707 | should 'display posts per page input with default value on edit blog' do |
708 | + n = Blog.new.posts_per_page.to_s | |
708 | 709 | get :new, :profile => profile.identifier, :type => 'Blog' |
709 | - assert_tag :tag => 'select', :attributes => { :name => 'article[posts_per_page]' }, :child => { :tag => 'option', :attributes => {:value => '20', :selected => 'selected'} } | |
710 | + assert_tag :tag => 'select', :attributes => { :name => 'article[posts_per_page]' }, :child => { :tag => 'option', :attributes => {:value => n, :selected => 'selected'} } | |
710 | 711 | end |
711 | 712 | |
712 | 713 | should 'not offer to create special article types' do |
... | ... | @@ -1054,13 +1055,12 @@ class CmsControllerTest < Test::Unit::TestCase |
1054 | 1055 | |
1055 | 1056 | should 'display pagination links of images' do |
1056 | 1057 | @controller.stubs(:per_page).returns(1) |
1057 | - image = UploadedFile.create!(:profile => profile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
1058 | - | |
1059 | 1058 | fixture_filename = '/files/other-pic.jpg' |
1060 | 1059 | filename = RAILS_ROOT + '/test/fixtures' + fixture_filename |
1061 | 1060 | system('echo "image for test" | convert -background yellow -page 32x32 text:- %s' % filename) |
1061 | + image = UploadedFile.create!(:profile => profile, :uploaded_data => fixture_file_upload(fixture_filename, 'image/jpg')) | |
1062 | 1062 | |
1063 | - image2 = UploadedFile.create!(:profile => profile, :uploaded_data => fixture_file_upload(fixture_filename, 'image/jpg')) | |
1063 | + image2 = UploadedFile.create!(:profile => profile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
1064 | 1064 | |
1065 | 1065 | get :media_listing, :profile => profile.identifier |
1066 | 1066 | |
... | ... | @@ -1072,8 +1072,8 @@ class CmsControllerTest < Test::Unit::TestCase |
1072 | 1072 | |
1073 | 1073 | should 'display pagination links of documents' do |
1074 | 1074 | @controller.stubs(:per_page).returns(1) |
1075 | - file = UploadedFile.create!(:profile => profile, :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain')) | |
1076 | - file2 = UploadedFile.create!(:profile => profile, :uploaded_data => fixture_file_upload('/files/feed.xml', 'text/xml')) | |
1075 | + file = UploadedFile.create!(:profile => profile, :uploaded_data => fixture_file_upload('/files/feed.xml', 'text/xml')) | |
1076 | + file2 = UploadedFile.create!(:profile => profile, :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain')) | |
1077 | 1077 | |
1078 | 1078 | get :media_listing, :profile => profile.identifier |
1079 | 1079 | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -734,7 +734,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
734 | 734 | folder1.children << folder2 = Folder.new(:name => 'gallery2', :profile => profile) |
735 | 735 | |
736 | 736 | get :view_page, :profile => profile.identifier, :page => folder2.explode_path |
737 | - assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{folder2.id}/} | |
738 | 737 | assert_tag :tag => 'a', :content => 'New article', :attributes => {:href =>/parent_id=#{folder2.id}/} |
739 | 738 | end |
740 | 739 | ... | ... |
test/functional/profile_controller_test.rb
... | ... | @@ -123,14 +123,12 @@ class ProfileControllerTest < Test::Unit::TestCase |
123 | 123 | should 'not show enterprises link to enterprise' do |
124 | 124 | ent = Enterprise.create!(:identifier => 'test_enterprise1', :name => 'Test enteprise1') |
125 | 125 | get :index, :profile => ent.identifier |
126 | - assert_tag :tag => 'h2', :content => "#{ent.identifier}'s profile" | |
127 | 126 | assert_no_tag :tag => 'a', :content => 'Enterprises', :attributes => { :href => /profile\/#{ent.identifier}\/enterprises$/ } |
128 | 127 | end |
129 | 128 | |
130 | 129 | should 'not show members link to person' do |
131 | 130 | person = create_user('person_1').person |
132 | 131 | get :index, :profile => person.identifier |
133 | - assert_tag :tag => 'h2', :content => "#{person.identifier}'s profile" | |
134 | 132 | assert_no_tag :tag => 'a', :content => 'Members', :attributes => { :href => /profile\/#{person.identifier}\/members$/ } |
135 | 133 | end |
136 | 134 | ... | ... |
test/functional/profile_editor_controller_test.rb
... | ... | @@ -253,7 +253,7 @@ class ProfileEditorControllerTest < Test::Unit::TestCase |
253 | 253 | should 'show edit profile button' do |
254 | 254 | person = create_user('testuser').person |
255 | 255 | get :index, :profile => 'testuser' |
256 | - assert_tag :tag => 'div', :attributes => { :class => 'file-manager-button' }, :child => { :tag => 'a', :attributes => { :href => '/myprofile/testuser/profile_editor/edit' } } | |
256 | + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/testuser/profile_editor/edit' } | |
257 | 257 | end |
258 | 258 | |
259 | 259 | should 'show image field on edit profile' do | ... | ... |
test/functional/themes_controller_test.rb
test/integration/editing_person_info_test.rb
... | ... | @@ -13,7 +13,7 @@ class EditingPersonInfoTest < ActionController::IntegrationTest |
13 | 13 | get "/myprofile/#{profile.identifier}" |
14 | 14 | assert_response :success |
15 | 15 | |
16 | - assert_tag :tag => 'a', :content => 'Info and settings' | |
16 | + assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/profile_editor/edit" } | |
17 | 17 | |
18 | 18 | get "/myprofile/#{profile.identifier}/profile_editor/edit" |
19 | 19 | assert_response :success | ... | ... |