1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-30 19:52:20 +01:00

(test) improved settings/bulk_update test

This commit is contained in:
Sylvain 2023-04-05 09:18:17 +02:00
parent 7e36d49035
commit 373d53eea1
3 changed files with 22 additions and 0 deletions

View File

@ -843,3 +843,12 @@ history_value_99:
created_at: '2022-12-20 14:38:40.000421'
updated_at: '2022-12-20 14:38:40.000421'
invoicing_profile_id: 1
history_value_100:
id: 100
setting_id: 99
value: 'background-color: white;'
created_at: 2023-04-05 09:16:08.000511500 Z
updated_at: 2023-04-05 09:16:08.000511500 Z
invoicing_profile_id: 1

View File

@ -580,3 +580,9 @@ setting_98:
name: machines_module
created_at: 2020-04-15 14:38:40.000421500 Z
updated_at: 2020-04-15 14:38:40.000421500 Z
setting_99:
id: 99
name: home_css
created_at: 2023-04-05 09:16:08.000511500 Z
updated_at: 2023-04-05 09:16:08.000511500 Z

View File

@ -49,6 +49,9 @@ class SettingsTest < ActionDispatch::IntegrationTest
end
test 'transactional bulk update fails' do
old_css = Setting.get('home_css')
old_color = Setting.get('main_color')
patch '/api/settings/bulk_update?transactional=true',
params: {
settings: [
@ -61,6 +64,10 @@ class SettingsTest < ActionDispatch::IntegrationTest
resp = json_response(response.body)
assert_not_nil resp[:settings].first[:error]
assert_match(/Error: Invalid CSS after/, resp[:settings].first[:error].first)
# Check values havn't changed
assert_equal old_css, Setting.get('home_css')
assert_equal old_color, Setting.get('main_color')
end
test 'update setting with wrong name' do