diff --git a/app/views/home/index.html.slim b/app/views/home/index.html.slim index 2d9ae5e2306..34711c283ea 100644 --- a/app/views/home/index.html.slim +++ b/app/views/home/index.html.slim @@ -62,7 +62,7 @@ header.page-header | 内容を更新 - if (current_user.admin? || current_user.adviser?) && @job_seeking_users.present? = render 'job_seeking_users', users: @job_seeking_users - - if current_user.total_learning_time.positive? || !current_user.mentor? + - if current_user.student_or_trainee? #js-grass(data-user-id="#{current_user.id}") - if current_user.github_account.present? = render 'users/github_grass', user: current_user diff --git a/test/system/home_test.rb b/test/system/home_test.rb index 849a902eee4..d8b738ab8e9 100644 --- a/test/system/home_test.rb +++ b/test/system/home_test.rb @@ -88,9 +88,37 @@ class HomeTest < ApplicationSystemTestCase assert_current_path(/niconico_calendar=#{1.month.ago.strftime('%Y-%m')}/) end - test 'show the grass' do - visit_with_auth '/', 'hajime' - assert_text '学習時間' + test 'show the grass for student' do + assert users(:kimura).student? + visit_with_auth '/', 'kimura' + assert_selector 'h2.card-header__title', text: '学習時間' + end + + test 'show the grass for trainee' do + assert users(:kensyu).trainee? + visit_with_auth '/', 'kensyu' + assert_selector 'h2.card-header__title', text: '学習時間' + end + + test 'not show the grass for mentor' do + assert users(:mentormentaro).mentor? + visit_with_auth '/', 'mentormentaro' + assert_selector 'h2.page-header__title', text: 'ダッシュボード' + assert_no_selector 'h2.card-header__title', text: '学習時間' + end + + test 'not show the grass for adviser' do + assert users(:advijirou).adviser? + visit_with_auth '/', 'advijirou' + assert_selector 'h2.page-header__title', text: 'ダッシュボード' + assert_no_selector 'h2.card-header__title', text: '学習時間' + end + + test 'not show the grass for admin' do + assert users(:komagata).admin? + visit_with_auth '/', 'komagata' + assert_selector 'h2.page-header__title', text: 'ダッシュボード' + assert_no_selector 'h2.card-header__title', text: '学習時間' end test 'show test events on dashboard' do