diff options
Diffstat (limited to 'spec/models/notification_setting_spec.rb')
-rw-r--r-- | spec/models/notification_setting_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/notification_setting_spec.rb b/spec/models/notification_setting_spec.rb index 4ef5ab7af48..010b7455f85 100644 --- a/spec/models/notification_setting_spec.rb +++ b/spec/models/notification_setting_spec.rb @@ -200,4 +200,18 @@ RSpec.describe NotificationSetting do subject.email_events end end + + describe '#order_by_id_asc' do + let_it_be(:project) { create(:project) } + let_it_be(:other_project) { create(:project) } + let_it_be(:notification_setting_1) { create(:notification_setting, project: project) } + let_it_be(:notification_setting_2) { create(:notification_setting, project: other_project) } + let_it_be(:notification_setting_3) { create(:notification_setting, project: project) } + + let(:ids) { [notification_setting_1, notification_setting_2, notification_setting_3].map(&:id) } + + subject(:ordered_records) { described_class.where(id: ids, source: project).order_by_id_asc } + + it { is_expected.to eq([notification_setting_1, notification_setting_3]) } + end end |