49 lines
1.5 KiB
Ruby
49 lines
1.5 KiB
Ruby
require "test_helper"
|
|
require "metal_adventures/scene"
|
|
|
|
module MetalAdventures
|
|
class SceneTest < Minitest::Test
|
|
def setup
|
|
@scene_dsl = Scene::DSL::Scene.new "Procedure1" do
|
|
action "PremiereAction" do
|
|
option "A1O1"
|
|
option "A1O2", duration: "S"
|
|
option "A1O3", duration: "S", skill: "SkillRoll"
|
|
end
|
|
|
|
action "SecondeAction" do
|
|
option "A2O2"
|
|
end
|
|
end
|
|
end
|
|
|
|
def test_dsl
|
|
assert_equal "Procedure1", @scene_dsl.name
|
|
assert_equal 2, @scene_dsl.actions.size
|
|
|
|
assert_equal "PremiereAction", @scene_dsl.actions.values.first.name
|
|
assert_equal 3, @scene_dsl.actions.values.first.options.size
|
|
|
|
assert_equal "A1O1", @scene_dsl.actions.values.first.options[0].name
|
|
assert_equal "C", @scene_dsl.actions.values.first.options[0].duration
|
|
assert_nil @scene_dsl.actions.values.first.options[0].skill
|
|
|
|
assert_equal "A1O2", @scene_dsl.actions.values.first.options[1].name
|
|
assert_equal "S", @scene_dsl.actions.values.first.options[1].duration
|
|
|
|
assert_equal "A1O3", @scene_dsl.actions.values.first.options[2].name
|
|
assert_equal "SkillRoll", @scene_dsl.actions.values.first.options[2].skill
|
|
end
|
|
|
|
def test_scene_round
|
|
scene = Scene.new(@scene_dsl)
|
|
|
|
assert_equal "PremiereAction", scene.current_action.name
|
|
scene.next!
|
|
assert_equal "SecondeAction", scene.current_action.name
|
|
scene.next!
|
|
assert_equal "PremiereAction", scene.current_action.name
|
|
end
|
|
end
|
|
end
|