Skip to content

Commit

Permalink
Merge pull request #1078 from Homebrew/fix_brew_style
Browse files Browse the repository at this point in the history
Fix brew style
  • Loading branch information
MikeMcQuaid authored Apr 21, 2022
2 parents 2c9486c + 3d37c18 commit c1045f9
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 24 deletions.
8 changes: 4 additions & 4 deletions spec/bundle/brew_dumper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
subject(:dumper) { described_class }

let(:foo) do
instance_double("Formula",
instance_double(Formula,
name: "foo",
desc: "foobar",
oldname: "oldfoo",
Expand Down Expand Up @@ -56,7 +56,7 @@
end
let(:bar) do
linked_keg = Pathname("/usr/local").join("var").join("homebrew").join("linked").join("bar")
instance_double("Formula",
instance_double(Formula,
name: "bar",
desc: "barfoo",
oldname: nil,
Expand Down Expand Up @@ -119,7 +119,7 @@
}
end
let(:baz) do
instance_double("Formula",
instance_double(Formula,
name: "baz",
desc: "",
oldname: nil,
Expand Down Expand Up @@ -202,7 +202,7 @@
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 \
instance_double("Tab",
instance_double(Tab,
installed_as_dependency: false,
installed_on_request: false,
poured_from_bottle: true,
Expand Down
25 changes: 13 additions & 12 deletions spec/bundle/cask_dumper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "spec_helper"
require "cask"

describe Bundle::CaskDumper do
subject(:dumper) { described_class }
Expand Down Expand Up @@ -40,17 +41,17 @@
before do
described_class.reset!

foo = instance_double("Cask::Cask", to_s: "foo", desc: nil, config: nil)
baz = instance_double("Cask::Cask", to_s: "baz", desc: "Software", config: nil)
foo = instance_double(Cask::Cask, to_s: "foo", desc: nil, config: nil)
baz = instance_double(Cask::Cask, to_s: "baz", desc: "Software", config: nil)
bar = instance_double(
"Cask::Cask", to_s: "bar",
desc: nil,
config: instance_double("Cask::Cask.config",
explicit: {
fontdir: "/Library/Fonts",
languages: ["zh-TW"],
},
explicit_s: 'fontdir: "/Library/Fonts", language: "zh-TW"')
Cask::Cask, to_s: "bar",
desc: nil,
config: instance_double(Cask::Config,
explicit: {
fontdir: "/Library/Fonts",
languages: ["zh-TW"],
},
explicit_s: 'fontdir: "/Library/Fonts", language: "zh-TW"')
)

allow(Bundle).to receive(:cask_installed?).and_return(true)
Expand Down Expand Up @@ -86,8 +87,8 @@
context "when multiple casks have the same dependency" do
before do
described_class.reset!
foo = instance_double("Cask::Cask", to_s: "foo", depends_on: { formula: ["baz", "qux"] })
bar = instance_double("Cask::Cask", to_s: "bar", depends_on: {})
foo = instance_double(Cask::Cask, to_s: "foo", depends_on: { formula: ["baz", "qux"] })
bar = instance_double(Cask::Cask, to_s: "bar", depends_on: {})
allow(Cask::Caskroom).to receive(:casks).and_return([foo, bar])
allow(Bundle).to receive(:cask_installed?).and_return(true)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/bundle/commands/dump_command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
end

it "doesn't raise error" do
io = instance_double("File", write: true)
io = instance_double(File, write: true)
expect_any_instance_of(Pathname).to receive(:open).with("w").and_yield(io)
expect(io).to receive(:write)
expect do
Expand Down
6 changes: 3 additions & 3 deletions spec/bundle/dumper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
Bundle::WhalebrewDumper.reset!
Bundle::BrewServices.reset!

chrome = instance_double("Cask::Cask",
chrome = instance_double(Cask::Cask,
full_name: "google-chrome",
to_s: "google-chrome",
config: nil)
java = instance_double("Cask::Cask",
java = instance_double(Cask::Cask,
full_name: "java",
to_s: "java",
config: nil)
iterm2beta = instance_double("Cask::Cask",
iterm2beta = instance_double(Cask::Cask,
full_name: "homebrew/cask-versions/iterm2-beta",
to_s: "iterm2-beta",
config: nil)
Expand Down
2 changes: 1 addition & 1 deletion spec/bundle/locker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
before do
allow(OS).to receive(:mac?).and_return(true)

adoptopenjdk8 = instance_double("Cask::Cask", to_s: "adoptopenjdk8", version: "8,232:b09")
adoptopenjdk8 = instance_double(Cask::Cask, to_s: "adoptopenjdk8", version: "8,232:b09")
allow(Cask::Caskroom).to receive(:casks).and_return([adoptopenjdk8])
allow(locker).to receive(:`).with("mas list").and_return("497799835 Xcode (11.2)")
end
Expand Down
6 changes: 3 additions & 3 deletions spec/bundle/tap_dumper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
context "with `bitbucket/bar`, `homebrew/baz` and `homebrew/foo` taps" do
before do
described_class.reset!
bar = instance_double("Tap", name: "bitbucket/bar", custom_remote?: true,
bar = instance_double(Tap, name: "bitbucket/bar", custom_remote?: true,
remote: "https://bitbucket.org/bitbucket/bar.git")
baz = instance_double("Tap", name: "homebrew/baz", custom_remote?: false)
foo = instance_double("Tap", name: "homebrew/foo", custom_remote?: false)
baz = instance_double(Tap, name: "homebrew/baz", custom_remote?: false)
foo = instance_double(Tap, name: "homebrew/foo", custom_remote?: false)
allow(Tap).to receive(:each).and_return [bar, baz, foo]
end

Expand Down
1 change: 1 addition & 0 deletions spec/stub/cask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

require "cask/cask"
require "cask/caskroom"
require "cask/config"
13 changes: 13 additions & 0 deletions spec/stub/cask/config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Cask
class Config
def explicit
{}
end

def explicit_s
explicit.to_s
end
end
end

0 comments on commit c1045f9

Please sign in to comment.