mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 23:32:53 +00:00
* Fix data export + Capybara * Continue? * A ton of system tests :D + test cleanup * More system tests * Add placeholder keys for tests? * Get rid of the double-query! * Speed up CI Chrome setup by avoiding snap installs * Pin CI Chrome version to reduce system test flakiness * Stabilize integrations settings system test interaction
38 lines
1 KiB
Ruby
38 lines
1 KiB
Ruby
require "test_helper"
|
|
|
|
class SettingsProfileControllerTest < ActionDispatch::IntegrationTest
|
|
fixtures :users
|
|
|
|
test "profile update persists selected theme" do
|
|
user = users(:one)
|
|
sign_in_as(user)
|
|
|
|
patch my_settings_profile_path, params: { user: { theme: "nord" } }
|
|
|
|
assert_response :redirect
|
|
assert_redirected_to my_settings_profile_path
|
|
assert_equal "nord", user.reload.theme
|
|
end
|
|
|
|
test "profile update normalizes blank country code to nil" do
|
|
user = users(:one)
|
|
user.update!(country_code: "US")
|
|
sign_in_as(user)
|
|
|
|
patch my_settings_profile_path, params: { user: { country_code: "" } }
|
|
|
|
assert_response :redirect
|
|
assert_nil user.reload.country_code
|
|
end
|
|
|
|
test "profile update with invalid username returns unprocessable entity" do
|
|
user = users(:one)
|
|
user.update!(username: "good_name")
|
|
sign_in_as(user)
|
|
|
|
patch my_settings_profile_path, params: { user: { username: "bad username!" } }
|
|
|
|
assert_response :unprocessable_entity
|
|
assert_inertia_component "Users/Settings/Profile"
|
|
end
|
|
end
|