diff options
Diffstat (limited to 'spec/features/profiles/user_edit_preferences_spec.rb')
-rw-r--r-- | spec/features/profiles/user_edit_preferences_spec.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/features/profiles/user_edit_preferences_spec.rb b/spec/features/profiles/user_edit_preferences_spec.rb index d489d92c524..3129e4bd952 100644 --- a/spec/features/profiles/user_edit_preferences_spec.rb +++ b/spec/features/profiles/user_edit_preferences_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe 'User edit preferences profile' do +RSpec.describe 'User edit preferences profile', :js do let(:user) { create(:user) } before do @@ -53,7 +53,14 @@ RSpec.describe 'User edit preferences profile' do fill_in 'Tab width', with: -1 click_button 'Save changes' - expect(page).to have_content('Failed to save preferences') + field = page.find_field('user[tab_width]') + message = field.native.attribute("validationMessage") + expect(message).to eq "Value must be greater than or equal to 1." + + # User trying to hack an invalid value + page.execute_script("document.querySelector('#user_tab_width').setAttribute('min', '-1')") + click_button 'Save changes' + expect(page).to have_content('Failed to save preferences.') end end |