X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a959f21c8147f26362df392bc3fd3290db69de85..91a3a6759a0294c28fa55f044c2d611d01054c20:/apps/workbench/test/functional/projects_controller_test.rb diff --git a/apps/workbench/test/functional/projects_controller_test.rb b/apps/workbench/test/functional/projects_controller_test.rb index b338aa8186..a991cedd63 100644 --- a/apps/workbench/test/functional/projects_controller_test.rb +++ b/apps/workbench/test/functional/projects_controller_test.rb @@ -9,4 +9,23 @@ class ProjectsControllerTest < ActionController::TestCase assert_template 'user_agreements/index', "Inactive user was not presented with a user agreement at the front page" end + + [[:active, true], + [:project_viewer, false]].each do |which_user, should_show| + test "create subproject button #{'not ' unless should_show} shown to #{which_user}" do + readonly_project_uuid = api_fixture('groups')['aproject']['uuid'] + get :show, { + id: readonly_project_uuid + }, session_for(which_user) + buttons = css_select('[data-method=post]').select do |el| + el.attributes['href'].match /project.*owner_uuid.*#{readonly_project_uuid}/ + end + if should_show + assert_not_empty(buttons, "did not offer to create a subproject") + else + assert_empty(buttons.collect(&:to_s), + "offered to create a subproject in a non-writable project") + end + end + end end