Add admin area spec for email subscriptions management (#38912)
This commit is contained in:
1 parent
aee0025ca3
commit
d243ba36ce
6 files changed
+123
-2
No files matched your search
@@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Admin Email Subscriptions Footer Texts' do
|
||||
let(:user) { Fabricate(:admin_user) }
|
||||
|
||||
before { sign_in user }
|
||||
|
||||
describe 'Updated the email footer additional text' do
|
||||
it 'updates the text and redirects to subscriptions page' do
|
||||
visit admin_email_subscriptions_additional_footer_text_path
|
||||
expect(page)
|
||||
.to have_title(I18n.t('admin.email_subscriptions.additional_footer_texts.show.title'))
|
||||
|
||||
fill_in 'form_admin_settings_email_footer_text', with: 'More text'
|
||||
|
||||
expect { click_on submit_button }
|
||||
.to change(Setting, :email_footer_text).to('More text')
|
||||
expect(page)
|
||||
.to have_title(I18n.t('admin.email_subscriptions.index.title'))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,29 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Admin Email Subscriptions Setup' do
|
||||
let(:user) { Fabricate(:admin_user) }
|
||||
|
||||
before { sign_in user }
|
||||
|
||||
describe 'Enabling the email subscription feature' do
|
||||
it 'enables the feature and redirects to subscriptions page' do
|
||||
visit admin_email_subscriptions_setup_path
|
||||
expect(page)
|
||||
.to have_title(I18n.t('admin.email_subscriptions.index.title'))
|
||||
|
||||
check 'form_email_subscriptions_confirmation_agreement_privacy_and_terms'
|
||||
check 'form_email_subscriptions_confirmation_agreement_email_volume'
|
||||
|
||||
expect { submit_form }
|
||||
.to change(Setting, :email_subscriptions).to(true)
|
||||
expect(page)
|
||||
.to have_title(I18n.t('admin.email_subscriptions.index.title'))
|
||||
end
|
||||
|
||||
def submit_form
|
||||
click_on I18n.t('admin.email_subscriptions.setups.show.enable_feature')
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user