Sha256: 03b6244034f4d02bffef6b5c14bf8d331f3ae073073bf3fcea56f798307d4973

Contents?: true

Size: 607 Bytes

Versions: 3

Compression:

Stored size: 607 Bytes

Contents

describe Elevate::Callback do
  describe "#call" do
    describe "on the main thread" do
      it "invokes the block within the provided context" do
        callback = Elevate::Callback.new(self, lambda { |v| @value = v })
        callback.call(42)

        @value.should == 42
      end
    end

    describe "on a background thread" do
      it "invokes the block within the provided context on the main thread" do
        callback = Elevate::Callback.new(self, lambda { @thread = NSThread.currentThread })
        callback.call

        @thread.should == NSThread.mainThread
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
elevate-0.6.0 spec/callback_spec.rb
elevate-0.5.0 spec/callback_spec.rb
elevate-0.4.0 spec/callback_spec.rb