Skip to content

Commit 02d2167

Browse files
committed
Test that the action halts the lane when it aborts on violations
The suite stubs `UI.abort_with_message!` to a no-op so the other examples can inspect the return value, which meant nothing proved the abort actually terminates the lane — it was only asserted as "received". Add one example that lets the real abort run (`and_call_original`) and asserts the action raises rather than falling through to its return. Verified it bites: swapping the abort for a non-halting `UI.error` makes this example fail.
1 parent 81a3ae3 commit 02d2167

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

spec/ios_lint_localization_placeholder_changes_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ def lint_placeholder_changes(old:, new:, **extra_params)
5050
)
5151
end
5252

53+
it 'actually halts the lane (raises) when it aborts on violations, instead of returning' do
54+
# The `before` block stubs `abort_with_message!` to a no-op so the other examples can inspect the
55+
# return value. Here we let the real one run to prove the abort genuinely stops the lane: in
56+
# production `UI.abort_with_message!` raises, so the action must not fall through to its `return`.
57+
allow(FastlaneCore::UI).to receive(:abort_with_message!).and_call_original
58+
59+
expect do
60+
lint_placeholder_changes(old: '"likes" = "%d likes";', new: '"likes" = "%@ likes";')
61+
end.to raise_error(/changed their format placeholders incompatibly/)
62+
end
63+
5364
it 'ignores added and removed keys, only flagging changes to keys present in both' do
5465
result = lint_placeholder_changes(
5566
old: <<~OLD,

0 commit comments

Comments
 (0)