Skip to content

Commit 2af2c45

Browse files
committed
fix before function
1 parent 1c7c6be commit 2af2c45

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

.rubocop_todo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2025-10-08 09:39:08 UTC using RuboCop version 1.73.2.
3+
# on 2025-10-08 10:43:51 UTC using RuboCop version 1.73.2.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 1
9+
# Offense count: 2
1010
# This cop supports safe autocorrection (--autocorrect).
1111
RSpec/ExpectActual:
1212
Exclude:

spec/acceptance/deferred_spec.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ def read_fixture(name)
88
end
99

1010
def read_win_file_if_exists(path)
11-
ps = %{$p='#{path}'; if (Test-Path -LiteralPath $p) { Get-Content -Raw -LiteralPath $p } else { '<<<FILE_NOT_FOUND>>>' }}
11+
# Use a script block with literals; avoid $variables to prevent transport/quoting expansion
12+
# Also keep exit 0 regardless of existence so run_shell doesn't raise.
13+
ps = %{& { if (Test-Path -LiteralPath '#{path}') { Get-Content -Raw -LiteralPath '#{path}' } else { '<<<FILE_NOT_FOUND>>>' } } }
1214
r = run_shell(%(powershell.exe -NoProfile -NonInteractive -Command "#{ps}"))
1315
body = (r.stdout || '').to_s
14-
{ exists: !body.include?('<<<FILE_NOT_FOUND>>>'), content: body.include?('<<<FILE_NOT_FOUND>>>') ? '' : body }
16+
exists = !body.include?('<<<FILE_NOT_FOUND>>>')
17+
{ exists: exists, content: exists ? body : '' }
1518
end
1619

1720
describe 'deferred values with dsc_lite' do

0 commit comments

Comments
 (0)