Skip to content

Commit

Permalink
Merge pull request #1192 from Homebrew/brew_style_fix
Browse files Browse the repository at this point in the history
`brew style --fix`
  • Loading branch information
MikeMcQuaid authored Apr 7, 2023
2 parents 66e44ea + 9ef2e1a commit 20ac256
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
5 changes: 3 additions & 2 deletions spec/bundle/brew_dumper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,14 @@
it "returns an array for all formulae" do
expect(Formula).to receive(:installed).and_return([foo, bar, baz])
expect(bar.linked_keg).to receive(:realpath).and_return(OpenStruct.new(basename: "1.0"))
expect(Tab).to receive(:for_keg).with(bar.linked_keg).and_return \
expect(Tab).to receive(:for_keg).with(bar.linked_keg).and_return(
instance_double(Tab,
installed_as_dependency: false,
installed_on_request: false,
poured_from_bottle: true,
runtime_dependencies: [],
used_options: [])
used_options: []),
)
expect(dumper.formulae_by_full_name).to eql({
"bar" => bar_hash,
"qux/quuz/foo" => foo_hash,
Expand Down
5 changes: 3 additions & 2 deletions spec/bundle/cask_installer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@
end

it "installs cask with arguments" do
expect(Bundle).to \
expect(Bundle).to(
receive(:system).with(HOMEBREW_BREW_FILE, "install", "--cask", "firefox", "--appdir=/Applications",
verbose: false)
.and_return(true)
.and_return(true),
)
expect(described_class.preinstall("firefox", args: { appdir: "/Applications" })).to be(true)
expect(described_class.install("firefox", args: { appdir: "/Applications" })).to be(true)
end
Expand Down
15 changes: 9 additions & 6 deletions spec/bundle/commands/check_command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@

context "when restart_service is true" do
it "raises an error" do
allow_any_instance_of(Pathname).to \
receive(:read).and_return("brew 'abc', restart_service: true\nbrew 'def', restart_service: true")
allow_any_instance_of(Pathname).to(
receive(:read).and_return("brew 'abc', restart_service: true\nbrew 'def', restart_service: true"),
)
allow_any_instance_of(Bundle::Checker::MacAppStoreChecker).to \
receive(:format_checkable).and_return(1 => "foo")
expect { do_check }.to raise_error(SystemExit).and output(expected_output).to_stdout
Expand All @@ -122,8 +123,9 @@

context "when start_service is true" do
it "raises an error" do
allow_any_instance_of(Pathname).to \
receive(:read).and_return("brew 'abc', start_service: true\nbrew 'def', start_service: true")
allow_any_instance_of(Pathname).to(
receive(:read).and_return("brew 'abc', start_service: true\nbrew 'def', start_service: true"),
)
allow_any_instance_of(Bundle::Checker::MacAppStoreChecker).to \
receive(:format_checkable).and_return(1 => "foo")
expect { do_check }.to raise_error(SystemExit).and output(expected_output).to_stdout
Expand All @@ -149,8 +151,9 @@
end

it "raises an error that doesn't mention upgrade" do
allow_any_instance_of(Pathname).to \
receive(:read).and_return("brew 'abc'")
allow_any_instance_of(Pathname).to(
receive(:read).and_return("brew 'abc'"),
)
allow_any_instance_of(Bundle::Checker::MacAppStoreChecker).to \
receive(:format_checkable).and_return(1 => "foo")
expect { do_check }.to raise_error(SystemExit).and output(expected_output).to_stdout
Expand Down
13 changes: 9 additions & 4 deletions spec/bundle/commands/list_command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@

describe "outputs dependencies to stdout" do
before do
allow_any_instance_of(Pathname).to receive(:read).and_return \
"tap 'phinze/cask'\nbrew 'mysql', " \
"conflicts_with: ['mysql56']\ncask 'google-chrome'\nmas '1Password', id: 443987910" \
"\n whalebrew 'whalebrew/imagemagick'"
allow_any_instance_of(Pathname).to receive(:read).and_return(
<<~EOS,
tap 'phinze/cask'
brew 'mysql', conflicts_with: ['mysql56']
cask 'google-chrome'
mas '1Password', id: 443987910
whalebrew 'whalebrew/imagemagick'
EOS
)
end

it "only shows brew deps when no options are passed" do
Expand Down
5 changes: 3 additions & 2 deletions spec/bundle/tap_dumper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@
end

it "dumps output" do
expect(dumper.dump).to eql \
expect(dumper.dump).to eql(
"tap \"bitbucket/bar\", \"https://bitbucket.org/bitbucket/bar.git\"\n" \
"tap \"homebrew/baz\"\ntap \"homebrew/foo\""
"tap \"homebrew/baz\"\ntap \"homebrew/foo\"",
)
end
end
end

0 comments on commit 20ac256

Please sign in to comment.