Sha256: 9bcc7b20394711996b6cfa98c4fcfed95ff2e500ab29f3028c4180b09f54f427

Contents?: true

Size: 732 Bytes

Versions: 2

Compression:

Stored size: 732 Bytes

Contents

shared_context "a Celluloid Task" do |task_class|
  class MockActor
    attr_reader :tasks

    def initialize
      @tasks = []
    end
  end

  let(:task_type)     { :foobar }
  let(:suspend_state) { :doing_something }
  let(:actor)         { MockActor.new }

  subject { task_class.new(task_type) { Celluloid::Task.suspend(suspend_state) } }

  before :each do
    Thread.current[:celluloid_actor] = actor
  end

  after :each do
    Thread.current[:celluloid_actor] = nil
  end

  it "begins with status :new" do
    subject.status.should == :new
  end

  it "resumes" do
    subject.should be_running
    subject.resume
    subject.status.should == suspend_state
    subject.resume
    subject.should_not be_running
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
celluloid-0.13.0.pre spec/support/task_examples.rb
celluloid-0.12.4.pre spec/support/task_examples.rb