Sha256: 30e8c9ed05b430d4d1851f5435e747ba5d721084de8757aafc9785b35de99b73

Contents?: true

Size: 716 Bytes

Versions: 12

Compression:

Stored size: 716 Bytes

Contents

require 'spec_helper'

describe Hieracles::Notification do

  describe '.new' do
    let(:notif) { Hieracles::Notification.new 'a_source', 'a_message'}
    it { expect(notif.level).to eq 'info' }
    it { expect(notif.message).to eq 'a_message' }
    it { expect(notif.source).to eq 'a_source' }
  end

  describe '.to_hash' do
    let(:notif) { Hieracles::Notification.new 'a_source', 'a_message'}
    before {
      allow(Time).to receive(:new).and_return(Time.new(2015))
    }
    let(:expected) { 
      { 
        'source' => 'a_source',
        'level' => 'info',
        'message' => 'a_message',
        'timestamp' => Time.new(2015)
      }
    }
    it { expect(notif.to_hash).to eq expected }
  end


end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hieracles-0.4.2 spec/lib/notification_spec.rb
hieracles-0.4.1 spec/lib/notification_spec.rb
hieracles-0.4.0 spec/lib/notification_spec.rb
hieracles-0.3.6 spec/lib/notification_spec.rb
hieracles-0.3.5 spec/lib/notification_spec.rb
hieracles-0.3.4 spec/lib/notification_spec.rb
hieracles-0.3.3 spec/lib/notification_spec.rb
hieracles-0.3.2 spec/lib/notification_spec.rb
hieracles-0.3.1 spec/lib/notification_spec.rb
hieracles-0.3.0 spec/lib/notification_spec.rb
hieracles-0.2.2 spec/lib/notification_spec.rb
hieracles-0.2.1 spec/lib/notification_spec.rb