[noosfero/noosfero][master] 6 commits: Handle access denied to not logged user properly

Rodrigo Souto gitlab at gitlab.com
Thu Jun 11 16:35:58 BRT 2015


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
2c72cbbf by Arthur Del Esposte at 2015-06-11T14:21:45Z
Handle access denied to not logged user properly

- - - - -
08cac104 by Tallys Martins at 2015-06-11T14:21:45Z
Fix cucumber broken tests

- - - - -
2540b45c by André Guedes at 2015-06-11T14:21:45Z
Fix tests related to privacity

Signed-off-by: André Guedes <andrebsguedes at gmail.com>
Signed-off-by: Arthur Del Esposte <arthurmde at gmail.com>
Signed-off-by: Fabio Teixeira <fabio1079 at gmail.com>
Signed-off-by: Tallys Martins <tallysmartins at yahoo.com.br>

- - - - -
8a4841d6 by Arthur Del Esposte at 2015-06-11T14:21:45Z
Fix functional and integration broken tests

Signed-off-by: André Guedes <andrebsguedes at gmail.com>
Signed-off-by: Arthur Del Esposte <arthurmde at gmail.com>
Signed-off-by: Fabio Teixeira <fabio1079 at gmail.com>
Signed-off-by: Tallys Martins <tallysmartins at yahoo.com.br>

