Sha256: 8e53f7652bb02c4f7e90e33b5045a933cb2ab7eb037ee090d6fc161123525fe3

Contents?: true

Size: 836 Bytes

Versions: 4

Compression:

Stored size: 836 Bytes

Contents

describe Elevate::Dispatcher do
  DELAY = 0.2

  before do
    @dispatcher = Elevate::Dispatcher.new
  end

  describe "#on_started=" do
    before do
      @dispatcher.on_started = lambda { @thread = NSThread.currentThread }
    end

    after do
      @thread = nil
    end

    it "invokes the callback on the main thread" do
      wait DELAY do
        @thread.should == NSThread.currentThread
      end
    end

    it "does not invoke the callback immediately" do
      @thread.should.be.nil
    end
  end

  describe "#on_finished=" do
    before do
      @dispatcher.on_finished = lambda { @thread = NSThread.currentThread }
      @dispatcher.invoke_finished_callback()
    end

    it "invokes the callback on the main thread" do
      wait DELAY do
        @thread.should == NSThread.currentThread
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
elevate-0.3.3 spec/dispatcher_spec.rb
elevate-0.3.2 spec/dispatcher_spec.rb
elevate-0.3.1 spec/dispatcher_spec.rb
elevate-0.3 spec/dispatcher_spec.rb