3 class ProjectsControllerTest < ActionController::TestCase
4 test "inactive user is asked to sign user agreements on front page" do
5 get :index, {}, session_for(:inactive)
6 assert_response :success
7 assert_not_empty assigns(:required_user_agreements),
8 "Inactive user did not have required_user_agreements"
9 assert_template 'user_agreements/index',
10 "Inactive user was not presented with a user agreement at the front page"
14 [:project_viewer, false]].each do |which_user, should_show|
15 test "create subproject button #{'not ' unless should_show} shown to #{which_user}" do
16 readonly_project_uuid = api_fixture('groups')['aproject']['uuid']
18 id: readonly_project_uuid
19 }, session_for(which_user)
20 buttons = css_select('[data-method=post]').select do |el|
21 el.attributes['href'].match /project.*owner_uuid.*#{readonly_project_uuid}/
24 assert_not_empty(buttons, "did not offer to create a subproject")
26 assert_empty(buttons.collect(&:to_s),
27 "offered to create a subproject in a non-writable project")