summaryrefslogtreecommitdiffhomepage
path: root/spec/scene_manager_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/scene_manager_spec.rb')
-rw-r--r--spec/scene_manager_spec.rb26
1 files changed, 18 insertions, 8 deletions
diff --git a/spec/scene_manager_spec.rb b/spec/scene_manager_spec.rb
index f2aee01..e1984dc 100644
--- a/spec/scene_manager_spec.rb
+++ b/spec/scene_manager_spec.rb
@@ -1,6 +1,8 @@
-require 'felflame'
+# frozen_string_literal: true
-#class EntitiesTest < Minitest::Test
+require_relative '../lib/felflame'
+
+# class EntitiesTest < Minitest::Test
describe 'Scenes' do
before :all do
@@ -35,6 +37,9 @@ describe 'Scenes' do
it 'can add Systems' do
@scene.add @system2, @system3, @system1
+ expect(@system1.scenes.length).to eq(1)
+ expect(@system2.scenes.length).to eq(1)
+ expect(@system3.scenes.length).to eq(1)
expect(@scene.systems).to eq([@system1, @system2, @system3])
end
@@ -47,18 +52,23 @@ describe 'Scenes' do
it 'can clear Systems' do
@scene.add @system2, @system3, @system1
@scene.clear
+ expect(@system1.scenes.length).to eq(0)
+ expect(@system2.scenes.length).to eq(0)
+ expect(@system3.scenes.length).to eq(0)
expect(@scene.systems).to eq([])
end
- it 'has the correct constant name' do
- match = FelFlame::Scenes.new('Match')
- expect(FelFlame::Scenes::Match.const_name).to eq('Match')
- expect(match.const_name).to eq('Match')
- end
-
it 'can execute Systems in the correct order' do
@scene.add @system2, @system3, @system1
@scene.call
expect(@cmp.order).to eq([1, 2, 3])
+ @cmp.order = []
+ @system3.priority = -1
+ @scene.call
+ expect(@cmp.order).to eq([3, 1, 2])
+ end
+
+ it 'will return priority when setting priority' do
+ expect(@scene.priority = 3).to eq(3)
end
end