Commit 396e484a0d3cedc76eadf95ee29d940d6cd95443
Exists in
master
and in
4 other branches
Merge pull request #5385 from tsigo/notification-helper-spec
Add specs for NotificationsHelper
Showing
1 changed file
with
31 additions
and
11 deletions
Show diff stats
spec/helpers/notifications_helper_spec.rb
| 1 | 1 | require 'spec_helper' |
| 2 | 2 | |
| 3 | -# Specs in this file have access to a helper object that includes | |
| 4 | -# the NotificationsHelper. For example: | |
| 5 | -# | |
| 6 | -# describe NotificationsHelper do | |
| 7 | -# describe "string concat" do | |
| 8 | -# it "concats two strings with spaces" do | |
| 9 | -# helper.concat_strings("this","that").should == "this that" | |
| 10 | -# end | |
| 11 | -# end | |
| 12 | -# end | |
| 13 | 3 | describe NotificationsHelper do |
| 14 | - pending "add some examples to (or delete) #{__FILE__}" | |
| 4 | + describe 'notification_icon' do | |
| 5 | + let(:notification) { stub(disabled?: false, participating?: false, watch?: false) } | |
| 6 | + | |
| 7 | + context "disabled notification" do | |
| 8 | + before { notification.stub(disabled?: true) } | |
| 9 | + | |
| 10 | + it "has a red icon" do | |
| 11 | + notification_icon(notification).should match('class="icon-circle cred"') | |
| 12 | + end | |
| 13 | + end | |
| 14 | + | |
| 15 | + context "participating notification" do | |
| 16 | + before { notification.stub(participating?: true) } | |
| 17 | + | |
| 18 | + it "has a blue icon" do | |
| 19 | + notification_icon(notification).should match('class="icon-circle cblue"') | |
| 20 | + end | |
| 21 | + end | |
| 22 | + | |
| 23 | + context "watched notification" do | |
| 24 | + before { notification.stub(watch?: true) } | |
| 25 | + | |
| 26 | + it "has a green icon" do | |
| 27 | + notification_icon(notification).should match('class="icon-circle cgreen"') | |
| 28 | + end | |
| 29 | + end | |
| 30 | + | |
| 31 | + it "has a blue icon" do | |
| 32 | + notification_icon(notification).should match('class="icon-circle-blank cblue"') | |
| 33 | + end | |
| 34 | + end | |
| 15 | 35 | end | ... | ... |