- - - - -
57ac92af by Gabriela Navarro at 2015-06-11T14:21:45Z
Fix tests

  - The loading bar was fixed to fix media_panel_upload broken tests
  - The noosfero_steps was fixed to get the first box(this was breaking
    when it was on the environment.

Signed-off-by: Fabio Teixeira <fabio1079 at gmail.com>

- - - - -
512dd39f by Rodrigo Souto at 2015-06-11T16:25:58Z
cms-controller-test: fix edit for rss

- - - - -


20 changed files:

- app/controllers/my_profile/cms_controller.rb
- app/controllers/public/content_viewer_controller.rb
- app/models/article.rb
- features/approve_article.feature
- features/balloon.feature
- features/browse_enterprises.feature
- features/change_appearance.feature
- features/events.feature
- features/profile_domain.feature
- features/profile_search.feature
- features/register_enterprise.feature
- features/search_enterprises.feature
- features/step_definitions/noosfero_steps.rb
- features/suggest_article.feature
- public/javascripts/media-panel.js
- test/functional/application_controller_test.rb
- test/functional/content_viewer_controller_test.rb
- test/functional/organizations_controller_test.rb
- test/functional/profile_controller_test.rb
- test/integration/routing_test.rb


Changes:

=====================================
app/controllers/my_profile/cms_controller.rb
=====================================
--- a/app/controllers/my_profile/cms_controller.rb
+++ b/app/controllers/my_profile/cms_controller.rb
@@ -92,8 +92,10 @@ class CmsController < MyProfileController
 
     @article.article_privacy_exceptions = params[:q].split(/,/).map{|n| environment.people.find n.to_i} unless params[:q].nil?
 
-    @escaped_body = CGI::escapeHTML(@article.body || '')
-    @escaped_abstract = CGI::escapeHTML(@article.abstract || '')
+    unless @article.kind_of?(RssFeed)
+      @escaped_body = CGI::escapeHTML(@article.body || '')
+      @escaped_abstract = CGI::escapeHTML(@article.abstract || '')
+    end
 
     @tokenized_children = prepare_to_token_input(
                             profile.members.includes(:articles_with_access).find_all{ |m|


=====================================
app/controllers/public/content_viewer_controller.rb
=====================================
--- a/app/controllers/public/content_viewer_controller.rb
+++ b/app/controllers/public/content_viewer_controller.rb
@@ -127,7 +127,7 @@ class ContentViewerController < ApplicationController
     end
 
     unless @page.display_to?(user)
-      if !profile.visible? || profile.secret? || (user && user.follows?(profile))
+      if !profile.visible? || profile.secret? || (user && user.follows?(profile)) || user.blank?
         render_access_denied
       else #!profile.public?
         private_profile_partial_parameters


=====================================
app/models/article.rb
=====================================
--- a/app/models/article.rb
+++ b/app/models/article.rb
@@ -28,7 +28,7 @@ class Article < ActiveRecord::Base
   def initialize(*params)
     super
 
-    if !params.blank? && params.first.has_key?(:profile)
+    if !params.blank? && params.first.has_key?(:profile) && !params.first[:profile].blank?
       profile = params.first[:profile]
       self.published = false unless profile.public?
     end


=====================================
features/approve_article.feature
=====================================
--- a/features/approve_article.feature
+++ b/features/approve_article.feature
@@ -62,7 +62,8 @@ Feature: approve article
     And I press "Spread this"
     And I follow "Delete"
     And I confirm the browser dialog
-    When I am logged in as "joaosilva"
+    And I follow "Logout"
+    And I am logged in as "joaosilva"
     And I go to sample-community's control panel
     And I follow "Process requests"
     And I choose "Reject"


=====================================
features/balloon.feature
=====================================
--- a/features/balloon.feature
+++ b/features/balloon.feature
@@ -41,19 +41,19 @@ Feature: balloon
   @selenium
   Scenario: I should not see trigger if not enabled on page
     Given feature "show_balloon_with_profile_links_when_clicked" is disabled on environment
-    When I go to /assets/people
+    When I go to /search/people
     Then I should not see "Profile links"
 
   @selenium
   Scenario: I should not see trigger by default on page
     Given feature "show_balloon_with_profile_links_when_clicked" is enabled on environment
-    When I go to /assets/communities
+    When I go to /search/communities
     Then I should not see "Members"
 
   @selenium
   Scenario: I should see balloon when clicked on page trigger
     Given feature "show_balloon_with_profile_links_when_clicked" is enabled on environment
-    And I go to /assets/communities
+    And I go to /search/communities
     And display ".community-trigger"
     When I follow "Profile links"
     Then I should see "Members"


=====================================
features/browse_enterprises.feature
=====================================
--- a/features/browse_enterprises.feature
+++ b/features/browse_enterprises.feature
@@ -13,20 +13,20 @@ Scenario: show all enterprises
   Given the following enterprises
     | identifier | name        |
     | shop2      | Fruits Shop |
-  Given I am on /assets/enterprises
+  Given I am on /search/enterprises
   Then I should see "Enterprises"
   And I should see "Shoes Shop"
   And I should see "Fruits Shop"
 
 Scenario: show profile links button
-  Given I am on /assets/enterprises
+  Given I am on /search/enterprises
   Then I should see "Profile links" within "a.enterprise-trigger"
   And I should not see "Members"
   And I should not see "Agenda"
 
 @selenium-fixme
 Scenario: show profile links when clicked
-  Given I am on /assets/enterprises
+  Given I am on /search/enterprises
   When I follow "Profile links"
   Then I should see "Products" within "ul.menu-submenu-list"
   And I should see "Members" within "ul.menu-submenu-list"
@@ -34,7 +34,7 @@ Scenario: show profile links when clicked
 
 @selenium-fixme
 Scenario: go to catalog when click on products link
-  Given I am on /assets/enterprises
+  Given I am on /search/enterprises
   When I follow "Profile links"
   And I follow "Products" and wait
   Then I should be exactly on /catalog/shop1


=====================================
features/change_appearance.feature
=====================================
--- a/features/change_appearance.feature
+++ b/features/change_appearance.feature
@@ -14,7 +14,7 @@ Feature: Change appearance
     And I should not see an element ".box-4"
     And I go to joaosilva's control panel
     And I follow "Edit Appearance"
-    And I follow "Left Top and Right"
+    And I follow "Top and Side Bars"
     And I go to joaosilva's control panel
     And I follow "Edit sideboxes"
     And I should see an element ".box-4"


=====================================
features/events.feature
=====================================
--- a/features/events.feature
+++ b/features/events.feature
@@ -17,7 +17,7 @@ Feature: events
     Then I should see "November 2009" within ".current-month"
 
   Scenario: go to next month in global agenda
-    Given I am on /assets/events?year=2009&month=11
+    Given I am on /search/events?year=2009&month=11
     When I follow "December"
     Then I should see "December 2009" within ".current-month"
 
@@ -27,7 +27,7 @@ Feature: events
     Then I should see "September 2009" within ".current-month"
 
   Scenario: go to previous month in global agenda
-    Given I am on /assets/events?year=2009&month=11
+    Given I am on /search/events?year=2009&month=11
     When I follow "October"
     Then I should see "October 2009" within ".current-month"
 
@@ -43,7 +43,7 @@ Feature: events
 
   Scenario: go to specific day in global agenda
     Given I am on the homepage
-    When I am on /assets/events?year=2009&month=11&day=12
+    When I am on /search/events?year=2009&month=11&day=12
     Then I should see "Events for November, 2009"
 
   Scenario: list events for specific day
@@ -88,7 +88,7 @@ Feature: events
     And the following events
       | owner      | name            | start_date |
       | josemanuel | Manuel Birthday | 2009-10-24 |
-    When I am on /assets/events?year=2009&month=10&day=24
+    When I am on /search/events?year=2009&month=10&day=24
     Then I should see "Another Conference"
     And I should see "Manuel Birthday"
 
@@ -157,7 +157,7 @@ Feature: events
     Then I should not see "New events" link
 
   Scenario: display environment name in global agenda
-    When I am on /assets/events
+    When I am on /search/events
     Then I should see "Colivre.net's Events"
 
   @selenium


=====================================
features/profile_domain.feature
=====================================
--- a/features/profile_domain.feature
+++ b/features/profile_domain.feature
@@ -21,9 +21,7 @@ Feature: domain for profile
   Scenario: access profile control panel through profile blocks
     Given I am logged in as "joaosilva"
     When I go to joaosilva's homepage
-    And I follow "Control panel" within ".profile-info-block"
-    Then I should see "Joao Silva" within "span.control-panel-title"
-    When I follow "Control panel" within ".profile-image-block"
+    And I follow "Control panel" within ".profile-image-block"
     Then I should see "Joao Silva" within "span.control-panel-title"
 
   @selenium


=====================================
features/profile_search.feature
=====================================
--- a/features/profile_search.feature
+++ b/features/profile_search.feature
@@ -36,7 +36,7 @@ Feature: search inside a profile
       | joaosilva | ProfileSearchBlock  |
     When I go to joaosilva's profile
     And I fill in "q" with "bees" within ".profile-search-block"
-    And I press "Search"
+    And I press "Search" within ".profile-search-block"
     Then I should see "bees and butterflies" within ".main-block"
 
   Scenario: not display unpublished articles


=====================================
features/register_enterprise.feature
=====================================
--- a/features/register_enterprise.feature
+++ b/features/register_enterprise.feature
@@ -203,5 +203,5 @@ Feature: register enterprise
 
   Scenario: a user cant see button to register new enterprise if enterprise_registration disabled
     Given feature "enterprise_registration" is disabled on environment
-    When I am on /assets/enterprises
+    When I am on /search/enterprises
     Then I should not see "New enterprise" link


=====================================
features/search_enterprises.feature
=====================================
--- a/features/search_enterprises.feature
+++ b/features/search_enterprises.feature
@@ -56,7 +56,7 @@ Feature: search enterprises
       | owner | name | body | homepage |
       | shop1 | Shoes home | This is the <i>homepage</i> of Shoes shop! It has a very long and pretty vague description, just so we can test wether the system will correctly create an excerpt of this text. We should probably talk about shoes. | true |
     When I search enterprises for "shoes"
-    And I choose the search filter "Full"
+    And I select "Full" from "display"
     Then I should see "This is the homepage of" within ".search-enterprise-description"
     And I should see "about sho..." within ".search-enterprise-description"
 
@@ -66,7 +66,7 @@ Feature: search enterprises
       | identifier | name | description |
       | shop4 | Clothes shop | This <b>clothes</b> shop also sells shoes! This too has a very long and pretty vague description, just so we can test wether the system will correctly create an excerpt of this text. Clothes are a really important part of our lives. |
     When I search enterprises for "clothes"
-    And I choose the search filter "Full"
+    And I select "Full" from "display"
     And I should see "This clothes shop" within ".search-enterprise-description"
     And I should see "really import..." within ".search-enterprise-description"
 


=====================================
features/step_definitions/noosfero_steps.rb
=====================================
--- a/features/step_definitions/noosfero_steps.rb
+++ b/features/step_definitions/noosfero_steps.rb
@@ -94,7 +94,7 @@ Given /^the following blocks$/ do |table|
       owner.boxes<< Box.new
       owner.boxes.first.blocks << MainBlock.new
     end
-    box = owner.boxes.where(:position => 3).first
+    box = owner.boxes.first
     klass.constantize.create!(item.merge(:box => box))
   end
 end


=====================================
features/suggest_article.feature
=====================================
--- a/features/suggest_article.feature
+++ b/features/suggest_article.feature
@@ -14,9 +14,12 @@ Feature: suggest article
 
   @selenium
   Scenario: highlight an article before approval of a suggested article
-    Given someone suggested the following article to be published
-      | target           | article_name        | article_body                    | name | email            |
-      | sample-community | A suggested article | this is an article about whales | jose | jose at example.org |
+    Given I am on Sample Community's blog
+    And I follow "Suggest an article"
+    And I fill in "Title" with "Suggestion"
+    And I fill in "Your name" with "Some Guy"
+    And I fill in "Email" with "someguy at somewhere.com"
+    And I press "Save"
     When I am logged in as "joaosilva"
     And I go to sample-community's control panel
     And I follow "Process requests"


=====================================
public/javascripts/media-panel.js
=====================================
--- a/public/javascripts/media-panel.js
+++ b/public/javascripts/media-panel.js
@@ -1,137 +1,164 @@
-var file_id = 1;
-
-jQuery('.view-all-media').on('click', '.pagination a', function(event) {
-  jQuery.ajax({
-    url: this.href,
-    beforeSend: function(){jQuery('.view-all-media').addClass('fetching')},
-    complete: function() {jQuery('.view-all-media').removeClass('fetching')},
-    dataType: 'script'
+(function($) {
+  "use strict";
+
+  var file_id = 1;
+
+  $('.view-all-media').on('click', '.pagination a', function(event) {
+    $.ajax({
+      url: this.href,
+      beforeSend: function(){$('.view-all-media').addClass('fetching')},
+      complete: function() {$('.view-all-media').removeClass('fetching')},
+      dataType: 'script'
+    });
+    return false;
   });
-  return false;
-});
-
-jQuery('#file').fileupload({
-  add: function(e, data){
-    data.files[0].id = file_id;
-    file_id++;
-    data.context = jQuery(tmpl("template-upload", data.files[0]));
-    jQuery('#media-upload-form').append(data.context);
-    data.submit();
-  },
-  progress: function (e, data) {
-    if (jQuery('#hide-uploads').data('bootstraped') == false) {
-      jQuery('#hide-uploads').show();
-      jQuery('#hide-uploads').data('bootstraped', true);
-    }
-    if (data.context) {
-      progress = parseInt(data.loaded / data.total * 100, 10);
-      data.context.find('.bar').css('width', progress + '%');
-      data.context.find('.percentage').text(progress + '%');
-    }
-  },
-  fail: function(e, data){
-    var file_id = '#file-'+data.files[0].id;
-    jQuery(file_id).find('.progress .bar').addClass('error');
-    jQuery(file_id).append("<div class='error-message'>" + data.jqXHR.responseText + "</div>")
-  }
-});
-
-jQuery('#hide-uploads').click(function(){
-  jQuery('#hide-uploads').hide();
-  jQuery('#show-uploads').show();
-  jQuery('.upload').slideUp();
-  return false;
-});
-
-jQuery('#show-uploads').click(function(){
-  jQuery('#hide-uploads').show();
-  jQuery('#show-uploads').hide();
-  jQuery('.upload').slideDown();
-  return false;
-});
-
-function loadPublishedMedia() {
-  var parent_id = jQuery('#published-media #parent_id').val();
-  var q = jQuery('#published-media #q').val();
-  var url = jQuery('#published-media').data('url');
-
-  jQuery('#published-media .items').addClass('fetching');
-  jQuery.ajax({
-    url: url,
-    data: {'parent_id': parent_id, 'q': q},
-    dataType: 'html',
-    success: function(response) {
-      jQuery("#published-media .items").html(response);
-      jQuery('#published-media .items').removeClass('fetching');
-      updateViewAllLinks();
+
+
+  $('#file').fileupload({
+    add: function(e, data){
+      data.files[0].id = file_id;
+      file_id++;
+      data.context = $(tmpl("template-upload", data.files[0]));
+      $('#media-upload-form').append(data.context);
+      data.submit();
+    },
+    progress: function (e, data) {
+      if ($('#hide-uploads').data('bootstraped') == false) {
+        $('#hide-uploads').show();
+        $('#hide-uploads').data('bootstraped', true);
+      }
+      if (data.context) {
+        var progress = parseInt(data.loaded / data.total * 100, 10);
+        data.context.find('.bar').css('width', progress + '%');
+        data.context.find('.percentage').text(progress + '%');
+      }
     },
-    error: function(response, textStatus, xhr) {
-      console.log(response);
-      console.log(textStatus);
+    fail: function(e, data){
+      var file_id = '#file-'+data.files[0].id;
+      $(file_id).find('.progress .bar').addClass('error');
+      $(file_id).append("<div class='error-message'>" + data.jqXHR.responseText + "</div>")
     }
   });
-}
-
-function updateViewAllLinks() {
-  var parent_id = jQuery('#published-media #parent_id').val();
-  var q = jQuery('#published-media #q').val();
-  jQuery('#published-media .view-all').each(function(){
-    var key = jQuery(this).data('key');
-    var params = {parent_id: parent_id, q: q, key: key}
-    var href = jQuery(this).attr('href');
-    href = href.replace(/\?.*/, '?'+jQuery.param(params));
-    jQuery(this).attr('href', href);
+
+
+  $('#hide-uploads').click(function(){
+    $('#hide-uploads').hide();
+    $('#show-uploads').show();
+    $('.upload').slideUp();
+    return false;
+  });
+
+
+  $('#show-uploads').click(function(){
+    $('#hide-uploads').show();
+    $('#show-uploads').hide();
+    $('.upload').slideDown();
+    return false;
   });
-}
-
-jQuery('#published-media #parent_id').change(function(){ loadPublishedMedia() });
-
-jQuery("#published-media #q").typeWatch({
-  callback: function (value) { loadPublishedMedia() },
-  wait: 750,
-  highlight: true,
-  captureLength: 2
-});
-
-jQuery("#published-media #q").bind('notext', function(){ loadPublishedMedia() });
-
-jQuery("#new-folder-dialog").submit(function( event ) {
-  var name = jQuery('#new_folder').val();
-  var parent_id = jQuery("#new-folder-dialog #parent_id").val();
-  jQuery.ajax({
-    url: this.action,
-    type: 'POST',
-    data: {
-      'parent_id': parent_id,
-      'article': {'name': name, 'published': true},
-      'type': jQuery('input[name=folder_type]:checked').val() },
-    dataType: 'json',
-    beforeSend: function(){jQuery("#new-folder-dialog").addClass('fetching')},
-    success: function(response) {
-      var option_selected = "<option value='"+ response.id +"' selected='selected'>"+ response.full_name +"</options>"
-      var option = "<option value='"+ response.id +"'>"+ response.full_name +"</options>"
-      jQuery('#media-upload-form #parent_id').append(option_selected);
-      jQuery('#published-media #parent_id').append(option);
-      jQuery('#new_folder').val('');
-    },
-    error: function(response, textStatus, xhr) {
-      console.log(response);
-      console.log(textStatus);
-    },
-    complete: function(response){
-      jQuery("#new-folder-dialog").removeClass('fetching');
-      jQuery("#new-folder-dialog").dialog('close');
-    }
+
+
+  function loadPublishedMedia() {
+    var parent_id = $('#published-media #parent_id').val();
+    var q = $('#published-media #q').val();
+    var url = $('#published-media').data('url');
+
+    $('#published-media .items').addClass('fetching');
+    $.ajax({
+      url: url,
+      data: {'parent_id': parent_id, 'q': q},
+      dataType: 'html',
+      success: function(response) {
+        $("#published-media .items").html(response);
+        $('#published-media .items').removeClass('fetching');
+        updateViewAllLinks();
+      },
+      error: function(response, textStatus, xhr) {
+        console.log(response);
+        console.log(textStatus);
+      }
+    });
+  }
+  // make it global for usage in media_upload.js.erb
+  window.loadPublishedMedia = loadPublishedMedia;
+
+
+  function updateViewAllLinks() {
+    var parent_id = $('#published-media #parent_id').val();
+    var q = $('#published-media #q').val();
+    $('#published-media .view-all').each(function(){
+      var key = $(this).data('key');
+      var params = {parent_id: parent_id, q: q, key: key}
+      var href = $(this).attr('href');
+      href = href.replace(/\?.*/, '?'+$.param(params));
+      $(this).attr('href', href);
+    });
+  }
+
+
+  $('#published-media #parent_id').change(function(){
+    loadPublishedMedia()
+  });
+
+
+  // Using a immediate function to make timer variable only visible for the keyup event
+  (function() {
+    var timer = null;
+
+    $("#published-media #q").keyup(function() {
+      if(this.value.length > 2) {
+        timer = setTimeout(loadPublishedMedia, 750);
+      }
+    }).keydown(function() {
+        clearTimeout(timer);
+    });
+  }) ();
+
+
+  $("#published-media #q").bind('notext', function(){
+    loadPublishedMedia()
+  });
+
+
+  $("#new-folder-dialog").submit(function( event ) {
+    var name = $('#new_folder').val();
+    var parent_id = $("#new-folder-dialog #parent_id").val();
+    $.ajax({
+      url: this.action,
+      type: 'POST',
+      data: {
+        'parent_id': parent_id,
+        'article': {'name': name, 'published': true},
+        'type': $('input[name=folder_type]:checked').val() },
+      dataType: 'json',
+      beforeSend: function(){$("#new-folder-dialog").addClass('fetching')},
+      success: function(response) {
+        var option_selected = "<option value='"+ response.id +"' selected='selected'>"+ response.full_name +"</options>"
+        var option = "<option value='"+ response.id +"'>"+ response.full_name +"</options>"
+        $('#media-upload-form #parent_id').append(option_selected);
+        $('#published-media #parent_id').append(option);
+        $('#new_folder').val('');
+      },
+      error: function(response, textStatus, xhr) {
+        console.log(response);
+        console.log(textStatus);
+      },
+      complete: function(response){
+        $("#new-folder-dialog").removeClass('fetching');
+        $("#new-folder-dialog").dialog('close');
+      }
+    });
+    return false;
+  });
+
+  $('.icon-vertical-toggle').click(function(){
+    $('#content').toggleClass('show-media-panel');
+    return false;
   });
-  return false;
-});
-
-jQuery('.text-editor-sidebar .header .icon-vertical-toggle').click(function(){
-  jQuery('#content').toggleClass('show-media-panel');
-  return false;
-});
-
-jQuery('#new-folder-button').click(function(){
-  jQuery('#new-folder-dialog').dialog({modal: true});
-  return false;
-});
+
+
+  $('#new-folder-button').click(function(){
+    $('#new-folder-dialog').dialog({modal: true});
+    return false;
+  });
+
+}) (jQuery);


=====================================
test/functional/application_controller_test.rb
=====================================
--- a/test/functional/application_controller_test.rb
+++ b/test/functional/application_controller_test.rb
@@ -484,7 +484,7 @@ class ApplicationControllerTest < ActionController::TestCase
     should 'change postgresql schema' do
       uses_host 'schema1.com'
       Noosfero::MultiTenancy.expects(:on?).returns(true)
-      Noosfero::MultiTenancy.expects(:mapping).returns({ 'schema1.com' => 'schema1' })
+      Noosfero::MultiTenancy.expects(:mapping).returns({ 'schema1.com' => 'schema1' }).at_least_once
       exception = assert_raise(ActiveRecord::StatementInvalid) { get :index }
       assert_match /SET search_path TO schema1/, exception.message
     end


=====================================
test/functional/content_viewer_controller_test.rb
=====================================
--- a/test/functional/content_viewer_controller_test.rb
+++ b/test/functional/content_viewer_controller_test.rb
@@ -262,7 +262,7 @@ class ContentViewerControllerTest < ActionController::TestCase
 
     get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ]
 
-    assert_template "profile/_private_profile"
+    assert_template "shared/access_denied"
   end
 
   should 'not give access to private articles if logged in but not member' do
@@ -1527,12 +1527,12 @@ class ContentViewerControllerTest < ActionController::TestCase
   should 'use context method in extra toolbar actions on article from plugins' do
     class Plugin1 < Noosfero::Plugin
       def article_extra_toolbar_buttons(article)
-        if current_person.public?
+        if profile.public?
           {:title => 'some_title', :icon => 'some_icon', :url => '/someurl'}
         else
           {:title => 'another_title', :icon => 'another_icon', :url => '/anotherurl'}
         end
-      end
+       end
     end
     Noosfero::Plugin.stubs(:all).returns([Plugin1.name])
 


=====================================
test/functional/organizations_controller_test.rb
=====================================
--- a/test/functional/organizations_controller_test.rb
+++ b/test/functional/organizations_controller_test.rb
@@ -86,7 +86,7 @@ class OrganizationsControllerTest < ActionController::TestCase
 
   should 'activate organization profile' do
     organization = fast_create(Organization, :visible => false, :environment_id => environment.id)
-    assert organization.disabled?
+    assert !organization.visible?
 
     get :activate, {:id => organization.id}
     organization.reload


=====================================
test/functional/profile_controller_test.rb
=====================================
--- a/test/functional/profile_controller_test.rb
+++ b/test/functional/profile_controller_test.rb
@@ -508,11 +508,15 @@ class ProfileControllerTest < ActionController::TestCase
   end
 
   should 'show description of person' do
+    environment = Environment.default
+    environment.custom_person_fields = {:description => { :active => true, :required => false, :signup => false }}
+    environment.save!
+    environment.reload
     login_as(@profile.identifier)
-    @profile.description = 'Person\'s description'
-    @profile.save
+    @profile.description = 'Person description'
+    @profile.save!
     get :index, :profile => @profile.identifier
-    assert_tag :tag => 'div', :attributes => { :class => 'public-profile-description' }, :content => /Person\'s description/
+    assert_tag :tag => 'div', :attributes => { :class => 'public-profile-description' }, :content => /Person description/
   end
 
   should 'not show description of orgarnization if not filled' do


=====================================
test/integration/routing_test.rb
=====================================
--- a/test/integration/routing_test.rb
+++ b/test/integration/routing_test.rb
@@ -135,7 +135,7 @@ class RoutingTest < ActionController::IntegrationTest
   end
 
   def test_assets_routing
-    assert_routing('/assets/my-asset/a/b/c', :controller => 'search', :action => 'assets', :asset => 'my-asset', :category_path => 'a/b/c')
+    assert_routing('/search/assets/a/b/c', :controller => 'search', :action => 'assets', :category_path => 'a/b/c')
   end
 
   def test_content_view_with_dot



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/088735b39ae92117aa914c2116f5410892cf89dd...512dd39f3bf3c9bc4b4bb3631fa297b6ed6467a0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150611/da24dcf8/attachment-0001.html>


More information about the Noosfero-dev mailing list