Sha256: 77395cd1208f58d1a02d3fced1d5c7a915774b90b04ea8baa5c1dbe992bc4a91

Contents?: true

Size: 900 Bytes

Versions: 1

Compression:

Stored size: 900 Bytes

Contents

describe Lotion::Notifications do

  subject do
    include Lotion::Notifications
  end
  before do
    @center = subject.notification_center
    @method = 'postNotificationName:object:userInfo'
  end
  it 'has the correct notification center' do
    subject.notification_center.should == NSNotificationCenter.defaultCenter
  end
  it 'responds to #notify' do
    subject.should.respond_to :notify
  end
  it 'sends a notification to the notification center' do
    @center.mock! @method do |name, from, info|
      name.should == 'foo'
      from.should == subject
      info.should == nil
    end
    subject.notify 'foo'
  end
  it 'passes along the user info hash to the notification center' do
    @center.mock! @method do |name, from, info|
      name.should == 'foo'
      from.should == subject
      info.should == { :foo => 'bar' }
    end
    subject.notify 'foo', :foo => 'bar'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lotion-0.1.0 spec/lotion/notifications_spec.rb