Skip to content
Open
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
22 changes: 22 additions & 0 deletions test/upgrade_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

require "test_helper"

class UpgradeTest < ViteRuby::Test
def test_updates_gems_conservatively
libraries = [
["rails", Struct.new(:name).new("vite_rails")],
["rack", Struct.new(:name).new("vite_plugin_legacy")],
]
status = MockProcessStatus.new

ViteRuby.stub(:framework_libraries, libraries) do
ViteRuby::IO.stub(:capture, ->(*command) {
assert_equal ["bundle update --conservative vite_ruby vite_rails vite_plugin_legacy"], command
["", "", status]
}) do
ViteRuby::CLI::Upgrade.new.send(:upgrade_ruby_gems)
end
end
end
end
2 changes: 1 addition & 1 deletion vite_ruby/lib/vite_ruby/cli/upgrade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def upgrade_ruby_gems

libraries = ViteRuby.framework_libraries.map { |_f, library| library.name }

run_with_capture("bundle update #{libraries.join(" ")}")
run_with_capture("bundle update --conservative vite_ruby #{libraries.join(" ")}")
end

# NOTE: Spawn a new process so that it uses the updated vite_ruby.
Expand Down
Loading