Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for DSL loader #2102

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
44 changes: 44 additions & 0 deletions spec/tapioca/loaders/dsl_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Loading