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,7 +44,7 @@ | ||
44 | <% if !@page.display_as_gallery? %> | 44 | <% if !@page.display_as_gallery? %> |
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)))) %> | 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 | <% end %> | 46 | <% end %> |
47 | - <% if @page.folder? %> | 47 | + <% if @page.folder? || (@page.parent && @page.parent.folder?) %> |
48 | <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) %> | 48 | <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) %> |
49 | <% end %> | 49 | <% end %> |
50 | <% end %> | 50 | <% end %> |
test/functional/application_controller_test.rb
@@ -260,6 +260,7 @@ class ApplicationControllerTest < Test::Unit::TestCase | @@ -260,6 +260,7 @@ class ApplicationControllerTest < Test::Unit::TestCase | ||
260 | env = Environment.default | 260 | env = Environment.default |
261 | Environment.stubs(:default).returns(env) | 261 | Environment.stubs(:default).returns(env) |
262 | env.stubs(:terminology).returns(term) | 262 | env.stubs(:terminology).returns(term) |
263 | + env.stubs(:id).returns(-9999) | ||
263 | 264 | ||
264 | Noosfero.expects(:terminology=).with(term) | 265 | Noosfero.expects(:terminology=).with(term) |
265 | get :index | 266 | get :index |
test/functional/cms_controller_test.rb
@@ -705,8 +705,9 @@ class CmsControllerTest < Test::Unit::TestCase | @@ -705,8 +705,9 @@ class CmsControllerTest < Test::Unit::TestCase | ||
705 | end | 705 | end |
706 | 706 | ||
707 | should 'display posts per page input with default value on edit blog' do | 707 | should 'display posts per page input with default value on edit blog' do |
708 | + n = Blog.new.posts_per_page.to_s | ||
708 | get :new, :profile => profile.identifier, :type => 'Blog' | 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 | end | 711 | end |
711 | 712 | ||
712 | should 'not offer to create special article types' do | 713 | should 'not offer to create special article types' do |
@@ -1054,13 +1055,12 @@ class CmsControllerTest < Test::Unit::TestCase | @@ -1054,13 +1055,12 @@ class CmsControllerTest < Test::Unit::TestCase | ||
1054 | 1055 | ||
1055 | should 'display pagination links of images' do | 1056 | should 'display pagination links of images' do |
1056 | @controller.stubs(:per_page).returns(1) | 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 | fixture_filename = '/files/other-pic.jpg' | 1058 | fixture_filename = '/files/other-pic.jpg' |
1060 | filename = RAILS_ROOT + '/test/fixtures' + fixture_filename | 1059 | filename = RAILS_ROOT + '/test/fixtures' + fixture_filename |
1061 | system('echo "image for test" | convert -background yellow -page 32x32 text:- %s' % filename) | 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 | get :media_listing, :profile => profile.identifier | 1065 | get :media_listing, :profile => profile.identifier |
1066 | 1066 | ||
@@ -1072,8 +1072,8 @@ class CmsControllerTest < Test::Unit::TestCase | @@ -1072,8 +1072,8 @@ class CmsControllerTest < Test::Unit::TestCase | ||
1072 | 1072 | ||
1073 | should 'display pagination links of documents' do | 1073 | should 'display pagination links of documents' do |
1074 | @controller.stubs(:per_page).returns(1) | 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 | get :media_listing, :profile => profile.identifier | 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,7 +734,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
734 | folder1.children << folder2 = Folder.new(:name => 'gallery2', :profile => profile) | 734 | folder1.children << folder2 = Folder.new(:name => 'gallery2', :profile => profile) |
735 | 735 | ||
736 | get :view_page, :profile => profile.identifier, :page => folder2.explode_path | 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 | assert_tag :tag => 'a', :content => 'New article', :attributes => {:href =>/parent_id=#{folder2.id}/} | 737 | assert_tag :tag => 'a', :content => 'New article', :attributes => {:href =>/parent_id=#{folder2.id}/} |
739 | end | 738 | end |
740 | 739 |
test/functional/profile_controller_test.rb
@@ -123,14 +123,12 @@ class ProfileControllerTest < Test::Unit::TestCase | @@ -123,14 +123,12 @@ class ProfileControllerTest < Test::Unit::TestCase | ||
123 | should 'not show enterprises link to enterprise' do | 123 | should 'not show enterprises link to enterprise' do |
124 | ent = Enterprise.create!(:identifier => 'test_enterprise1', :name => 'Test enteprise1') | 124 | ent = Enterprise.create!(:identifier => 'test_enterprise1', :name => 'Test enteprise1') |
125 | get :index, :profile => ent.identifier | 125 | get :index, :profile => ent.identifier |
126 | - assert_tag :tag => 'h2', :content => "#{ent.identifier}'s profile" | ||
127 | assert_no_tag :tag => 'a', :content => 'Enterprises', :attributes => { :href => /profile\/#{ent.identifier}\/enterprises$/ } | 126 | assert_no_tag :tag => 'a', :content => 'Enterprises', :attributes => { :href => /profile\/#{ent.identifier}\/enterprises$/ } |
128 | end | 127 | end |
129 | 128 | ||
130 | should 'not show members link to person' do | 129 | should 'not show members link to person' do |
131 | person = create_user('person_1').person | 130 | person = create_user('person_1').person |
132 | get :index, :profile => person.identifier | 131 | get :index, :profile => person.identifier |
133 | - assert_tag :tag => 'h2', :content => "#{person.identifier}'s profile" | ||
134 | assert_no_tag :tag => 'a', :content => 'Members', :attributes => { :href => /profile\/#{person.identifier}\/members$/ } | 132 | assert_no_tag :tag => 'a', :content => 'Members', :attributes => { :href => /profile\/#{person.identifier}\/members$/ } |
135 | end | 133 | end |
136 | 134 |
test/functional/profile_editor_controller_test.rb
@@ -253,7 +253,7 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | @@ -253,7 +253,7 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | ||
253 | should 'show edit profile button' do | 253 | should 'show edit profile button' do |
254 | person = create_user('testuser').person | 254 | person = create_user('testuser').person |
255 | get :index, :profile => 'testuser' | 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 | end | 257 | end |
258 | 258 | ||
259 | should 'show image field on edit profile' do | 259 | should 'show image field on edit profile' do |
test/functional/themes_controller_test.rb
@@ -15,6 +15,10 @@ class ThemesControllerTest < Test::Unit::TestCase | @@ -15,6 +15,10 @@ class ThemesControllerTest < Test::Unit::TestCase | ||
15 | 15 | ||
16 | @profile = create_user('testinguser').person | 16 | @profile = create_user('testinguser').person |
17 | login_as('testinguser') | 17 | login_as('testinguser') |
18 | + | ||
19 | + env = Environment.default | ||
20 | + env.enable('user_themes') | ||
21 | + env.save! | ||
18 | end | 22 | end |
19 | attr_reader :profile | 23 | attr_reader :profile |
20 | 24 |
test/integration/editing_person_info_test.rb
@@ -13,7 +13,7 @@ class EditingPersonInfoTest < ActionController::IntegrationTest | @@ -13,7 +13,7 @@ class EditingPersonInfoTest < ActionController::IntegrationTest | ||
13 | get "/myprofile/#{profile.identifier}" | 13 | get "/myprofile/#{profile.identifier}" |
14 | assert_response :success | 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 | get "/myprofile/#{profile.identifier}/profile_editor/edit" | 18 | get "/myprofile/#{profile.identifier}/profile_editor/edit" |
19 | assert_response :success | 19 | assert_response :success |