Sha256: 787d1c799c64756c09f7ab1b7a5f9037cd971355f56ddbad45b504ab1f59f747
Contents?: true
Size: 1011 Bytes
Versions: 7
Compression:
Stored size: 1011 Bytes
Contents
describe "NSNotificationCenter" do SampleNotification = "SampleNotification" after do @observer = nil end after do BW::App.notification_center.unobserve(@observer) if @observer end it "return notification center" do BW::App.notification_center.should.not.be.nil end it "add observer" do @notified = false @observer = BW::App.notification_center.observe(SampleNotification) do |note| @notified = true note.should.is_a NSNotification note.object.class.should == Time note.userInfo.should.not.be.nil note.userInfo[:status].should == "ok" end lambda { BW::App.notification_center.post SampleNotification, Time.now, {:status => "ok"} }.should.change { @notified } end it "remove observer" do lambda { @observer = BW::App.notification_center.observe(SampleNotification) {} BW::App.notification_center.unobserve(@observer) }.should.not.change { BW::App.notification_center.observers.size } end end
Version data entries
7 entries across 7 versions & 1 rubygems