Skip to content

Commit 4adcfab

Browse files
committed
adds feature spec to test operation of email notification preferences toggle
1 parent f412bbe commit 4adcfab

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# frozen_string_literal: true
2+
3+
require 'rails_helper'
4+
5+
RSpec.describe 'email notification preferences', type: :feature do
6+
include BetterTogether::DeviseSessionHelpers
7+
8+
let(:user) { create(:user, :confirmed) }
9+
10+
before do
11+
configure_host_platform
12+
sign_in_user(user.email, user.password)
13+
end
14+
15+
it 'is enabled by default' do
16+
visit edit_person_path(id: user.person, locale: I18n.default_locale)
17+
expect(page).to have_checked_field 'person[notify_by_email]'
18+
end
19+
20+
it 'is disabled on the instance model when unchecked on the form' do
21+
visit edit_person_path(id: user.person, locale: I18n.default_locale)
22+
uncheck 'person[notify_by_email]'
23+
click_button 'commit'
24+
user.reload
25+
expect(user.person.notification_preferences['notify_by_email']).to eq(false)
26+
end
27+
end

0 commit comments

Comments
 (0)