Skip to content

Commit

Permalink
cask/utils: Make more noise when encountering undefined methods
Browse files Browse the repository at this point in the history
- https://github.com/Homebrew/homebrew-cask/actions/runs/4608585102/jobs/8144571098
  introduced syntax errors for the `mattermost` cask (`autoupdates`
  instead of `auto_updates`), but CI didn't fail so we didn't notice
  until it shipped to users and broke `brew update`.
  • Loading branch information
issyl0 committed Apr 4, 2023
1 parent 41e7ee7 commit 0727175
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/utils.rb
Expand Up @@ -104,7 +104,7 @@ def self.method_missing_message(method, token, section = nil)
message << "during #{section} " if section
message << "on Cask #{token}."

opoo "#{message}\n#{error_message_with_suggestions}"
ofail "#{message}\n#{error_message_with_suggestions}"
end
end
end
10 changes: 2 additions & 8 deletions Library/Homebrew/test/cask/dsl_spec.rb
Expand Up @@ -20,10 +20,10 @@
end
end

it "prints a warning that it has encountered an unexpected method" do
it "prints an error that it has encountered an unexpected method" do
expected = Regexp.compile(<<~EOS.lines.map(&:chomp).join)
(?m)
Warning:
Error:
.*
Unexpected method 'future_feature' called on Cask unexpected-method-cask\\.
.*
Expand All @@ -34,12 +34,6 @@
expect { attempt_unknown_method }.not_to output.to_stdout
end.to output(expected).to_stderr
end

it "will simply warn, not throw an exception" do
expect do
attempt_unknown_method
end.not_to raise_error
end
end

describe "header line" do
Expand Down

0 comments on commit 0727175

Please sign in to comment.