Commit 6cb08f2faa5f0441be031781747e45090d3ca378
Exists in
master
and in
28 other branches
Merge commit 'refs/merge-requests/366' of git://gitorious.org/noosfero/noosfero …
…into merge-requests/366 Conflicts: INSTALL script/install-dependencies/debian-squeeze.sh
Showing
6 changed files
with
63 additions
and
15 deletions
Show diff stats
INSTALL.md
| @@ -23,7 +23,7 @@ You need to install some packages Noosfero depends on. On Debian GNU/Linux or De | @@ -23,7 +23,7 @@ You need to install some packages Noosfero depends on. On Debian GNU/Linux or De | ||
| 23 | # apt-get install ruby rake po4a libgettext-ruby-util libgettext-ruby1.8 \ | 23 | # apt-get install ruby rake po4a libgettext-ruby-util libgettext-ruby1.8 \ |
| 24 | libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby libhpricot-ruby \ | 24 | libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby libhpricot-ruby \ |
| 25 | libwill-paginate-ruby iso-codes libfeedparser-ruby libdaemons-ruby thin \ | 25 | libwill-paginate-ruby iso-codes libfeedparser-ruby libdaemons-ruby thin \ |
| 26 | - tango-icon-theme | 26 | + tango-icon-theme libnokogiri-ruby |
| 27 | 27 | ||
| 28 | On other systems, they may or may not be available through your regular package management system. Below are the links to their homepages. | 28 | On other systems, they may or may not be available through your regular package management system. Below are the links to their homepages. |
| 29 | 29 | ||
| @@ -41,6 +41,7 @@ On other systems, they may or may not be available through your regular package | @@ -41,6 +41,7 @@ On other systems, they may or may not be available through your regular package | ||
| 41 | * Thin: http://code.macournoyer.com/thin | 41 | * Thin: http://code.macournoyer.com/thin |
| 42 | * tango-icon-theme: http://tango.freedesktop.org/Tango_Icon_Library | 42 | * tango-icon-theme: http://tango.freedesktop.org/Tango_Icon_Library |
| 43 | * Hpricot: http://hpricot.com | 43 | * Hpricot: http://hpricot.com |
| 44 | +* Nokogiri: http://nokogiri.org/ | ||
| 44 | 45 | ||
| 45 | If you manage to install Noosfero successfully on other systems than Debian, | 46 | If you manage to install Noosfero successfully on other systems than Debian, |
| 46 | please feel free to contact the Noosfero development mailing with the | 47 | please feel free to contact the Noosfero development mailing with the |
app/helpers/application_helper.rb
| @@ -1382,16 +1382,16 @@ module ApplicationHelper | @@ -1382,16 +1382,16 @@ module ApplicationHelper | ||
| 1382 | end | 1382 | end |
| 1383 | 1383 | ||
| 1384 | def convert_macro(html, source) | 1384 | def convert_macro(html, source) |
| 1385 | - doc = Hpricot(html) | 1385 | + doc = Nokogiri::HTML(html) |
| 1386 | #TODO This way is more efficient but do not support macro inside of | 1386 | #TODO This way is more efficient but do not support macro inside of |
| 1387 | # macro. You must parse them from the inside-out in order to enable | 1387 | # macro. You must parse them from the inside-out in order to enable |
| 1388 | # that. | 1388 | # that. |
| 1389 | - doc.search('.macro').each do |macro| | 1389 | + doc.css('.macro').each do |macro| |
| 1390 | macro_name = macro['data-macro'] | 1390 | macro_name = macro['data-macro'] |
| 1391 | result = @plugins.parse_macro(macro_name, macro, source) | 1391 | result = @plugins.parse_macro(macro_name, macro, source) |
| 1392 | - macro.inner_html = result.kind_of?(Proc) ? self.instance_eval(&result) : result | 1392 | + macro.content = result.kind_of?(Proc) ? self.instance_eval(&result) : result |
| 1393 | end | 1393 | end |
| 1394 | - doc.html | 1394 | + doc.xpath('//body/*').to_s |
| 1395 | end | 1395 | end |
| 1396 | 1396 | ||
| 1397 | def default_folder_for_image_upload(profile) | 1397 | def default_folder_for_image_upload(profile) |
config/initializers/dependencies.rb
debian/control
script/install-dependencies/debian-squeeze.sh
| @@ -5,7 +5,7 @@ run sudo apt-get -y install $runtime_dependencies | @@ -5,7 +5,7 @@ run sudo apt-get -y install $runtime_dependencies | ||
| 5 | sudo apt-get -y install iceweasel || sudo apt-get -y install firefox | 5 | sudo apt-get -y install iceweasel || sudo apt-get -y install firefox |
| 6 | 6 | ||
| 7 | # needed for development | 7 | # needed for development |
| 8 | -run sudo apt-get -y install libtidy-ruby libhpricot-ruby libmocha-ruby imagemagick po4a xvfb libxml2-dev libxslt-dev postgresql openjdk-6-jre | 8 | +run sudo apt-get -y install libtidy-ruby libhpricot-ruby libnokogiri-ruby libmocha-ruby imagemagick po4a xvfb libxml2-dev libxslt-dev postgresql openjdk-6-jre |
| 9 | gem which bundler >/dev/null 2>&1 || gem_install bundler | 9 | gem which bundler >/dev/null 2>&1 || gem_install bundler |
| 10 | setup_rubygems_path | 10 | setup_rubygems_path |
| 11 | run bundle install | 11 | run bundle install |
test/functional/cms_controller_test.rb
| @@ -644,8 +644,13 @@ class CmsControllerTest < ActionController::TestCase | @@ -644,8 +644,13 @@ class CmsControllerTest < ActionController::TestCase | ||
| 644 | article = profile.articles.create!(:name => 'test', :published => false) | 644 | article = profile.articles.create!(:name => 'test', :published => false) |
| 645 | 645 | ||
| 646 | get :edit, :profile => profile.identifier, :id => article.id | 646 | get :edit, :profile => profile.identifier, :id => article.id |
| 647 | - assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'article[published]', :id => 'article_published_true' } | ||
| 648 | - assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'article[published]', :id => 'article_published_false', :checked => 'checked' } | 647 | + assert_select 'input#article_published_true[name=?][type="radio"]', 'article[published]' |
| 648 | + assert_select 'input#article_published_false[name=?][type="radio"]', 'article[published]' do |elements| | ||
| 649 | + assert elements.length > 0 | ||
| 650 | + elements.each do |element| | ||
| 651 | + assert element["checked"] | ||
| 652 | + end | ||
| 653 | + end | ||
| 649 | end | 654 | end |
| 650 | 655 | ||
| 651 | should 'be able to add image with alignment' do | 656 | should 'be able to add image with alignment' do |
| @@ -844,13 +849,23 @@ class CmsControllerTest < ActionController::TestCase | @@ -844,13 +849,23 @@ class CmsControllerTest < ActionController::TestCase | ||
| 844 | should 'display posts per page input with default value on edit blog' do | 849 | should 'display posts per page input with default value on edit blog' do |
| 845 | n = Blog.new.posts_per_page.to_s | 850 | n = Blog.new.posts_per_page.to_s |
| 846 | get :new, :profile => profile.identifier, :type => 'Blog' | 851 | get :new, :profile => profile.identifier, :type => 'Blog' |
| 847 | - assert_tag :tag => 'select', :attributes => { :name => 'article[posts_per_page]' }, :child => { :tag => 'option', :attributes => {:value => n, :selected => 'selected'} } | 852 | + assert_select 'select[name=?] option[value=?]', 'article[posts_per_page]', n do |elements| |
| 853 | + assert elements.length > 0 | ||
| 854 | + elements.each do |element| | ||
| 855 | + assert element["selected"] | ||
| 856 | + end | ||
| 857 | + end | ||
| 848 | end | 858 | end |
| 849 | 859 | ||
| 850 | should 'display options for blog visualization with default value on edit blog' do | 860 | should 'display options for blog visualization with default value on edit blog' do |
| 851 | format = Blog.new.visualization_format | 861 | format = Blog.new.visualization_format |
| 852 | get :new, :profile => profile.identifier, :type => 'Blog' | 862 | get :new, :profile => profile.identifier, :type => 'Blog' |
| 853 | - assert_tag :tag => 'select', :attributes => { :name => 'article[visualization_format]' }, :child => { :tag => 'option', :attributes => {:value => 'full', :selected => 'selected'} } | 863 | + assert_select 'select[name=?] option[value=full]', 'article[visualization_format]' do |elements| |
| 864 | + assert elements.length > 0 | ||
| 865 | + elements.each do |element| | ||
| 866 | + assert element["selected"] | ||
| 867 | + end | ||
| 868 | + end | ||
| 854 | end | 869 | end |
| 855 | 870 | ||
| 856 | should 'not offer to create special article types' do | 871 | should 'not offer to create special article types' do |
| @@ -985,6 +1000,11 @@ class CmsControllerTest < ActionController::TestCase | @@ -985,6 +1000,11 @@ class CmsControllerTest < ActionController::TestCase | ||
| 985 | assert_tag :tag => 'a', :content => 'Cancel', :attributes => { :href => /\/myprofile\/#{profile.identifier}/ } | 1000 | assert_tag :tag => 'a', :content => 'Cancel', :attributes => { :href => /\/myprofile\/#{profile.identifier}/ } |
| 986 | end | 1001 | end |
| 987 | 1002 | ||
| 1003 | + should 'have only one mandatory field in the blog creation form' do | ||
| 1004 | + get :new, :profile => profile.identifier, :type => Blog.name | ||
| 1005 | + assert_select '.required-field .formfieldline', 1 | ||
| 1006 | + end | ||
| 1007 | + | ||
| 988 | should 'create icon upload file in folder' do | 1008 | should 'create icon upload file in folder' do |
| 989 | f = Gallery.create!(:name => 'test_folder', :profile => profile) | 1009 | f = Gallery.create!(:name => 'test_folder', :profile => profile) |
| 990 | post :new, :profile => profile.identifier, | 1010 | post :new, :profile => profile.identifier, |
| @@ -1076,7 +1096,12 @@ class CmsControllerTest < ActionController::TestCase | @@ -1076,7 +1096,12 @@ class CmsControllerTest < ActionController::TestCase | ||
| 1076 | profile.articles << Blog.new(:name => 'test blog', :profile => profile) | 1096 | profile.articles << Blog.new(:name => 'test blog', :profile => profile) |
| 1077 | profile.blog.create_external_feed(:address => 'address', :enabled => true) | 1097 | profile.blog.create_external_feed(:address => 'address', :enabled => true) |
| 1078 | get :edit, :profile => profile.identifier, :id => profile.blog.id | 1098 | get :edit, :profile => profile.identifier, :id => profile.blog.id |
| 1079 | - assert_tag :tag => 'input', :attributes => { :name => 'article[external_feed_builder][enabled]', :checked => 'checked' } | 1099 | + assert_select 'input[type=checkbox][name=?]', 'article[external_feed_builder][enabled]' do |elements| |
| 1100 | + elements.length > 0 | ||
| 1101 | + elements.each do |element| | ||
| 1102 | + assert element["checked"] | ||
| 1103 | + end | ||
| 1104 | + end | ||
| 1080 | end | 1105 | end |
| 1081 | 1106 | ||
| 1082 | should "display 'Fetch posts from an external feed' unchecked if blog has disabled external feed" do | 1107 | should "display 'Fetch posts from an external feed' unchecked if blog has disabled external feed" do |
| @@ -1094,7 +1119,12 @@ class CmsControllerTest < ActionController::TestCase | @@ -1094,7 +1119,12 @@ class CmsControllerTest < ActionController::TestCase | ||
| 1094 | 1119 | ||
| 1095 | should 'only_once option marked by default' do | 1120 | should 'only_once option marked by default' do |
| 1096 | get :new, :profile => profile.identifier, :type => 'Blog' | 1121 | get :new, :profile => profile.identifier, :type => 'Blog' |
| 1097 | - assert_tag :tag => 'input', :attributes => { :name => 'article[external_feed_builder][only_once]', :checked => 'checked', :value => 'true' } | 1122 | + assert_select 'input[name=?][value="true"]', 'article[external_feed_builder][only_once]' do |elements| |
| 1123 | + assert elements.length > 0 | ||
| 1124 | + elements.each do |element| | ||
| 1125 | + assert element['checked'] | ||
| 1126 | + end | ||
| 1127 | + end | ||
| 1098 | end | 1128 | end |
| 1099 | 1129 | ||
| 1100 | should 'display media listing when it is TinyMceArticle and enabled on environment' do | 1130 | should 'display media listing when it is TinyMceArticle and enabled on environment' do |
| @@ -1250,7 +1280,12 @@ class CmsControllerTest < ActionController::TestCase | @@ -1250,7 +1280,12 @@ class CmsControllerTest < ActionController::TestCase | ||
| 1250 | should 'display posts per page input with default value on edit forum' do | 1280 | should 'display posts per page input with default value on edit forum' do |
| 1251 | n = Forum.new.posts_per_page.to_s | 1281 | n = Forum.new.posts_per_page.to_s |
| 1252 | get :new, :profile => profile.identifier, :type => 'Forum' | 1282 | get :new, :profile => profile.identifier, :type => 'Forum' |
| 1253 | - assert_tag :tag => 'select', :attributes => { :name => 'article[posts_per_page]' }, :child => { :tag => 'option', :attributes => {:value => n, :selected => 'selected'} } | 1283 | + assert_select 'select[name=?] option[value=?]', 'article[posts_per_page]', n do |elements| |
| 1284 | + assert elements.length > 0 | ||
| 1285 | + elements.each do |element| | ||
| 1286 | + assert element['selected'] | ||
| 1287 | + end | ||
| 1288 | + end | ||
| 1254 | end | 1289 | end |
| 1255 | 1290 | ||
| 1256 | should 'offer to edit a forum' do | 1291 | should 'offer to edit a forum' do |
| @@ -1419,7 +1454,12 @@ class CmsControllerTest < ActionController::TestCase | @@ -1419,7 +1454,12 @@ class CmsControllerTest < ActionController::TestCase | ||
| 1419 | should 'display display posts in current language input checked when editing blog' do | 1454 | should 'display display posts in current language input checked when editing blog' do |
| 1420 | profile.articles << Blog.new(:name => 'Blog for test', :profile => profile, :display_posts_in_current_language => true) | 1455 | profile.articles << Blog.new(:name => 'Blog for test', :profile => profile, :display_posts_in_current_language => true) |
| 1421 | get :edit, :profile => profile.identifier, :id => profile.blog.id | 1456 | get :edit, :profile => profile.identifier, :id => profile.blog.id |
| 1422 | - assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'article[display_posts_in_current_language]', :checked => 'checked' } | 1457 | + assert_select 'input[type=checkbox][name=?]', 'article[display_posts_in_current_language]' do |elements| |
| 1458 | + assert elements.length > 0 | ||
| 1459 | + elements.each do |element| | ||
| 1460 | + assert element["checked"] | ||
| 1461 | + end | ||
| 1462 | + end | ||
| 1423 | end | 1463 | end |
| 1424 | 1464 | ||
| 1425 | should 'display display posts in current language input not checked on new blog' do | 1465 | should 'display display posts in current language input not checked on new blog' do |
| @@ -1444,7 +1484,12 @@ class CmsControllerTest < ActionController::TestCase | @@ -1444,7 +1484,12 @@ class CmsControllerTest < ActionController::TestCase | ||
| 1444 | should 'be checked display posts in current language checkbox' do | 1484 | should 'be checked display posts in current language checkbox' do |
| 1445 | profile.articles << Blog.new(:name => 'Blog for test', :profile => profile, :display_posts_in_current_language => true) | 1485 | profile.articles << Blog.new(:name => 'Blog for test', :profile => profile, :display_posts_in_current_language => true) |
| 1446 | get :edit, :profile => profile.identifier, :id => profile.blog.id | 1486 | get :edit, :profile => profile.identifier, :id => profile.blog.id |
| 1447 | - assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'article[display_posts_in_current_language]', :checked => 'checked' } | 1487 | + assert_select 'input[type=checkbox][name=?]', 'article[display_posts_in_current_language]' do |elements| |
| 1488 | + assert elements.length > 0 | ||
| 1489 | + elements.each do |element| | ||
| 1490 | + assert element["checked"] | ||
| 1491 | + end | ||
| 1492 | + end | ||
| 1448 | end | 1493 | end |
| 1449 | 1494 | ||
| 1450 | should 'be unchecked display posts in current language checkbox' do | 1495 | should 'be unchecked display posts in current language checkbox' do |