Commit 3521012e05a69420572c4bac892d066d0cbdfcd1

Authored by Larissa Reis
1 parent f0f667bb

[welcome-page] Fixes functionals tests for Noosfero 1.0

app/views/home/welcome.html.erb
... ... @@ -17,8 +17,11 @@
17 17 <p><%= _("You won't appear as %s until your account is approved.") % link_to(_('user'), {:controller => :search, :action => :people, :filter => 'more_recent'}, :target => '_blank') %></p>
18 18 <% end %>
19 19 <h4><%= _("What to do next?") %></h4>
20   - <p><%= _("Access your %s and see your face on the network!") % link_to(_('Profile'), {:controller => 'profile', :profile => user.identifier}, :target => '_blank') %></p>
21   - <p><%= _("Explore your %s to customize your profile. Here are some %s on what you can do there.") % [link_to(_('Control Panel'), {:controller => 'profile_editor', :profile => user.identifier}, :target => '_blank'), link_to(_('tips'), {:controller => 'doc', :action => 'topic', :section => 'user', :topic => 'editing-person-info'}, :target => '_blank')] %></p>
  20 + <p><%= _("Access your %s and see your face on the network!") %
  21 + (user.present? ? link_to(_('Profile'), {:controller => 'profile', :profile => user.identifier}, :target => '_blank') : 'Profile') %>
  22 + <%= _("You can also explore your %s to customize your profile. Here are some %s on what you can do there.") %
  23 + [user.present? ? link_to(_('Control Panel'), {:controller => 'profile_editor', :profile => user.identifier}, :target => '_blank') : 'Control Panel',
  24 + link_to(_('tips'), {:controller => 'doc', :action => 'topic', :section => 'user', :topic => 'editing-person-info'}, :target => '_blank')] %></p>
22 25 <p><%= _("%s your Gmail, Yahoo and Hotmail contacts!") % link_to(_('Invite and find'), {:controller => 'doc', :action => 'topic', :section => 'user', :topic => 'invite-contacts'}, :target => '_blank') %></p>
23 26 <p><%= _("Learn the guidelines. Read the %s for more details on how to use this social network!") % link_to(_('Documentation'), {:controller => 'doc'}, :target => '_blank') %></p>
24 27 <p><%= _("Start exploring and have fun!") %></p>
... ...
test/functional/enterprise_registration_controller_test.rb
... ... @@ -66,7 +66,7 @@ class EnterpriseRegistrationControllerTest &lt; ActionController::TestCase
66 66 template.welcome_page = welcome_page
67 67 template.save!
68 68  
69   - data = { :name => 'My new enterprise', :identifier => 'mynew', :region => region, :template_id => template.id }
  69 + data = { :name => 'My new enterprise', :identifier => 'mynew', :region_id => region.id, :template_id => template.id }
70 70 create_enterprise = CreateEnterprise.new(data)
71 71  
72 72 post :index, :create_enterprise => data
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -880,14 +880,14 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
880 880 end
881 881 end
882 882  
883   - should 'have welcome_page only for person template' do
  883 + should 'have welcome_page only for template' do
884 884 organization = fast_create(Organization, :is_template => false)
885 885 @controller.stubs(:profile).returns(organization)
886 886 assert !@controller.send(:has_welcome_page)
887 887  
888 888 organization = fast_create(Organization, :is_template => true)
889 889 @controller.stubs(:profile).returns(organization)
890   - assert !@controller.send(:has_welcome_page)
  890 + assert @controller.send(:has_welcome_page)
891 891  
892 892 person = fast_create(Person, :is_template => false)
893 893 @controller.stubs(:profile).returns(person)
... ... @@ -901,11 +901,11 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
901 901 should 'display welcome_page button only if profile has_welcome_page' do
902 902 @controller.stubs(:has_welcome_page).returns(true)
903 903 get :index, :profile => fast_create(Profile).identifier
904   - assert_tag :tag => 'a', :content => 'Edit Welcome Page'
  904 + assert_tag :tag => 'a', :content => 'Edit welcome page'
905 905  
906 906 @controller.stubs(:has_welcome_page).returns(false)
907 907 get :index, :profile => fast_create(Profile).identifier
908   - assert_no_tag :tag => 'a', :content => 'Edit Welcome Page'
  908 + assert_no_tag :tag => 'a', :content => 'Edit welcome page'
909 909 end
910 910  
911 911 should 'not be able to access welcome_page if profile does not has_welcome_page' do
... ... @@ -920,11 +920,14 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
920 920 end
921 921  
922 922 should 'update welcome page and redirect to index' do
923   - welcome_page = fast_create(TinyMceArticle, :body => 'Initial welcome page')
924 923 person_template = create_user('person_template').person
925 924 person_template.is_template = true
  925 +
  926 + welcome_page = fast_create(TinyMceArticle, :body => 'Initial welcome page')
926 927 person_template.welcome_page = welcome_page
927 928 person_template.save!
  929 + welcome_page.profile = person_template
  930 + welcome_page.save!
928 931 new_content = 'New welcome page'
929 932  
930 933 post :welcome_page, :profile => person_template.identifier, :welcome_page => {:body => new_content}
... ...