File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ def bump(directory = ".")
102102 path = File . expand_path ( err . file )
103103 next unless path . start_with? ( directory )
104104 next unless File . file? ( path )
105+ next unless files_to_bump . include? ( path )
105106 path
106107 end . compact . uniq
107108
Original file line number Diff line number Diff line change @@ -315,6 +315,36 @@ def test_bump_dry_does_nothing_with_no_bumpable_file
315315 assert_equal ( "false" , Sorbet ::Sigils . file_strictness ( "#{ @project . path } /file2.rb" ) )
316316 end
317317
318+ def test_bump_dry_does_not_revert_files_not_bumped
319+ @project . write ( "file1.rb" , <<~RB )
320+ # typed: false
321+ class A
322+ def foo(a, b); end
323+ end
324+ RB
325+ @project . write ( "file2.rbi" , <<~RB )
326+ # typed: true
327+ class A
328+ def foo(a, b, c); end
329+ end
330+ RB
331+
332+ out , err , status = @project . bundle_exec ( "spoom bump --no-color --from false --to true --dry" )
333+ assert_empty ( err )
334+ assert_equal ( <<~OUT , out )
335+ Checking files...
336+
337+ Can bump `1` file from `false` to `true`:
338+ + file1.rb
339+
340+ Run `spoom bump --from false --to true` locally then `commit the changes` and `push them`
341+ OUT
342+ refute ( status )
343+
344+ assert_equal ( "false" , Sorbet ::Sigils . file_strictness ( "#{ @project . path } /file1.rb" ) )
345+ assert_equal ( "true" , Sorbet ::Sigils . file_strictness ( "#{ @project . path } /file2.rbi" ) )
346+ end
347+
318348 def test_bump_only_specified_files
319349 @project . write ( "file1.rb" , "# typed: false" )
320350 @project . write ( "file2.rb" , "# typed: false" )
You can’t perform that action at this time.
0 commit comments