Skip to content

Commit 41d3e2b

Browse files
committed
Update test structure and linter fixes...
PR 3840 updated bundler and required changes to test setup. #3840
1 parent f2e11fd commit 41d3e2b

2 files changed

Lines changed: 13 additions & 17 deletions

File tree

exe/ruby-lsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ rescue OptionParser::InvalidOption => e
6262
end
6363

6464
if options[:branch] && options[:lsp_path]
65-
warn('Invalid options: --branch and --lsp-path cannot both be set.')
65+
warn("Invalid options: --branch and --lsp-path cannot both be set.")
6666
exit(1)
6767
end
6868

6969
if options[:lsp_path] && !File.absolute_path?(options[:lsp_path])
70-
warn('Invalid option: --lsp-path must be an absolute path.')
70+
warn("Invalid option: --lsp-path must be an absolute path.")
7171
exit(1)
7272
end
7373

test/setup_bundler_test.rb

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -317,25 +317,21 @@ def test_creates_composed_bundle_with_specified_branch
317317
end
318318

319319
def test_creates_composed_bundle_with_specified_path
320-
Dir.mktmpdir do |dir|
320+
in_temp_dir do |dir|
321321
local_path = File.join(dir, "local-ruby-lsp")
322322
FileUtils.mkdir_p(File.join(local_path, "lib"))
323-
324-
Dir.chdir(dir) do
325-
bundle_gemfile = Pathname.new(".ruby-lsp").expand_path(Dir.pwd) + "Gemfile"
326-
Bundler.with_unbundled_env do
327-
stub_bundle_with_env(bundle_env(dir, bundle_gemfile.to_s))
328-
run_script(File.realpath(dir), lsp_path: local_path)
329-
end
330-
331-
assert_path_exists(".ruby-lsp")
332-
assert_path_exists(".ruby-lsp/Gemfile")
333-
assert_match(%r{ruby-lsp.*path: "#{Regexp.escape(local_path)}"}, File.read(".ruby-lsp/Gemfile"))
334-
assert_match("debug", File.read(".ruby-lsp/Gemfile"))
323+
324+
Bundler.with_unbundled_env do
325+
stub_bundle_with_env(bundle_env(dir, ".ruby-lsp/Gemfile"))
326+
run_script(File.realpath(dir), lsp_path: local_path)
335327
end
336-
end
337-
end
338328

329+
assert_path_exists(".ruby-lsp")
330+
assert_path_exists(".ruby-lsp/Gemfile")
331+
assert_match(/ruby-lsp.*path: "#{Regexp.escape(local_path)}"/, File.read(".ruby-lsp/Gemfile"))
332+
assert_match("debug", File.read(".ruby-lsp/Gemfile"))
333+
end
334+
end
339335

340336
def test_returns_bundle_app_config_if_there_is_local_config
341337
in_temp_dir do |dir|

0 commit comments

Comments
 (0)