[ARVADOS] updated: 57922375aa60a80e5af5c1e5baa0205df9dfdfb1

git at public.curoverse.com git at public.curoverse.com
Mon Jul 6 14:02:08 EDT 2015


Summary of changes:
 apps/workbench/app/views/layouts/body.html.erb      |  4 ++--
 .../test/controllers/projects_controller_test.rb    | 21 ++++++++++++++++++++-
 2 files changed, 22 insertions(+), 3 deletions(-)

       via  57922375aa60a80e5af5c1e5baa0205df9dfdfb1 (commit)
      from  87e9c0e26ff55582a993a8e11902e8657647f59a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 57922375aa60a80e5af5c1e5baa0205df9dfdfb1
Author: Manoj <jonam33 at gmail.com>
Date:   Mon Jul 6 14:00:24 2015 -0400

    6466 - Update body html for enable public page and added tests to project controller test.

diff --git a/apps/workbench/app/views/layouts/body.html.erb b/apps/workbench/app/views/layouts/body.html.erb
index 54e6626..0f90c41 100644
--- a/apps/workbench/app/views/layouts/body.html.erb
+++ b/apps/workbench/app/views/layouts/body.html.erb
@@ -116,7 +116,7 @@
               </li>
             <% end %>
           <% else %>
-            <% if Rails.configuration.anonymous_user_token %>
+            <% if Rails.configuration.anonymous_user_token and Rails.configuration.enable_public_projects_page %>
               <li><%= link_to 'Browse public projects', "/projects/public" %></li>
             <% end %>
             <li class="dropdown hover-dropdown login-menu">
@@ -183,7 +183,7 @@
               <span class="caret"></span>
             </a>
             <ul class="dropdown-menu" style="min-width: 20em" role="menu">
-              <% if Rails.configuration.anonymous_user_token %>
+              <% if Rails.configuration.anonymous_user_token and Rails.configuration.enable_public_projects_page %>
                 <li><%= link_to 'Browse public projects', "/projects/public", class: 'btn btn-xs btn-default pull-right' %></li>
               <% end %>
               <li>
diff --git a/apps/workbench/test/controllers/projects_controller_test.rb b/apps/workbench/test/controllers/projects_controller_test.rb
index 41ed727..62a93a1 100644
--- a/apps/workbench/test/controllers/projects_controller_test.rb
+++ b/apps/workbench/test/controllers/projects_controller_test.rb
@@ -267,6 +267,7 @@ class ProjectsControllerTest < ActionController::TestCase
       project_names = assigns(:objects).collect(&:name)
       assert_includes project_names, 'Unrestricted public data'
       assert_not_includes project_names, 'A Project'
+      refute_empty css_select('[href="/projects/public"]')
     end
   end
 
@@ -275,7 +276,7 @@ class ProjectsControllerTest < ActionController::TestCase
     assert_response 404
   end
 
-  test "visit public projects page when anon config is enabled but public projects page is disabled and expect 404" do
+  test "visit public projects page when anon config is enabled but public projects page is disabled as active user and expect 404" do
     Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
     Rails.configuration.enable_public_projects_page = false
     get :public, {}, session_for(:active)
@@ -286,5 +287,23 @@ class ProjectsControllerTest < ActionController::TestCase
     get :public
     assert_response :redirect
     assert_match /\/users\/welcome/, @response.redirect_url
+    assert_empty css_select('[href="/projects/public"]')
+  end
+
+  test "visit public projects page when anon config is enabled and public projects page is disabled and expect login page" do
+    Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
+    Rails.configuration.enable_public_projects_page = false
+    get :index
+    assert_response :redirect
+    assert_match /\/users\/welcome/, @response.redirect_url
+    assert_empty css_select('[href="/projects/public"]')
+  end
+
+  test "visit public projects page when anon config is not enabled and public projects page is enabled and expect login page" do
+    Rails.configuration.enable_public_projects_page = true
+    get :index
+    assert_response :redirect
+    assert_match /\/users\/welcome/, @response.redirect_url
+    assert_empty css_select('[href="/projects/public"]')
   end
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list