mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-20 13:50:46 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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.
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user