This commit is contained in:
29
test/controllers/custom_styles_controller_test.rb
Normal file
29
test/controllers/custom_styles_controller_test.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
require "test_helper"
|
||||
|
||||
class Accounts::CustomStylesControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in :david
|
||||
end
|
||||
|
||||
test "edit" do
|
||||
get edit_account_custom_styles_url
|
||||
assert_response :ok
|
||||
end
|
||||
|
||||
test "update" do
|
||||
assert users(:david).administrator?
|
||||
|
||||
put account_custom_styles_url, params: { account: { custom_styles: ":root { --color-text: red; }" } }
|
||||
|
||||
assert_redirected_to edit_account_custom_styles_url
|
||||
assert_equal accounts(:signal).custom_styles, ":root { --color-text: red; }"
|
||||
end
|
||||
|
||||
test "non-admins cannot update" do
|
||||
sign_in :kevin
|
||||
assert users(:kevin).member?
|
||||
|
||||
put account_custom_styles_url, params: { account: { custom_styles: ":root { --color-text: red; }" } }
|
||||
assert_response :forbidden
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user