Given(/^I have an auton that has a step that creates a named auton$/) do
  class AutonCreatingAuton < Nestene::Auton

    attr_accessor :context

    def initialize
      self.counter = 0
    end

    def create_auton
      context.create_auton "EmptyAuton", 'empty_auton'
    end

    attribute counter: Fixnum
  end

  class EmptyAuton <  Nestene::Auton
    attribute foo: String
  end


  @auton_type="AutonCreatingAuton"
end

When(/^I start my auton and execute the step$/) do
  auton_id = Celluloid::Actor[:nestene_core].create_auton(@auton_type)
  step_id=Celluloid::Actor[:nestene_core].schedule_step(auton_id, :create_auton)
  Celluloid::Actor[:nestene_core].wait_for_execution_result(auton_id, step_id)
end

Then(/^the new Auton should be created$/) do
  expect(Celluloid::Actor[:nestene_core].auton_names).to include('empty_auton')
end