Sha256: 01e26ed28d334fb83f43b90006324f1d294cd4010d3960ce75cd3a20857039d5

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

require 'MonkeyEngine'
require 'MonkeyActions'
require 'MonkeyFactory'

describe 'Engine' do
  before(:each) do
    @engine = MonkeyEngine::Engine.instance
    @monkey = MonkeyFactory.create :groucho
    @monkey.extend(SpecHelpers::SetMonkeyAction)
  end

  context 'action_eval!' do
    it 'should return action completed if the action is completed' do
      action = MonkeyActionPause.new(@monkey, 10)
      action.action_completed = false
      action.action_time_of_completion = action.action_time

      @monkey.set_action(action)

      @engine.action_eval!(action).should == true
    end

    it 'should return action not completed if the action is not completed' do
      action = MonkeyActionPause.new(@monkey, 60)
      action.action_completed = false

      @monkey.set_action(action)

      @engine.action_eval!(action).should == false
    end
  end

  context 'action_new' do
    it 'should return a new action if a the current action is completed' do
      action = MonkeyActionSleep.new(@monkey, 60 * 8)
      action.action_completed = true

      @monkey.set_action(action)

      @engine.new_action(@monkey).is_a?(MonkeyActionSleep).should_not == true
    end
  end

  context 'do_action' do
    it 'should do something' do
      skip 'todo'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
MonkeyEngine-2.0.0 spec/engine_spec.rb