Sha256: 1fa826371e56bf6207c6326c541b6ae6aa2093e30e3ed921ce6c0dff8817b7ce

Contents?: true

Size: 712 Bytes

Versions: 11

Compression:

Stored size: 712 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[:actor] = actor
  end

  after :each do
    Thread.current[: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

11 entries across 11 versions & 1 rubygems

Version Path
celluloid-0.12.4 spec/support/task_examples.rb
celluloid-0.12.4.pre2 spec/support/task_examples.rb
celluloid-0.12.3 spec/support/task_examples.rb
celluloid-0.12.2 spec/support/task_examples.rb
celluloid-0.12.1 spec/support/task_examples.rb
celluloid-0.12.1.pre2 spec/support/task_examples.rb
celluloid-0.12.1.pre spec/support/task_examples.rb
celluloid-0.12.0 spec/support/task_examples.rb
celluloid-0.12.0.pre3 spec/support/task_examples.rb
celluloid-0.12.0.pre2 spec/support/task_examples.rb
celluloid-0.12.0.pre spec/support/task_examples.rb