Sha256: 8e357d80e20fd68e097a201aaf97e80aa96a9c2b942d5d108d5b68b2ce4a416e
Contents?: true
Size: 1.83 KB
Versions: 18
Compression:
Stored size: 1.83 KB
Contents
require 'spec_helper' describe Guard::RSpec::Notifier do let(:options) { { notification: true } } let(:notifier) { Guard::RSpec::Notifier.new(options) } def expect_notification(message, image, priority) expect(Guard::Notifier).to receive(:notify).with(message, { title: 'RSpec results', image: image, priority: priority }) end describe '#notify_failure' do it 'notifies about failure' do expect_notification('Failed', :failed, 2) notifier.notify_failure end end describe '#notify' do it 'notifies about success' do expect_notification('This is summary', :success, -2) notifier.notify('This is summary') end context 'with pendings' do let(:summary) { '5 examples, 0 failures (1 pending) in 4.0000 seconds' } it 'notifies about pendings' do expect_notification(summary, :pending, -1) notifier.notify(summary) end end context 'with failures' do let(:summary) { '5 examples, 1 failures in 4.0000 seconds' } it 'notifies about failures' do expect_notification(summary, :failed, 2) notifier.notify(summary) end context 'even if there is pendings' do let(:summary) { '5 examples, 1 failures (1 pending) in 4.0000 seconds' } it 'still notifies about failures' do expect_notification(summary, :failed, 2) notifier.notify(summary) end end end end context 'with notifications turned off' do let(:options) { { notification: false } } describe '#notify_failure' do it 'keeps quiet' do expect(Guard::Notifier).not_to receive(:notify) notifier.notify_failure end end describe '#notify' do it 'keeps quiet' do expect(Guard::Notifier).not_to receive(:notify) notifier.notify('Summary') end end end end
Version data entries
18 entries across 16 versions & 2 rubygems