0
0
Fork 0

API for updating attribution domains (#32730)

This commit is contained in:
Christian Schmidt 2025-01-17 09:18:55 +01:00 committed by GitHub
parent 3af6739f21
commit a3baae0b99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
108 changed files with 141 additions and 251 deletions

View file

@ -15,12 +15,27 @@ RSpec.describe 'Settings verification page' do
.to have_content(verification_summary)
.and have_private_cache_control
fill_in attribution_field, with: 'host.example'
fill_in attribution_field, with: " example.com\n\n https://example.net"
expect { click_on submit_button }
.to(change { user.account.reload.attribution_domains_as_text })
.to(change { user.account.reload.attribution_domains }.to(['example.com', 'example.net']))
expect(page)
.to have_content(success_message)
expect(find_field(attribution_field).value)
.to have_content("example.com\nexample.net")
end
it 'rejects invalid attribution domains' do
visit settings_verification_path
fill_in attribution_field, with: "example.com \n invalid_com"
expect { click_on submit_button }
.to_not(change { user.account.reload.attribution_domains })
expect(page)
.to have_content(I18n.t('activerecord.errors.messages.invalid_domain_on_line', value: 'invalid_com'))
expect(find_field(attribution_field).value)
.to have_content("example.com\ninvalid_com")
end
end
@ -29,6 +44,6 @@ RSpec.describe 'Settings verification page' do
end
def attribution_field
I18n.t('simple_form.labels.account.attribution_domains_as_text')
I18n.t('simple_form.labels.account.attribution_domains')
end
end