Sha256: b1c01a90f3ed797150387a0dfa9a85f9228670f759423e4f2f700c83af1ed19d

Contents?: true

Size: 752 Bytes

Versions: 5

Compression:

Stored size: 752 Bytes

Contents

describe "NSNotificationCenter" do
  SampleNotification = "SampleNotification"
  after do
    @observer = Object.new
  end
  
  after do
    notification_center.unobserve(@observer)
  end

  it "return notification center" do
    notification_center.should.not.be.nil
  end

  it "add observer" do
    notified = false
    notification_center.observe(@observer, SampleNotification) do
      notified = true
    end

    lambda { 
      notification_center.post SampleNotification
    }.should.change { notified }
  end

  it "remove observer" do
    lambda { 
      notification_center.observe(@observer, SampleNotification) {}
      notification_center.unobserve(@observer)
    }.should.not.change { notification_center.observers.keys.size }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bubble-wrap-0.2.1 spec/ns_notification_center_spec.rb
bubble-wrap-0.2.0 spec/ns_notification_center_spec.rb
bubble-wrap-0.1.2 spec/ns_notification_center_spec.rb
bubble-wrap-0.1.1 spec/ns_notification_center_spec.rb
bubble-wrap-0.1.0 spec/ns_notification_center_spec.rb