Sha256: 0481bb58975ebdd3eb181f2a52b56614362f4e149e2a691b3e263cd960628964

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

module CampfireBot
  module AbsenteeCamper
    module Notification
      describe ProwlNotifier do
        let(:api_key) { '123456789' }
        let(:application) { 'Campfire' }
        let(:event) { 'Mentioned' }
        let(:message) { 'testing 1 2 3' }
        let(:uri) { 'http://www.google.com' }
        let(:room) do
          room = double('room').as_null_object
          room.stub(:name).and_return(event)
          room
        end

        subject { ProwlNotifier.new(room, api_key) }

        before do
          subject.stub(:room_uri).and_return(uri)
        end

        describe :notify do

          it "logs a message indicating the message is being sent" do
            Prowl.stub(:add)
            Logger.instance.should_receive(:debug).with('sending prowl notification')
            subject.notify(message)
          end

          it "sends the Prowl message" do
            Prowl.should_receive(:add).with({
              :apikey => api_key,
              :application => application,
              :event => event,
              :description => message,
              :url => uri
            })

            subject.notify(message)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
campfire-bot-absentee-camper-0.3.0 spec/lib/campfire_bot/absentee_camper/notification/prowl_notifier_spec.rb
campfire-bot-absentee-camper-0.2.0 spec/lib/campfire_bot/absentee_camper/notification/prowl_notifier_spec.rb
campfire-bot-absentee-camper-0.1.0 spec/lib/campfire_bot/absentee_camper/notification/prowl_notifier_spec.rb
campfire-bot-absentee-camper-0.0.1 spec/lib/campfire_bot/absentee_camper/notification/prowl_notifier_spec.rb