summaryrefslogtreecommitdiff
path: root/spec/helpers/notifications_helper_spec.rb
blob: 482cb33e94ff1f39d8e39365e769abb652a09f08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'spec_helper'

describe NotificationsHelper do
  include FontAwesome::Rails::IconHelper
  include IconsHelper

  describe 'notification_icon' do
    let(:notification) { double(disabled?: false, participating?: false, watch?: false) }

    context "disabled notification" do
      before { notification.stub(disabled?: true) }

      it "has a red icon" do
        expect(notification_icon(notification)).to match('class="fa fa-volume-off ns-mute"')
      end
    end

    context "participating notification" do
      before { notification.stub(participating?: true) }

      it "has a blue icon" do
        expect(notification_icon(notification)).to match('class="fa fa-volume-down ns-part"')
      end
    end

    context "watched notification" do
      before { notification.stub(watch?: true) }

      it "has a green icon" do
        expect(notification_icon(notification)).to match('class="fa fa-volume-up ns-watch"')
      end
    end

    it "has a blue icon" do
      expect(notification_icon(notification)).to match('class="fa fa-circle-o ns-default"')
    end
  end
end