summaryrefslogtreecommitdiffhomepage
path: root/spec/scene_manager_spec.rb
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2021-07-07 17:51:08 -0400
committerrealtradam <[email protected]>2021-07-07 17:51:08 -0400
commitffaad06420594d0d007114042016362e88e6485a (patch)
tree5475deeae07494cf820526a5e11070d2bf4a311c /spec/scene_manager_spec.rb
parent09fc5ef46b911f9d7e31cdedd240e7afc4c11c92 (diff)
downloadFelECS-ffaad06420594d0d007114042016362e88e6485a.tar.gz
FelECS-ffaad06420594d0d007114042016362e88e6485a.zip
added completed tests
Diffstat (limited to 'spec/scene_manager_spec.rb')
-rw-r--r--spec/scene_manager_spec.rb64
1 files changed, 64 insertions, 0 deletions
diff --git a/spec/scene_manager_spec.rb b/spec/scene_manager_spec.rb
new file mode 100644
index 0000000..b2afab0
--- /dev/null
+++ b/spec/scene_manager_spec.rb
@@ -0,0 +1,64 @@
+require_relative '../felflame.rb'
+
+#class EntitiesTest < Minitest::Test
+
+describe 'Scenes' do
+ before :all do
+ @component_manager ||= FelFlame::Components.new('TestScenes', order: [])
+ @system2 = FelFlame::Systems.new('Test', priority: 2) do
+ @component_manager.each do |component|
+ component.order.push 2
+ end
+ end
+ @system1 = FelFlame::Systems.new('Mana', priority: 1) do
+ @component_manager.each do |component|
+ component.order.push 1
+ end
+ end
+ @system3 = FelFlame::Systems.new('Spell', priority: 3) do
+ @component_manager.each do |component|
+ component.order.push 3
+ end
+ end
+ @scene = FelFlame::Scenes.new('TestScene')
+ end
+
+ before :each do
+ @cmp = @component_manager.new
+ end
+
+ after :each do
+ FelFlame::Entities.each(&:delete)
+ @component_manager.each(&:delete)
+ @scene.clear
+ end
+
+ it 'can add Systems' do
+ @scene.add @system2, @system3, @system1
+ expect(@scene.systems).to eq([@system1, @system2, @system3])
+ end
+
+ it 'can remove Systems' do
+ @scene.add @system2, @system3, @system1
+ @scene.remove @system2, @system3
+ expect(@scene.systems).to eq([@system1])
+ end
+
+ it 'can clear Systems' do
+ @scene.add @system2, @system3, @system1
+ @scene.clear
+ 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])
+ end
+end