Ensure user toggles on board edit page are cached properly
Not including the disabled flag as part of the cache resulted in issues like the one described in #1992
This commit is contained in:
@@ -166,4 +166,28 @@ class BoardsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_select "button:not([disabled])", text: "Select all"
|
||||
assert_select "button:not([disabled])", text: "Select none"
|
||||
end
|
||||
|
||||
test "access toggle disabled state is cached correctly" do
|
||||
board = boards(:writebook)
|
||||
david = users(:david)
|
||||
|
||||
with_actionview_partial_caching do
|
||||
# privileged user
|
||||
assert users(:kevin).can_administer_board?(board)
|
||||
|
||||
get edit_board_path(board)
|
||||
|
||||
assert_response :success
|
||||
assert_select "input.switch__input[name='user_ids[]'][value='#{david.id}']:not([disabled])"
|
||||
|
||||
# unprivileged user
|
||||
logout_and_sign_in_as :jz
|
||||
assert_not users(:jz).can_administer_board?(board)
|
||||
|
||||
get edit_board_path(board)
|
||||
|
||||
assert_response :success
|
||||
assert_select "input.switch__input[name='user_ids[]'][value='#{david.id}'][disabled]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user