2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe NotificationsHelper do
|
2014-09-02 18:07:02 +05:30
|
|
|
describe 'notification_icon' do
|
2020-11-24 15:15:51 +05:30
|
|
|
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"') }
|
|
|
|
it { expect(notification_icon(:custom)).to equal('') }
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
describe 'notification_title' do
|
|
|
|
it { expect(notification_title(:watch)).to match('Watch') }
|
|
|
|
it { expect(notification_title(:mention)).to match('On mention') }
|
2017-09-10 17:25:29 +05:30
|
|
|
it { expect(notification_title(:global)).to match('Global') }
|
|
|
|
end
|
|
|
|
|
2019-10-12 21:52:04 +05:30
|
|
|
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
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|