Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

メンター・アドバイザー・管理者はダッシュボードの学習時間の草を非表示にする #4211

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
12 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/home/index.html.slim
Expand Up @@ -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
Expand Down
34 changes: 31 additions & 3 deletions test/system/home_test.rb
Expand Up @@ -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: '学習時間'
Comment on lines +91 to +121
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

とってもわかりやすくなりました〜👍

end

test 'show test events on dashboard' do
Expand Down