Commit 2540b45ca6c0b1e1e67daee27084aaa9138f4ce0

Authored by André Guedes
Committed by Rodrigo Souto
1 parent 08cac104

Fix tests related to privacity

Signed-off-by: André Guedes <andrebsguedes@gmail.com>
Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com>
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br>
app/models/article.rb
@@ -28,7 +28,7 @@ class Article &lt; ActiveRecord::Base @@ -28,7 +28,7 @@ class Article &lt; ActiveRecord::Base
28 def initialize(*params) 28 def initialize(*params)
29 super 29 super
30 30
31 - if !params.blank? && params.first.has_key?(:profile) 31 + if !params.blank? && params.first.has_key?(:profile) && !params.first[:profile].blank?
32 profile = params.first[:profile] 32 profile = params.first[:profile]
33 self.published = false unless profile.public? 33 self.published = false unless profile.public?
34 end 34 end
test/functional/content_viewer_controller_test.rb
@@ -1527,12 +1527,12 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -1527,12 +1527,12 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
1527 should 'use context method in extra toolbar actions on article from plugins' do 1527 should 'use context method in extra toolbar actions on article from plugins' do
1528 class Plugin1 < Noosfero::Plugin 1528 class Plugin1 < Noosfero::Plugin
1529 def article_extra_toolbar_buttons(article) 1529 def article_extra_toolbar_buttons(article)
1530 - if current_person.public? 1530 + if profile.public?
1531 {:title => 'some_title', :icon => 'some_icon', :url => '/someurl'} 1531 {:title => 'some_title', :icon => 'some_icon', :url => '/someurl'}
1532 else 1532 else
1533 {:title => 'another_title', :icon => 'another_icon', :url => '/anotherurl'} 1533 {:title => 'another_title', :icon => 'another_icon', :url => '/anotherurl'}
1534 end 1534 end
1535 - end 1535 + end
1536 end 1536 end
1537 Noosfero::Plugin.stubs(:all).returns([Plugin1.name]) 1537 Noosfero::Plugin.stubs(:all).returns([Plugin1.name])
1538 1538
test/functional/organizations_controller_test.rb
@@ -86,7 +86,7 @@ class OrganizationsControllerTest &lt; ActionController::TestCase @@ -86,7 +86,7 @@ class OrganizationsControllerTest &lt; ActionController::TestCase
86 86
87 should 'activate organization profile' do 87 should 'activate organization profile' do
88 organization = fast_create(Organization, :visible => false, :environment_id => environment.id) 88 organization = fast_create(Organization, :visible => false, :environment_id => environment.id)
89 - assert organization.disabled? 89 + assert !organization.visible?
90 90
91 get :activate, {:id => organization.id} 91 get :activate, {:id => organization.id}
92 organization.reload 92 organization.reload