3686: ensure Advanced is always the last pane even after adding the Sharing pane.
authorRadhika Chippada <radhika@curoverse.com>
Fri, 16 Jan 2015 23:18:22 +0000 (18:18 -0500)
committerRadhika Chippada <radhika@curoverse.com>
Fri, 16 Jan 2015 23:18:22 +0000 (18:18 -0500)
apps/workbench/app/controllers/repositories_controller.rb
apps/workbench/test/helpers/share_object_helper.rb
apps/workbench/test/integration/projects_test.rb
apps/workbench/test/integration/repositories_test.rb

index 5dd9288e121e6f355b4ef8dfbe97832ed25b9a8e..3678ceb4fe265d7d42242f7c36a22d2942b312fa 100644 (file)
@@ -7,7 +7,9 @@ class RepositoriesController < ApplicationController
 
   def show_pane_list
     if @user_is_manager
-      super | %w(Sharing)
+      panes = super | %w(Sharing)
+      panes.insert(panes.length-1, panes.delete_at(panes.index('Advanced'))) if panes.index('Advanced')
+      panes
     else
       super
     end
index 400fcfb51e006bf0f50010a87026615e5b827cf5..783e2bb1c9058067f94f8982708ae9c02db48e73 100644 (file)
@@ -1,14 +1,8 @@
 module ShareObjectHelper
-  def show_repository_using(auth_key, repo_key='arvados')
-    repo_uuid = api_fixture('repositories')[repo_key]['uuid']
-    visit(page_with_token(auth_key, "/repositories/#{repo_uuid}"))
-    assert(page.has_text?("push_url"), "not on expected repository page")
-  end
-
-  def show_project_using(auth_key, proj_key='aproject')
-    project_uuid = api_fixture('groups')[proj_key]['uuid']
-    visit(page_with_token(auth_key, "/projects/#{project_uuid}"))
-    assert(page.has_text?("A Project"), "not on expected project page")
+  def show_object_using(auth_key, type, key, expect)
+    obj_uuid = api_fixture(type)[key]['uuid']
+    visit(page_with_token(auth_key, "/#{type}/#{obj_uuid}"))
+    assert(page.has_text?(expect), "expected string not found: #{expect}")
   end
 
   def share_rows
index cb06e19a27c7ec15971f6bd8be93dc984693c633..77d5722947abb24e0d02bc452819960c85b5ccfc 100644 (file)
@@ -173,7 +173,7 @@ class ProjectsTest < ActionDispatch::IntegrationTest
   end
 
   test "project viewer can't see project sharing tab" do
-    show_project_using("project_viewer")
+    show_object_using('project_viewer', 'groups', 'aproject', 'A Project')
     assert(page.has_no_link?("Sharing"),
            "read-only project user sees sharing tab")
   end
@@ -182,7 +182,7 @@ class ProjectsTest < ActionDispatch::IntegrationTest
     add_user = api_fixture('users')['future_project_user']
     new_name = ["first_name", "last_name"].map { |k| add_user[k] }.join(" ")
 
-    show_project_using("active")
+    show_object_using('active', 'groups', 'aproject', 'A Project')
     click_on "Sharing"
     add_share_and_check("users", new_name, add_user)
     modify_share_and_check(new_name)
@@ -191,14 +191,14 @@ class ProjectsTest < ActionDispatch::IntegrationTest
   test "project owner can manage sharing for another group" do
     new_name = api_fixture('groups')['future_project_viewing_group']['name']
 
-    show_project_using("active")
+    show_object_using('active', 'groups', 'aproject', 'A Project')
     click_on "Sharing"
     add_share_and_check("groups", new_name)
     modify_share_and_check(new_name)
   end
 
   test "'share with group' listing does not offer projects" do
-    show_project_using("active")
+    show_object_using('active', 'groups', 'aproject', 'A Project')
     click_on "Sharing"
     click_on "Share with groups"
     good_uuid = api_fixture("groups")["private"]["uuid"]
index 5648c71be9efd3a131572da25a428b79b387a648..1e1a118a7a5ec6d8e9610c3d244ddd9a7bafd0dd 100644 (file)
@@ -15,8 +15,7 @@ class RepositoriesTest < ActionDispatch::IntegrationTest
     test "#{user} can manage sharing for another user" do
       add_user = api_fixture('users')['future_project_user']
       new_name = ["first_name", "last_name"].map { |k| add_user[k] }.join(" ")
-
-      show_repository_using(user, 'foo')
+      show_object_using(user, 'repositories', 'foo', 'push_url')
       click_on "Sharing"
       add_share_and_check("users", new_name, add_user)
       modify_share_and_check(new_name)
@@ -29,8 +28,7 @@ class RepositoriesTest < ActionDispatch::IntegrationTest
   ].each do |user|
     test "#{user} can manage sharing for another group" do
       new_name = api_fixture('groups')['future_project_viewing_group']['name']
-
-      show_repository_using("active", 'foo')
+      show_object_using(user, 'repositories', 'foo', 'push_url')
       click_on "Sharing"
       add_share_and_check("groups", new_name)
       modify_share_and_check(new_name)
@@ -38,7 +36,7 @@ class RepositoriesTest < ActionDispatch::IntegrationTest
   end
 
   test "spectator does not see repository sharing tab" do
-    show_repository_using("spectator")
+    show_object_using("spectator", 'repositories', 'arvados', 'push_url')
     assert(page.has_no_link?("Sharing"),
            "read-only repository user sees sharing tab")
   end