refactor: Move scenarios to root and update paths

- Move scenarios from app/assets/scenarios/ to scenarios/
- Update Mission model to use BreakEscape::Engine.root instead of Rails.root
- Update seeds.rb to use engine root for scenario discovery
- Update tests to use engine root for path assertions

This ensures scenarios are found correctly in both mounted (Hacktivity)
and standalone (test) environments.

All 12 tests now passing with 19 assertions!
This commit is contained in:
Z. Cliffe Schreuders
2025-11-21 15:27:54 +00:00
parent f44c211d53
commit 08a89eace5
29 changed files with 262 additions and 3 deletions

View File

@@ -12,7 +12,7 @@ module BreakEscape
# Path to scenario directory
def scenario_path
Rails.root.join('app', 'assets', 'scenarios', name)
BreakEscape::Engine.root.join('scenarios', name)
end
# Generate scenario data via ERB

View File

@@ -1,7 +1,7 @@
puts "Creating BreakEscape missions..."
# List all scenario directories
scenario_dirs = Dir.glob(Rails.root.join('app/assets/scenarios/*')).select { |f| File.directory?(f) }
scenario_dirs = Dir.glob(BreakEscape::Engine.root.join('scenarios/*')).select { |f| File.directory?(f) }
scenario_dirs.each do |dir|
scenario_name = File.basename(dir)

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -21,7 +21,7 @@ module BreakEscape
test "scenario_path returns correct path" do
mission = break_escape_missions(:ceo_exfil)
expected = Rails.root.join('app', 'assets', 'scenarios', 'ceo_exfil')
expected = BreakEscape::Engine.root.join('scenarios', 'ceo_exfil')
assert_equal expected, mission.scenario_path
end
end