Sha256: 69a42e0b94c96366b30c62cdd29838d475f36bd3a4bb8200dd2e7c21a7f6d147
Contents?: true
Size: 1.33 KB
Versions: 8
Compression:
Stored size: 1.33 KB
Contents
require 'helper' describe "Updates and their order", acceptance: true do define_behavior :double_value do |beh| beh.requires :director beh.setup do actor.has_attributes value: 1 director.when :pre_update do |time| actor.value *= 2 end end end define_behavior :plus_one do |beh| beh.requires :director beh.setup do actor.has_attributes value: 1 director.when :update do |time| actor.value += 1 end end end define_behavior :triple_value do |beh| beh.requires :director beh.setup do actor.has_attributes value: 1 director.when :post_update do |time| actor.value *= 3 end end end define_actor :math_man do has_behaviors :triple_value, :double_value, :plus_one end it 'updates get fired in the correct order' do game.stage do |stage| # instance of TestingStage create_actor :math_man end see_actor_attrs :math_man, value: 1 update 10 see_actor_attrs :math_man, value: 9 end it 'modifies update order from the stage' do game.stage do |stage| # instance of TestingStage director.update_slots = [:update, :post_update, :pre_update ] create_actor :math_man end see_actor_attrs :math_man, value: 1 update 10 see_actor_attrs :math_man, value: 12 end end
Version data entries
8 entries across 8 versions & 1 rubygems