diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d781ce4c0..cc3607365 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -16,6 +16,8 @@ require "spec_with_project" require "rails_spec_helper" +require "debug/prelude" + backtrace_filter = Minitest::ExtensibleBacktraceFilter.default_filter backtrace_filter.add_filter(%r{gems/sorbet-runtime}) backtrace_filter.add_filter(%r{gems/railties}) diff --git a/spec/tapioca/loaders/dsl_spec.rb b/spec/tapioca/loaders/dsl_spec.rb new file mode 100644 index 000000000..a8e0d1ba9 --- /dev/null +++ b/spec/tapioca/loaders/dsl_spec.rb @@ -0,0 +1,44 @@ +# typed: true +# frozen_string_literal: true + +require "spec_helper" + +module Tapioca + module Loaders + class DslSpec < SpecWithProject + describe "#load_application" do + it "loads the application if `lsp_addon` is false" do + outputs = capture_io do + Loaders::Dsl.load_application( + tapioca_path: @project.absolute_path, + app_root: @project.absolute_path, + lsp_addon: false, + ) + end + + output = outputs.first # TODO: why are there two outputs? + + assert_match(/Loading DSL extension classes.../, output) + assert_match(/Loading Rails application/, output) + assert_match(/Loading DSL compiler classes.../, output) + end + + it "does not load the application if `lsp_addon` is true" do + outputs = capture_io do + Loaders::Dsl.load_application( + tapioca_path: @project.absolute_path, + app_root: @project.absolute_path, + lsp_addon: true, + ) + end + + output = outputs.first # TODO: why are there two outputs? + + assert_match(/Loading DSL extension classes.../, output) + refute_match(/Loading Rails application/, output) + assert_match(/Loading DSL compiler classes.../, output) + end + end + end + end +end