Sha256: 73a5b028aabab100113a5092de80beb79599b6bbad36ea9ba2b66a45085ea1a9

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

Contents

require 'spec_helper'

class Notifier
  include Controll::Enabler::Notify
end  

describe Controll::Enabler::Notify do
  subject { Notifier.new }

  context 'initial state' do
    describe '.main_event' do
      its(:main_event) { should be_a Controll::Event }
    end

    Controll::Event.valid_types.each do |type|
      describe ".create_#{type}" do
        specify { subject.send(:"create_#{type}",:updated).should be_a Controll::Event }
      end
    end

    describe '.notify' do 
      describe '.with name only' do
        specify { subject.notify(:updated).main_event.type.should == :notice }
      end

      describe 'name and :error type' do
        specify { subject.notify(:updated, :error).main_event.type.should == :error }
      end

      describe 'name and unknown type' do
        specify do
          expect { subject.notify(:updated, :unknown) }.to raise_error
        end
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
controll-0.3.2 spec/controll/enabler/notify_spec.rb
controll-0.3.1 spec/controll/enabler/notify_spec.rb
controll-0.3.0 spec/controll/enabler/notify_spec.rb