2019-09-30 08:06:01 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-03-27 13:04:29 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 05:08:32 -04:00
|
|
|
RSpec.describe NotificationsHelper do
|
2013-10-20 23:58:38 -04:00
|
|
|
describe 'notification_icon' do
|
2020-09-14 08:09:34 -04:00
|
|
|
it { expect(notification_icon(:disabled)).to match('data-testid="notifications-off-icon"') }
|
|
|
|
it { expect(notification_icon(:owner_disabled)).to match('data-testid="notifications-off-icon"') }
|
|
|
|
it { expect(notification_icon(:participating)).to match('data-testid="notifications-icon"') }
|
|
|
|
it { expect(notification_icon(:mention)).to match('data-testid="at-icon"') }
|
|
|
|
it { expect(notification_icon(:global)).to match('data-testid="earth-icon') }
|
|
|
|
it { expect(notification_icon(:watch)).to match('data-testid="eye-icon"') }
|
2020-09-22 17:10:04 -04:00
|
|
|
it { expect(notification_icon(:custom)).to equal('') }
|
2016-03-29 07:08:30 -04:00
|
|
|
end
|
2013-10-20 23:58:38 -04:00
|
|
|
|
2016-03-29 07:08:30 -04:00
|
|
|
describe 'notification_title' do
|
|
|
|
it { expect(notification_title(:watch)).to match('Watch') }
|
|
|
|
it { expect(notification_title(:mention)).to match('On mention') }
|
2017-06-07 16:13:44 -04:00
|
|
|
it { expect(notification_title(:global)).to match('Global') }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#notification_event_name' do
|
|
|
|
it { expect(notification_event_name(:success_pipeline)).to match('Successful pipeline') }
|
|
|
|
it { expect(notification_event_name(:failed_pipeline)).to match('Failed pipeline') }
|
2020-02-27 13:09:21 -05:00
|
|
|
it { expect(notification_event_name(:fixed_pipeline)).to match('Fixed pipeline') }
|
2020-07-27 23:09:35 -04:00
|
|
|
it { expect(notification_event_name(:moved_project)).to match('Moved project') }
|
2013-10-20 23:58:38 -04:00
|
|
|
end
|
2019-08-17 01:56:48 -04:00
|
|
|
|
|
|
|
describe '#notification_icon_level' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:global_setting) { user.global_notification_setting }
|
|
|
|
let(:notification_setting) { create(:notification_setting, level: :watch) }
|
|
|
|
|
|
|
|
it { expect(notification_icon_level(notification_setting, true)).to eq 'owner_disabled' }
|
|
|
|
it { expect(notification_icon_level(notification_setting)).to eq 'watch' }
|
|
|
|
it { expect(notification_icon_level(global_setting)).to eq 'participating' }
|
|
|
|
end
|
2013-03-27 13:04:29 -04:00
|
|
|
end
|