File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
spec/features/notifications Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments