Skip to content

Commit

Permalink
Merge pull request #28450 from code-dot-org/header-pair-programming
Browse files Browse the repository at this point in the history
Increase test coverage for user menu
  • Loading branch information
Erin007 committed May 13, 2019
2 parents 80ecea4 + 78a09f4 commit 1a94828
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions dashboard/test/integration/user_menu_test.rb
Expand Up @@ -53,10 +53,22 @@ def open_pairing_test(show_pairing)
assert_select 'a[href="//test-studio.code.org/users/sign_out"]', 'Sign out'
end

test 'show link to pair programming when in a section' do
test "don't show link to pair programming when not in a section" do
student = create(:student)
sign_in student

get '/home'

assert_response :success
assert_select 'a[href="http://test.host/pairing"]', false
end

test 'show link to pair programming when in a section that has pairing enabled' do
student = create(:follower).student_user
sign_in student
section = student.sections_as_student.first

assert section.pairing_allowed?
assert student.can_pair?

get '/home'
Expand All @@ -65,9 +77,19 @@ def open_pairing_test(show_pairing)
assert_select '#pairing_link'
end

test "don't show link to pair programming when not in a section" do
student = create(:student)
test "don't show link to pair programming when in a section that has pairing disabled" do
student = create(:follower).student_user
sign_in student
section = student.sections_as_student.first

assert section.pairing_allowed?
assert student.can_pair?

section.update!(pairing_allowed: false)
student.reload

refute section.pairing_allowed?
refute student.can_pair?

get '/home'

Expand Down

0 comments on commit 1a94828

Please sign in to comment.