Skip to content

Commit

Permalink
Enable bootsnap test
Browse files Browse the repository at this point in the history
Co-Authored-By: Ricardo Trindade <[email protected]>
  • Loading branch information
flash-gordon and RicardoTrindade committed Jan 7, 2025
1 parent c7f0f34 commit ccea1a6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ Gemfile.lock

## Tests
/spec/examples.txt
/spec/fixtures/test/tmp/cache
3 changes: 1 addition & 2 deletions lib/dry/system/plugins/bootsnap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Plugins
module Bootsnap
DEFAULT_OPTIONS = {
load_path_cache: true,
disable_trace: true,
compile_cache_iseq: true,
compile_cache_yaml: true,
autoload_paths_cache: false
Expand All @@ -32,7 +31,7 @@ def self.dependencies
def setup_bootsnap
return unless bootsnap_available?

::Bootsnap.setup(config.bootsnap.merge(cache_dir: root.join("tmp/cache").to_s))
::Bootsnap.setup(**config.bootsnap, cache_dir: root.join("tmp/cache").to_s)
end

# @api private
Expand Down
14 changes: 12 additions & 2 deletions spec/integration/container/plugins/bootsnap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,30 @@
configure do |config|
config.root = SPEC_ROOT.join("fixtures/test")
config.env = :development
config.bootsnap = {
load_path_cache: false,
compile_cache_iseq: true,
compile_cache_yaml: true,
autoload_paths_cache: false
}
end
end
end

let(:bootsnap_cache_file) do
system.root.join("tmp/cache/bootsnap-load-path-cache")
system.root.join("tmp/cache/bootsnap-compile-cache")
end

before do
FileUtils.rm_r(system.root.join("tmp/cache"))
end

after do
FileUtils.rm_r(system.root.join("tmp/cache"))
end

describe ".require_from_root" do
xit "loads file" do
it "loads file" do
system.require_from_root("lib/test/models")

expect(Object.const_defined?("Test::Models")).to be(true)
Expand Down

0 comments on commit ccea1a6

Please sign in to comment.