Merge pull request #4948 from MikeMcQuaid/rubocop-rspec-default
Install and use RuboCop RSpec by default.
This commit is contained in:
commit
8125aba04e
@ -1,6 +0,0 @@
|
|||||||
inherit_from:
|
|
||||||
- .rubocop.yml
|
|
||||||
|
|
||||||
RSpec/ExpectActual:
|
|
||||||
Exclude:
|
|
||||||
- 'test/missing_formula_spec.rb'
|
|
||||||
@ -1,5 +1,6 @@
|
|||||||
inherit_from:
|
inherit_from:
|
||||||
- ../.rubocop.yml
|
- ../.rubocop.yml
|
||||||
|
- .rubocop_todo.yml
|
||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
Include:
|
Include:
|
||||||
|
|||||||
141
Library/Homebrew/.rubocop_todo.yml
Normal file
141
Library/Homebrew/.rubocop_todo.yml
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
# This configuration was generated by
|
||||||
|
# `rubocop --auto-gen-config`
|
||||||
|
# on 2018-09-20 09:03:52 +0100 using RuboCop version 0.59.1.
|
||||||
|
# The point is for the user to remove these configuration records
|
||||||
|
# one by one as the offenses are removed from the code base.
|
||||||
|
# Note that changes in the inspected code, or installation of new
|
||||||
|
# versions of RuboCop, may require this file to be generated again.
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
Layout/LeadingCommentSpace:
|
||||||
|
Exclude:
|
||||||
|
- 'style.rb'
|
||||||
|
|
||||||
|
# Offense count: 27
|
||||||
|
RSpec/AnyInstance:
|
||||||
|
Exclude:
|
||||||
|
- 'test/cask/cmd/create_spec.rb'
|
||||||
|
- 'test/cask/cmd/edit_spec.rb'
|
||||||
|
- 'test/cask/cmd/outdated_spec.rb'
|
||||||
|
- 'test/cask/cmd/upgrade_spec.rb'
|
||||||
|
- 'test/caveats_spec.rb'
|
||||||
|
- 'test/cleanup_spec.rb'
|
||||||
|
- 'test/download_strategies_spec.rb'
|
||||||
|
- 'test/formatter_spec.rb'
|
||||||
|
- 'test/os/linux/dependency_collector_spec.rb'
|
||||||
|
- 'test/utils/analytics_spec.rb'
|
||||||
|
- 'test/utils/git_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 139
|
||||||
|
# Configuration parameters: Prefixes.
|
||||||
|
# Prefixes: when, with, without
|
||||||
|
RSpec/ContextWording:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 69
|
||||||
|
RSpec/DescribeClass:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 573
|
||||||
|
# Configuration parameters: Max.
|
||||||
|
RSpec/ExampleLength:
|
||||||
|
Max: 133
|
||||||
|
|
||||||
|
# Offense count: 16
|
||||||
|
RSpec/ExpectActual:
|
||||||
|
Exclude:
|
||||||
|
- 'spec/routing/**/*'
|
||||||
|
- 'test/missing_formula_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 21
|
||||||
|
RSpec/ExpectInHook:
|
||||||
|
Exclude:
|
||||||
|
- 'test/cache_store_spec.rb'
|
||||||
|
- 'test/cask/audit_spec.rb'
|
||||||
|
- 'test/cmd/reinstall_spec.rb'
|
||||||
|
- 'test/download_strategies_spec.rb'
|
||||||
|
- 'test/linkage_cache_store_spec.rb'
|
||||||
|
- 'test/migrator_spec.rb'
|
||||||
|
- 'test/os/mac/java_requirement_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 32
|
||||||
|
# Configuration parameters: CustomTransform, IgnoreMethods.
|
||||||
|
RSpec/FilePath:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 6
|
||||||
|
# Configuration parameters: AssignmentOnly.
|
||||||
|
RSpec/InstanceVariable:
|
||||||
|
Exclude:
|
||||||
|
- 'test/download_strategies_spec.rb'
|
||||||
|
- 'test/support/helper/spec/shared_context/integration_test.rb'
|
||||||
|
- 'test/utils/git_spec.rb'
|
||||||
|
- 'test/version_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 113
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: have_received, receive
|
||||||
|
RSpec/MessageSpies:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
RSpec/MissingExampleGroupArgument:
|
||||||
|
Exclude:
|
||||||
|
- 'test/cask/depends_on_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 23
|
||||||
|
RSpec/MultipleDescribes:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 544
|
||||||
|
# Configuration parameters: AggregateFailuresByDefault.
|
||||||
|
RSpec/MultipleExpectations:
|
||||||
|
Max: 26
|
||||||
|
|
||||||
|
# Offense count: 929
|
||||||
|
RSpec/NamedSubject:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 99
|
||||||
|
RSpec/NestedGroups:
|
||||||
|
Max: 5
|
||||||
|
|
||||||
|
# Offense count: 11
|
||||||
|
RSpec/RepeatedDescription:
|
||||||
|
Exclude:
|
||||||
|
- 'test/inreplace_spec.rb'
|
||||||
|
- 'test/migrator_spec.rb'
|
||||||
|
- 'test/rubocops/dependency_order_cop_spec.rb'
|
||||||
|
- 'test/rubocops/lines_cop_spec.rb'
|
||||||
|
- 'test/tab_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 10
|
||||||
|
RSpec/RepeatedExample:
|
||||||
|
Exclude:
|
||||||
|
- 'test/compiler_selector_spec.rb'
|
||||||
|
- 'test/utils/shell_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 31
|
||||||
|
RSpec/SubjectStub:
|
||||||
|
Exclude:
|
||||||
|
- 'test/cache_store_spec.rb'
|
||||||
|
- 'test/cmd/update-report/reporter_spec.rb'
|
||||||
|
- 'test/download_strategies_spec.rb'
|
||||||
|
- 'test/formula_installer_spec.rb'
|
||||||
|
- 'test/java_requirement_spec.rb'
|
||||||
|
- 'test/language/python_spec.rb'
|
||||||
|
- 'test/os/mac/java_requirement_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 64
|
||||||
|
# Configuration parameters: IgnoreSymbolicNames.
|
||||||
|
RSpec/VerifiedDoubles:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: empty, nil, both
|
||||||
|
Style/EmptyElse:
|
||||||
|
Exclude:
|
||||||
|
- 'style.rb'
|
||||||
@ -11,8 +11,6 @@
|
|||||||
#: If `--display-cop-names` is passed, include the RuboCop cop name for each
|
#: If `--display-cop-names` is passed, include the RuboCop cop name for each
|
||||||
#: violation in the output.
|
#: violation in the output.
|
||||||
#:
|
#:
|
||||||
#: If `--rspec` is passed, install and use the RuboCop RSpec gem.
|
|
||||||
#:
|
|
||||||
#: Passing `--only-cops=`<cops> will check for violations of only the listed
|
#: Passing `--only-cops=`<cops> will check for violations of only the listed
|
||||||
#: RuboCop <cops>, while `--except-cops=`<cops> will skip checking the listed
|
#: RuboCop <cops>, while `--except-cops=`<cops> will skip checking the listed
|
||||||
#: <cops>. For either option <cops> should be a comma-separated list of cop names.
|
#: <cops>. For either option <cops> should be a comma-separated list of cop names.
|
||||||
|
|||||||
@ -18,10 +18,12 @@ module Homebrew
|
|||||||
fix = options[:fix]
|
fix = options[:fix]
|
||||||
|
|
||||||
Homebrew.install_gem_setup_path! "rubocop", HOMEBREW_RUBOCOP_VERSION
|
Homebrew.install_gem_setup_path! "rubocop", HOMEBREW_RUBOCOP_VERSION
|
||||||
|
Homebrew.install_gem! "rubocop-rspec"
|
||||||
require "rubocop"
|
require "rubocop"
|
||||||
require "rubocops"
|
require "rubocops"
|
||||||
|
|
||||||
args = %w[
|
args = %w[
|
||||||
|
--require rubocop-rspec
|
||||||
--force-exclusion
|
--force-exclusion
|
||||||
]
|
]
|
||||||
if fix
|
if fix
|
||||||
@ -34,11 +36,6 @@ module Homebrew
|
|||||||
args += ["--extra-details", "--display-cop-names"]
|
args += ["--extra-details", "--display-cop-names"]
|
||||||
end
|
end
|
||||||
|
|
||||||
if ARGV.include?("--rspec")
|
|
||||||
Homebrew.install_gem! "rubocop-rspec"
|
|
||||||
args += %w[--require rubocop-rspec]
|
|
||||||
end
|
|
||||||
|
|
||||||
if options[:except_cops]
|
if options[:except_cops]
|
||||||
options[:except_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
|
options[:except_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
|
||||||
cops_to_exclude = options[:except_cops].select do |cop|
|
cops_to_exclude = options[:except_cops].select do |cop|
|
||||||
@ -65,11 +62,7 @@ module Homebrew
|
|||||||
File.expand_path(file).start_with? HOMEBREW_LIBRARY_PATH
|
File.expand_path(file).start_with? HOMEBREW_LIBRARY_PATH
|
||||||
end
|
end
|
||||||
config_file = if files.nil? || has_non_formula
|
config_file = if files.nil? || has_non_formula
|
||||||
if ARGV.include?("--rspec")
|
HOMEBREW_LIBRARY_PATH/".rubocop.yml"
|
||||||
HOMEBREW_LIBRARY_PATH/".rubocop-rspec.yml"
|
|
||||||
else
|
|
||||||
HOMEBREW_LIBRARY_PATH/".rubocop.yml"
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
HOMEBREW_LIBRARY/".rubocop_audit.yml"
|
HOMEBREW_LIBRARY/".rubocop_audit.yml"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -8,6 +8,7 @@ gem "rspec-its", require: false
|
|||||||
gem "rspec-retry", require: false
|
gem "rspec-retry", require: false
|
||||||
gem "rspec-wait", require: false
|
gem "rspec-wait", require: false
|
||||||
gem "rubocop", HOMEBREW_RUBOCOP_VERSION
|
gem "rubocop", HOMEBREW_RUBOCOP_VERSION
|
||||||
|
gem "rubocop-rspec", require: false
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem "ronn", require: false
|
gem "ronn", require: false
|
||||||
|
|||||||
@ -52,6 +52,8 @@ GEM
|
|||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||||
|
rubocop-rspec (1.29.1)
|
||||||
|
rubocop (>= 0.58.0)
|
||||||
ruby-progressbar (1.10.0)
|
ruby-progressbar (1.10.0)
|
||||||
simplecov (0.16.1)
|
simplecov (0.16.1)
|
||||||
docile (~> 1.1)
|
docile (~> 1.1)
|
||||||
@ -73,6 +75,7 @@ DEPENDENCIES
|
|||||||
rspec-retry
|
rspec-retry
|
||||||
rspec-wait
|
rspec-wait
|
||||||
rubocop (= 0.59.1)
|
rubocop (= 0.59.1)
|
||||||
|
rubocop-rspec
|
||||||
simplecov
|
simplecov
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
|
|||||||
@ -18,6 +18,7 @@ describe Bottle::Filename do
|
|||||||
|
|
||||||
context "when rebuild is 1" do
|
context "when rebuild is 1" do
|
||||||
let(:rebuild) { 1 }
|
let(:rebuild) { 1 }
|
||||||
|
|
||||||
its(:extname) { is_expected.to eq ".tag.bottle.1.tar.gz" }
|
its(:extname) { is_expected.to eq ".tag.bottle.1.tar.gz" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,23 +1,23 @@
|
|||||||
require "cache_store"
|
require "cache_store"
|
||||||
|
|
||||||
describe CacheStoreDatabase do
|
describe CacheStoreDatabase do
|
||||||
subject { CacheStoreDatabase.new(:sample) }
|
subject { described_class.new(:sample) }
|
||||||
|
|
||||||
describe "self.use" do
|
describe "self.use" do
|
||||||
let(:type) { :test }
|
let(:type) { :test }
|
||||||
|
|
||||||
it "creates a new `DatabaseCache` instance" do
|
it "creates a new `DatabaseCache` instance" do
|
||||||
cache_store = double("cache_store", close_if_open!: nil)
|
cache_store = double("cache_store", close_if_open!: nil)
|
||||||
expect(CacheStoreDatabase).to receive(:new).with(type).and_return(cache_store)
|
expect(described_class).to receive(:new).with(type).and_return(cache_store)
|
||||||
expect(cache_store).to receive(:close_if_open!)
|
expect(cache_store).to receive(:close_if_open!)
|
||||||
CacheStoreDatabase.use(type) { |_db| }
|
described_class.use(type) { |_db| }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#set" do
|
describe "#set" do
|
||||||
let(:db) { double("db", :[]= => nil) }
|
let(:db) { double("db", :[]= => nil) }
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
allow(File).to receive(:write)
|
allow(File).to receive(:write)
|
||||||
allow(subject).to receive(:created?).and_return(true)
|
allow(subject).to receive(:created?).and_return(true)
|
||||||
expect(db).to receive(:has_key?).with(:foo).and_return(false)
|
expect(db).to receive(:has_key?).with(:foo).and_return(false)
|
||||||
@ -25,7 +25,7 @@ describe CacheStoreDatabase do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "sets the value in the `CacheStoreDatabase`" do
|
it "sets the value in the `CacheStoreDatabase`" do
|
||||||
expect(db).to_not have_key(:foo)
|
expect(db).not_to have_key(:foo)
|
||||||
subject.set(:foo, "bar")
|
subject.set(:foo, "bar")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -34,7 +34,7 @@ describe CacheStoreDatabase do
|
|||||||
context "database created" do
|
context "database created" do
|
||||||
let(:db) { double("db", :[] => "bar") }
|
let(:db) { double("db", :[] => "bar") }
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
allow(subject).to receive(:created?).and_return(true)
|
allow(subject).to receive(:created?).and_return(true)
|
||||||
expect(db).to receive(:has_key?).with(:foo).and_return(true)
|
expect(db).to receive(:has_key?).with(:foo).and_return(true)
|
||||||
allow(subject).to receive(:db).and_return(db)
|
allow(subject).to receive(:db).and_return(db)
|
||||||
@ -49,13 +49,13 @@ describe CacheStoreDatabase do
|
|||||||
context "database not created" do
|
context "database not created" do
|
||||||
let(:db) { double("db", :[] => nil) }
|
let(:db) { double("db", :[] => nil) }
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
allow(subject).to receive(:created?).and_return(false)
|
allow(subject).to receive(:created?).and_return(false)
|
||||||
allow(subject).to receive(:db).and_return(db)
|
allow(subject).to receive(:db).and_return(db)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not get value in the `CacheStoreDatabase` corresponding to key" do
|
it "does not get value in the `CacheStoreDatabase` corresponding to key" do
|
||||||
expect(subject.get(:foo)).to_not be("bar")
|
expect(subject.get(:foo)).not_to be("bar")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not call `db[]` if `CacheStoreDatabase.created?` is `false`" do
|
it "does not call `db[]` if `CacheStoreDatabase.created?` is `false`" do
|
||||||
@ -69,7 +69,7 @@ describe CacheStoreDatabase do
|
|||||||
context "database created" do
|
context "database created" do
|
||||||
let(:db) { double("db", :[] => { foo: "bar" }) }
|
let(:db) { double("db", :[] => { foo: "bar" }) }
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
allow(subject).to receive(:created?).and_return(true)
|
allow(subject).to receive(:created?).and_return(true)
|
||||||
allow(subject).to receive(:db).and_return(db)
|
allow(subject).to receive(:db).and_return(db)
|
||||||
end
|
end
|
||||||
@ -83,7 +83,7 @@ describe CacheStoreDatabase do
|
|||||||
context "database not created" do
|
context "database not created" do
|
||||||
let(:db) { double("db", delete: nil) }
|
let(:db) { double("db", delete: nil) }
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
allow(subject).to receive(:created?).and_return(false)
|
allow(subject).to receive(:created?).and_return(false)
|
||||||
allow(subject).to receive(:db).and_return(db)
|
allow(subject).to receive(:db).and_return(db)
|
||||||
end
|
end
|
||||||
@ -97,22 +97,22 @@ describe CacheStoreDatabase do
|
|||||||
|
|
||||||
describe "#close_if_open!" do
|
describe "#close_if_open!" do
|
||||||
context "database open" do
|
context "database open" do
|
||||||
before(:each) do
|
before do
|
||||||
subject.instance_variable_set(:@db, instance_double(DBM, close: nil))
|
subject.instance_variable_set(:@db, instance_double(DBM, close: nil))
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not raise an error when `close` is called on the database" do
|
it "does not raise an error when `close` is called on the database" do
|
||||||
expect { subject.close_if_open! }.to_not raise_error(NoMethodError)
|
expect { subject.close_if_open! }.not_to raise_error(NoMethodError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "database not open" do
|
context "database not open" do
|
||||||
before(:each) do
|
before do
|
||||||
subject.instance_variable_set(:@db, nil)
|
subject.instance_variable_set(:@db, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not raise an error when `close` is called on the database" do
|
it "does not raise an error when `close` is called on the database" do
|
||||||
expect { subject.close_if_open! }.to_not raise_error(NoMethodError)
|
expect { subject.close_if_open! }.not_to raise_error(NoMethodError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -120,12 +120,12 @@ describe CacheStoreDatabase do
|
|||||||
describe "#created?" do
|
describe "#created?" do
|
||||||
let(:cache_path) { Pathname("path/to/homebrew/cache/sample.db") }
|
let(:cache_path) { Pathname("path/to/homebrew/cache/sample.db") }
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
allow(subject).to receive(:cache_path).and_return(cache_path)
|
allow(subject).to receive(:cache_path).and_return(cache_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "`cache_path.exist?` returns `true`" do
|
context "`File.exist?(cache_path)` returns `true`" do
|
||||||
before(:each) do
|
before do
|
||||||
allow(cache_path).to receive(:exist?).and_return(true)
|
allow(cache_path).to receive(:exist?).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -134,8 +134,8 @@ describe CacheStoreDatabase do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "`cache_path.exist?` returns `false`" do
|
context "`File.exist?(cache_path)` returns `false`" do
|
||||||
before(:each) do
|
before do
|
||||||
allow(cache_path).to receive(:exist?).and_return(false)
|
allow(cache_path).to receive(:exist?).and_return(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -112,6 +112,10 @@ describe Cask::Artifact::App, :cask do
|
|||||||
FileUtils.chmod 0555, target_path
|
FileUtils.chmod 0555, target_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
FileUtils.chmod 0755, target_path
|
||||||
|
end
|
||||||
|
|
||||||
it "overwrites the existing app" do
|
it "overwrites the existing app" do
|
||||||
expect(command).to receive(:run).with(
|
expect(command).to receive(:run).with(
|
||||||
"/bin/chmod", args: [
|
"/bin/chmod", args: [
|
||||||
@ -148,10 +152,6 @@ describe Cask::Artifact::App, :cask do
|
|||||||
contents_path = target_path.join("Contents/Info.plist")
|
contents_path = target_path.join("Contents/Info.plist")
|
||||||
expect(contents_path).to exist
|
expect(contents_path).to exist
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
|
||||||
FileUtils.chmod 0755, target_path
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
describe Cask::Artifact::Installer, :cask do
|
describe Cask::Artifact::Installer, :cask do
|
||||||
|
subject(:installer) { described_class.new(cask, **args) }
|
||||||
|
|
||||||
let(:staged_path) { mktmpdir }
|
let(:staged_path) { mktmpdir }
|
||||||
let(:cask) { instance_double(Cask::Cask, staged_path: staged_path, config: nil) }
|
let(:cask) { instance_double(Cask::Cask, staged_path: staged_path, config: nil) }
|
||||||
subject(:installer) { described_class.new(cask, **args) }
|
|
||||||
let(:command) { SystemCommand }
|
let(:command) { SystemCommand }
|
||||||
|
|
||||||
let(:args) { {} }
|
let(:args) { {} }
|
||||||
@ -21,7 +23,7 @@ describe Cask::Artifact::Installer, :cask do
|
|||||||
let(:executable) { staged_path/"executable" }
|
let(:executable) { staged_path/"executable" }
|
||||||
let(:args) { { script: { executable: "executable" } } }
|
let(:args) { { script: { executable: "executable" } } }
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
FileUtils.touch executable
|
FileUtils.touch executable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -104,7 +104,7 @@ describe Cask::Cask, :cask do
|
|||||||
allow(cask).to receive(:versions).and_return(installed_versions)
|
allow(cask).to receive(:versions).and_return(installed_versions)
|
||||||
allow(cask).to receive(:version).and_return(Cask::DSL::Version.new(tap_version))
|
allow(cask).to receive(:version).and_return(Cask::DSL::Version.new(tap_version))
|
||||||
expect(cask).to receive(:outdated_versions).and_call_original
|
expect(cask).to receive(:outdated_versions).and_call_original
|
||||||
is_expected.to eq expected_output
|
expect(subject).to eq expected_output
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -138,7 +138,7 @@ describe Cask::Cask, :cask do
|
|||||||
allow(cask).to receive(:versions).and_return(installed_version)
|
allow(cask).to receive(:versions).and_return(installed_version)
|
||||||
allow(cask).to receive(:version).and_return(Cask::DSL::Version.new(tap_version))
|
allow(cask).to receive(:version).and_return(Cask::DSL::Version.new(tap_version))
|
||||||
expect(cask).to receive(:outdated_versions).and_call_original
|
expect(cask).to receive(:outdated_versions).and_call_original
|
||||||
is_expected.to eq expected_output
|
expect(subject).to eq expected_output
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -20,7 +20,7 @@ describe Cask::Cmd::Info, :cask do
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
it "it prints auto_updates if the Cask has `auto_updates true`" do
|
it "prints auto_updates if the Cask has `auto_updates true`" do
|
||||||
expect {
|
expect {
|
||||||
described_class.run("with-auto-updates")
|
described_class.run("with-auto-updates")
|
||||||
}.to output(<<~EOS).to_stdout
|
}.to output(<<~EOS).to_stdout
|
||||||
|
|||||||
@ -93,7 +93,7 @@ describe Cask::Cmd::Style, :cask do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it {
|
it {
|
||||||
is_expected.to contain_exactly(a_path_ending_with("/homebrew/homebrew-cask/Casks"),
|
expect(subject).to contain_exactly(a_path_ending_with("/homebrew/homebrew-cask/Casks"),
|
||||||
a_path_ending_with("/third-party/homebrew-tap/Casks"))
|
a_path_ending_with("/third-party/homebrew-tap/Casks"))
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,7 +12,7 @@ describe "Satisfy Dependencies and Requirements", :cask do
|
|||||||
let(:cask) { Cask::CaskLoader.load(cask_path("with-depends-on-cask-cyclic")) }
|
let(:cask) { Cask::CaskLoader.load(cask_path("with-depends-on-cask-cyclic")) }
|
||||||
|
|
||||||
it {
|
it {
|
||||||
is_expected.to raise_error(
|
expect(subject).to raise_error(
|
||||||
Cask::CaskCyclicDependencyError,
|
Cask::CaskCyclicDependencyError,
|
||||||
"Cask 'with-depends-on-cask-cyclic' includes cyclic dependencies "\
|
"Cask 'with-depends-on-cask-cyclic' includes cyclic dependencies "\
|
||||||
"on other Casks: with-depends-on-cask-cyclic-helper",
|
"on other Casks: with-depends-on-cask-cyclic-helper",
|
||||||
|
|||||||
@ -130,7 +130,7 @@ describe Cask::Quarantine, :cask do
|
|||||||
Cask::CaskLoader.load(cask_path("local-transmission")),
|
Cask::CaskLoader.load(cask_path("local-transmission")),
|
||||||
).to be_installed
|
).to be_installed
|
||||||
|
|
||||||
expect(Cask::Config.global.appdir.join("Transmission.app")).to_not be_quarantined
|
expect(Cask::Config.global.appdir.join("Transmission.app")).not_to be_quarantined
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not quarantine Cask fetches" do
|
it "does not quarantine Cask fetches" do
|
||||||
@ -138,7 +138,7 @@ describe Cask::Quarantine, :cask do
|
|||||||
local_transmission = Cask::CaskLoader.load(cask_path("local-transmission"))
|
local_transmission = Cask::CaskLoader.load(cask_path("local-transmission"))
|
||||||
cached_location = Cask::Download.new(local_transmission).perform
|
cached_location = Cask::Download.new(local_transmission).perform
|
||||||
|
|
||||||
expect(cached_location).to_not be_quarantined
|
expect(cached_location).not_to be_quarantined
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not quarantine Cask audits" do
|
it "does not quarantine Cask audits" do
|
||||||
@ -147,7 +147,7 @@ describe Cask::Quarantine, :cask do
|
|||||||
local_transmission = Cask::CaskLoader.load(cask_path("local-transmission"))
|
local_transmission = Cask::CaskLoader.load(cask_path("local-transmission"))
|
||||||
cached_location = Cask::Download.new(local_transmission).perform
|
cached_location = Cask::Download.new(local_transmission).perform
|
||||||
|
|
||||||
expect(cached_location).to_not be_quarantined
|
expect(cached_location).not_to be_quarantined
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not quarantine Cask installs even if the fetch was" do
|
it "does not quarantine Cask installs even if the fetch was" do
|
||||||
@ -159,7 +159,7 @@ describe Cask::Quarantine, :cask do
|
|||||||
Cask::CaskLoader.load(cask_path("local-transmission")),
|
Cask::CaskLoader.load(cask_path("local-transmission")),
|
||||||
).to be_installed
|
).to be_installed
|
||||||
|
|
||||||
expect(Cask::Config.global.appdir.join("Transmission.app")).to_not be_quarantined
|
expect(Cask::Config.global.appdir.join("Transmission.app")).not_to be_quarantined
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not quarantine dmg-based Casks" do
|
it "does not quarantine dmg-based Casks" do
|
||||||
@ -169,7 +169,7 @@ describe Cask::Quarantine, :cask do
|
|||||||
Cask::CaskLoader.load(cask_path("container-dmg")),
|
Cask::CaskLoader.load(cask_path("container-dmg")),
|
||||||
).to be_installed
|
).to be_installed
|
||||||
|
|
||||||
expect(Cask::Config.global.appdir.join("container")).to_not be_quarantined
|
expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not quarantine tar-gz-based Casks" do
|
it "does not quarantine tar-gz-based Casks" do
|
||||||
@ -179,7 +179,7 @@ describe Cask::Quarantine, :cask do
|
|||||||
Cask::CaskLoader.load(cask_path("container-tar-gz")),
|
Cask::CaskLoader.load(cask_path("container-tar-gz")),
|
||||||
).to be_installed
|
).to be_installed
|
||||||
|
|
||||||
expect(Cask::Config.global.appdir.join("container")).to_not be_quarantined
|
expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not quarantine xar-based Casks" do
|
it "does not quarantine xar-based Casks" do
|
||||||
@ -189,7 +189,7 @@ describe Cask::Quarantine, :cask do
|
|||||||
Cask::CaskLoader.load(cask_path("container-xar")),
|
Cask::CaskLoader.load(cask_path("container-xar")),
|
||||||
).to be_installed
|
).to be_installed
|
||||||
|
|
||||||
expect(Cask::Config.global.appdir.join("container")).to_not be_quarantined
|
expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not quarantine pure bzip2-based Casks" do
|
it "does not quarantine pure bzip2-based Casks" do
|
||||||
@ -199,7 +199,7 @@ describe Cask::Quarantine, :cask do
|
|||||||
Cask::CaskLoader.load(cask_path("container-bzip2")),
|
Cask::CaskLoader.load(cask_path("container-bzip2")),
|
||||||
).to be_installed
|
).to be_installed
|
||||||
|
|
||||||
expect(Cask::Config.global.appdir.join("container")).to_not be_quarantined
|
expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not quarantine pure gzip-based Casks" do
|
it "does not quarantine pure gzip-based Casks" do
|
||||||
@ -209,7 +209,7 @@ describe Cask::Quarantine, :cask do
|
|||||||
Cask::CaskLoader.load(cask_path("container-gzip")),
|
Cask::CaskLoader.load(cask_path("container-gzip")),
|
||||||
).to be_installed
|
).to be_installed
|
||||||
|
|
||||||
expect(Cask::Config.global.appdir.join("container")).to_not be_quarantined
|
expect(Cask::Config.global.appdir.join("container")).not_to be_quarantined
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not quarantine the pkg in naked-pkg-based Casks" do
|
it "does not quarantine the pkg in naked-pkg-based Casks" do
|
||||||
@ -221,7 +221,7 @@ describe Cask::Quarantine, :cask do
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
Cask::Caskroom.path.join("container-pkg", naked_pkg.version, "container.pkg"),
|
Cask::Caskroom.path.join("container-pkg", naked_pkg.version, "container.pkg"),
|
||||||
).to_not be_quarantined
|
).not_to be_quarantined
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not quarantine a nested container" do
|
it "does not quarantine a nested container" do
|
||||||
@ -231,7 +231,7 @@ describe Cask::Quarantine, :cask do
|
|||||||
Cask::CaskLoader.load(cask_path("nested-app")),
|
Cask::CaskLoader.load(cask_path("nested-app")),
|
||||||
).to be_installed
|
).to be_installed
|
||||||
|
|
||||||
expect(Cask::Config.global.appdir.join("MyNestedApp.app")).to_not be_quarantined
|
expect(Cask::Config.global.appdir.join("MyNestedApp.app")).not_to be_quarantined
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,6 +2,7 @@ module Cask
|
|||||||
describe Verify, :cask do
|
describe Verify, :cask do
|
||||||
describe "::all" do
|
describe "::all" do
|
||||||
subject(:verification) { described_class.all(cask, downloaded_path) }
|
subject(:verification) { described_class.all(cask, downloaded_path) }
|
||||||
|
|
||||||
let(:cask) { instance_double(Cask, token: "cask", sha256: expected_sha256) }
|
let(:cask) { instance_double(Cask, token: "cask", sha256: expected_sha256) }
|
||||||
let(:cafebabe) { "cafebabecafebabecafebabecafebabecafebabecafebabecafebabecafebabe" }
|
let(:cafebabe) { "cafebabecafebabecafebabecafebabecafebabecafebabecafebabecafebabe" }
|
||||||
let(:deadbeef) { "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" }
|
let(:deadbeef) { "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" }
|
||||||
|
|||||||
@ -137,7 +137,7 @@ describe Homebrew::Cleanup do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "#cleanup_cask", :cask do
|
describe "#cleanup_cask", :cask do
|
||||||
before(:each) do
|
before do
|
||||||
Cask::Cache.path.mkpath
|
Cask::Cache.path.mkpath
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -2,11 +2,6 @@ require_relative "../cli_parser"
|
|||||||
|
|
||||||
describe Homebrew::CLI::Parser do
|
describe Homebrew::CLI::Parser do
|
||||||
describe "test switch options" do
|
describe "test switch options" do
|
||||||
before do
|
|
||||||
allow(ENV).to receive(:[]).with("HOMEBREW_PRY").and_return("1")
|
|
||||||
allow(ENV).to receive(:[]).with("HOMEBREW_VERBOSE")
|
|
||||||
end
|
|
||||||
|
|
||||||
subject(:parser) {
|
subject(:parser) {
|
||||||
described_class.new do
|
described_class.new do
|
||||||
switch :verbose, description: "Flag for verbosity"
|
switch :verbose, description: "Flag for verbosity"
|
||||||
@ -15,6 +10,11 @@ describe Homebrew::CLI::Parser do
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
before do
|
||||||
|
allow(ENV).to receive(:[]).with("HOMEBREW_PRY").and_return("1")
|
||||||
|
allow(ENV).to receive(:[]).with("HOMEBREW_VERBOSE")
|
||||||
|
end
|
||||||
|
|
||||||
it "parses short option" do
|
it "parses short option" do
|
||||||
parser.parse(["-v"])
|
parser.parse(["-v"])
|
||||||
expect(Homebrew.args).to be_verbose
|
expect(Homebrew.args).to be_verbose
|
||||||
|
|||||||
@ -235,7 +235,7 @@ describe CurlDownloadStrategy do
|
|||||||
|
|
||||||
context "when URL ends with file" do
|
context "when URL ends with file" do
|
||||||
it {
|
it {
|
||||||
is_expected.to eq(
|
expect(subject).to eq(
|
||||||
HOMEBREW_CACHE/"downloads/3d1c0ae7da22be9d83fb1eb774df96b7c4da71d3cf07e1cb28555cf9a5e5af70--foo.tar.gz",
|
HOMEBREW_CACHE/"downloads/3d1c0ae7da22be9d83fb1eb774df96b7c4da71d3cf07e1cb28555cf9a5e5af70--foo.tar.gz",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ describe CurlDownloadStrategy do
|
|||||||
let(:url) { "https://example.com/foo.tar.gz/from/this/mirror" }
|
let(:url) { "https://example.com/foo.tar.gz/from/this/mirror" }
|
||||||
|
|
||||||
it {
|
it {
|
||||||
is_expected.to eq(
|
expect(subject).to eq(
|
||||||
HOMEBREW_CACHE/"downloads/1ab61269ba52c83994510b1e28dd04167a2f2e8393a35a9c50c1f7d33fd8f619--foo.tar.gz",
|
HOMEBREW_CACHE/"downloads/1ab61269ba52c83994510b1e28dd04167a2f2e8393a35a9c50c1f7d33fd8f619--foo.tar.gz",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ describe CurlDownloadStrategy do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "#fetch" do
|
describe "#fetch" do
|
||||||
before(:each) do
|
before do
|
||||||
subject.temporary_path.dirname.mkpath
|
subject.temporary_path.dirname.mkpath
|
||||||
FileUtils.touch subject.temporary_path
|
FileUtils.touch subject.temporary_path
|
||||||
end
|
end
|
||||||
@ -337,16 +337,19 @@ describe CurlDownloadStrategy do
|
|||||||
describe "#cached_location" do
|
describe "#cached_location" do
|
||||||
context "with a file name trailing the URL path" do
|
context "with a file name trailing the URL path" do
|
||||||
let(:url) { "https://example.com/cask.dmg" }
|
let(:url) { "https://example.com/cask.dmg" }
|
||||||
|
|
||||||
its("cached_location.extname") { is_expected.to eq(".dmg") }
|
its("cached_location.extname") { is_expected.to eq(".dmg") }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with a file name trailing the first query parameter" do
|
context "with a file name trailing the first query parameter" do
|
||||||
let(:url) { "https://example.com/download?file=cask.zip&a=1" }
|
let(:url) { "https://example.com/download?file=cask.zip&a=1" }
|
||||||
|
|
||||||
its("cached_location.extname") { is_expected.to eq(".zip") }
|
its("cached_location.extname") { is_expected.to eq(".zip") }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with a file name trailing the second query parameter" do
|
context "with a file name trailing the second query parameter" do
|
||||||
let(:url) { "https://example.com/dl?a=1&file=cask.zip&b=2" }
|
let(:url) { "https://example.com/dl?a=1&file=cask.zip&b=2" }
|
||||||
|
|
||||||
its("cached_location.extname") { is_expected.to eq(".zip") }
|
its("cached_location.extname") { is_expected.to eq(".zip") }
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -384,7 +387,7 @@ describe CurlPostDownloadStrategy do
|
|||||||
let(:specs) { {} }
|
let(:specs) { {} }
|
||||||
|
|
||||||
describe "#fetch" do
|
describe "#fetch" do
|
||||||
before(:each) do
|
before do
|
||||||
subject.temporary_path.dirname.mkpath
|
subject.temporary_path.dirname.mkpath
|
||||||
FileUtils.touch subject.temporary_path
|
FileUtils.touch subject.temporary_path
|
||||||
end
|
end
|
||||||
@ -426,6 +429,7 @@ end
|
|||||||
|
|
||||||
describe ScpDownloadStrategy do
|
describe ScpDownloadStrategy do
|
||||||
subject { described_class.new(url, name, version) }
|
subject { described_class.new(url, name, version) }
|
||||||
|
|
||||||
let(:name) { "foo" }
|
let(:name) { "foo" }
|
||||||
let(:url) { "scp://example.com/foo.tar.gz" }
|
let(:url) { "scp://example.com/foo.tar.gz" }
|
||||||
let(:version) { nil }
|
let(:version) { nil }
|
||||||
@ -456,6 +460,7 @@ describe ScpDownloadStrategy do
|
|||||||
|
|
||||||
context "when given a valid URL" do
|
context "when given a valid URL" do
|
||||||
let(:url) { "scp://example.com/foo.tar.gz" }
|
let(:url) { "scp://example.com/foo.tar.gz" }
|
||||||
|
|
||||||
it "copies the file via scp" do
|
it "copies the file via scp" do
|
||||||
expect(subject)
|
expect(subject)
|
||||||
.to receive(:system_command!)
|
.to receive(:system_command!)
|
||||||
@ -468,6 +473,7 @@ describe ScpDownloadStrategy do
|
|||||||
|
|
||||||
context "when given a URL with a username" do
|
context "when given a URL with a username" do
|
||||||
let(:url) { "scp://user@example.com/foo.tar.gz" }
|
let(:url) { "scp://user@example.com/foo.tar.gz" }
|
||||||
|
|
||||||
it "copies the file via scp" do
|
it "copies the file via scp" do
|
||||||
expect(subject)
|
expect(subject)
|
||||||
.to receive(:system_command!)
|
.to receive(:system_command!)
|
||||||
@ -480,6 +486,7 @@ describe ScpDownloadStrategy do
|
|||||||
|
|
||||||
context "when given a URL with a port" do
|
context "when given a URL with a port" do
|
||||||
let(:url) { "scp://example.com:1234/foo.tar.gz" }
|
let(:url) { "scp://example.com:1234/foo.tar.gz" }
|
||||||
|
|
||||||
it "copies the file via scp" do
|
it "copies the file via scp" do
|
||||||
expect(subject)
|
expect(subject)
|
||||||
.to receive(:system_command!)
|
.to receive(:system_command!)
|
||||||
@ -492,6 +499,7 @@ describe ScpDownloadStrategy do
|
|||||||
|
|
||||||
context "when given a URL with /~/" do
|
context "when given a URL with /~/" do
|
||||||
let(:url) { "scp://example.com/~/foo.tar.gz" }
|
let(:url) { "scp://example.com/~/foo.tar.gz" }
|
||||||
|
|
||||||
it "treats the path as relative to the home directory" do
|
it "treats the path as relative to the home directory" do
|
||||||
expect(subject)
|
expect(subject)
|
||||||
.to receive(:system_command!)
|
.to receive(:system_command!)
|
||||||
@ -562,7 +570,7 @@ describe DownloadStrategyDetector do
|
|||||||
|
|
||||||
it "returns S3DownloadStrategy" do
|
it "returns S3DownloadStrategy" do
|
||||||
allow(described_class).to receive(:require_aws_sdk).and_return(true)
|
allow(described_class).to receive(:require_aws_sdk).and_return(true)
|
||||||
is_expected.to eq(S3DownloadStrategy)
|
expect(subject).to eq(S3DownloadStrategy)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -572,12 +580,13 @@ describe DownloadStrategyDetector do
|
|||||||
|
|
||||||
it "requires aws-sdk-s3" do
|
it "requires aws-sdk-s3" do
|
||||||
allow(described_class).to receive(:require_aws_sdk).and_return(true)
|
allow(described_class).to receive(:require_aws_sdk).and_return(true)
|
||||||
is_expected.to eq(S3DownloadStrategy)
|
expect(subject).to eq(S3DownloadStrategy)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when given an scp URL" do
|
context "when given an scp URL" do
|
||||||
let(:url) { "scp://example.com/brew.tar.gz" }
|
let(:url) { "scp://example.com/brew.tar.gz" }
|
||||||
|
|
||||||
it { is_expected.to eq(ScpDownloadStrategy) }
|
it { is_expected.to eq(ScpDownloadStrategy) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
describe ErrorDuringExecution do
|
describe ErrorDuringExecution do
|
||||||
subject(:error) { described_class.new(command, status: status, output: output) }
|
subject(:error) { described_class.new(command, status: status, output: output) }
|
||||||
|
|
||||||
let(:command) { ["false"] }
|
let(:command) { ["false"] }
|
||||||
let(:status) { instance_double(Process::Status, exitstatus: exitstatus) }
|
let(:status) { instance_double(Process::Status, exitstatus: exitstatus) }
|
||||||
let(:exitstatus) { 1 }
|
let(:exitstatus) { 1 }
|
||||||
@ -43,7 +44,7 @@ describe ErrorDuringExecution do
|
|||||||
end
|
end
|
||||||
|
|
||||||
its(:to_s) {
|
its(:to_s) {
|
||||||
is_expected.to eq <<~EOS
|
expect(subject.to_s).to eq <<~EOS
|
||||||
Failure while executing; `false` exited with 1. Here's the output:
|
Failure while executing; `false` exited with 1. Here's the output:
|
||||||
This still worked.
|
This still worked.
|
||||||
#{Formatter.error("Here something went wrong.\n")}
|
#{Formatter.error("Here something went wrong.\n")}
|
||||||
@ -55,8 +56,8 @@ describe ErrorDuringExecution do
|
|||||||
let(:command) { ["env", "PATH=/bin", "cat", "with spaces"] }
|
let(:command) { ["env", "PATH=/bin", "cat", "with spaces"] }
|
||||||
|
|
||||||
its(:to_s) {
|
its(:to_s) {
|
||||||
is_expected
|
expect(subject.to_s)
|
||||||
.to eq 'Failure while executing; `env PATH=/bin cat with\ spaces` exited with 1.'
|
.to eq 'Failure while executing; `env PATH=/bin cat with\ spaces` exited with 1.'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -16,7 +16,7 @@ describe FormulaValidationError do
|
|||||||
subject { described_class.new("foo", "sha257", "magic") }
|
subject { described_class.new("foo", "sha257", "magic") }
|
||||||
|
|
||||||
its(:to_s) {
|
its(:to_s) {
|
||||||
is_expected.to eq(%q(invalid attribute for formula 'foo': sha257 ("magic")))
|
expect(subject.to_s).to eq(%q(invalid attribute for formula 'foo': sha257 ("magic")))
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ describe FormulaUnavailableError do
|
|||||||
end
|
end
|
||||||
|
|
||||||
its(:to_s) {
|
its(:to_s) {
|
||||||
is_expected.to eq('No available formula with the name "foo" (dependency of foobar)')
|
expect(subject.to_s).to eq('No available formula with the name "foo" (dependency of foobar)')
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -76,7 +76,7 @@ describe FormulaClassUnavailableError do
|
|||||||
let(:list) { [] }
|
let(:list) { [] }
|
||||||
|
|
||||||
its(:to_s) {
|
its(:to_s) {
|
||||||
is_expected.to match(/Expected to find class Foo, but found no classes\./)
|
expect(subject.to_s).to match(/Expected to find class Foo, but found no classes\./)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ describe FormulaClassUnavailableError do
|
|||||||
let(:list) { [mod.const_get(:Bar)] }
|
let(:list) { [mod.const_get(:Bar)] }
|
||||||
|
|
||||||
its(:to_s) {
|
its(:to_s) {
|
||||||
is_expected.to match(/Expected to find class Foo, but only found: Bar \(not derived from Formula!\)\./)
|
expect(subject.to_s).to match(/Expected to find class Foo, but only found: Bar \(not derived from Formula!\)\./)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -184,6 +184,7 @@ end
|
|||||||
|
|
||||||
describe ErrorDuringExecution do
|
describe ErrorDuringExecution do
|
||||||
subject { described_class.new(["badprg", "arg1", "arg2"], status: status) }
|
subject { described_class.new(["badprg", "arg1", "arg2"], status: status) }
|
||||||
|
|
||||||
let(:status) { instance_double(Process::Status, exitstatus: 17) }
|
let(:status) { instance_double(Process::Status, exitstatus: 17) }
|
||||||
|
|
||||||
its(:to_s) { is_expected.to eq("Failure while executing; `badprg arg1 arg2` exited with 17.") }
|
its(:to_s) { is_expected.to eq("Failure while executing; `badprg arg1 arg2` exited with 17.") }
|
||||||
|
|||||||
@ -137,7 +137,7 @@ describe Formulary do
|
|||||||
|
|
||||||
context "with installed Formula" do
|
context "with installed Formula" do
|
||||||
before do
|
before do
|
||||||
allow(Formulary).to receive(:loader_for).and_call_original
|
allow(described_class).to receive(:loader_for).and_call_original
|
||||||
stub_formula_loader formula("patchelf") { url "patchelf-1.0" }
|
stub_formula_loader formula("patchelf") { url "patchelf-1.0" }
|
||||||
allow(Formula["patchelf"]).to receive(:installed?).and_return(true)
|
allow(Formula["patchelf"]).to receive(:installed?).and_return(true)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
require "linkage_cache_store"
|
require "linkage_cache_store"
|
||||||
|
|
||||||
describe LinkageCacheStore do
|
describe LinkageCacheStore do
|
||||||
|
subject { described_class.new(keg_name, database) }
|
||||||
|
|
||||||
let(:keg_name) { "keg_name" }
|
let(:keg_name) { "keg_name" }
|
||||||
let(:database) { double("database") }
|
let(:database) { double("database") }
|
||||||
|
|
||||||
subject { LinkageCacheStore.new(keg_name, database) }
|
|
||||||
|
|
||||||
describe "#keg_exists?" do
|
describe "#keg_exists?" do
|
||||||
context "`keg_name` exists in cache" do
|
context "`keg_name` exists in cache" do
|
||||||
before(:each) do
|
before do
|
||||||
expect(database).to receive(:get).with(keg_name).and_return("")
|
expect(database).to receive(:get).with(keg_name).and_return("")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ describe LinkageCacheStore do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "`keg_name` does not exist in cache" do
|
context "`keg_name` does not exist in cache" do
|
||||||
before(:each) do
|
before do
|
||||||
expect(database).to receive(:get).with(keg_name).and_return(nil)
|
expect(database).to receive(:get).with(keg_name).and_return(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ describe LinkageCacheStore do
|
|||||||
|
|
||||||
describe "#fetch_type" do
|
describe "#fetch_type" do
|
||||||
context "`HASH_LINKAGE_TYPES.include?(type)`" do
|
context "`HASH_LINKAGE_TYPES.include?(type)`" do
|
||||||
before(:each) do
|
before do
|
||||||
expect(database).to receive(:get).with(keg_name).and_return(nil)
|
expect(database).to receive(:get).with(keg_name).and_return(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ require "messages"
|
|||||||
require "spec_helper"
|
require "spec_helper"
|
||||||
|
|
||||||
describe Messages do
|
describe Messages do
|
||||||
let(:messages) { Messages.new }
|
let(:messages) { described_class.new }
|
||||||
let(:test_formula) { formula("foo") { url("https://example.com/foo-0.1.tgz") } }
|
let(:test_formula) { formula("foo") { url("https://example.com/foo-0.1.tgz") } }
|
||||||
let(:elapsed_time) { 1.1 }
|
let(:elapsed_time) { 1.1 }
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ describe Messages do
|
|||||||
it "increases the formula count" do
|
it "increases the formula count" do
|
||||||
expect {
|
expect {
|
||||||
messages.formula_installed(test_formula, elapsed_time)
|
messages.formula_installed(test_formula, elapsed_time)
|
||||||
}.to change { messages.formula_count }.by(1)
|
}.to change(messages, :formula_count).by(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "adds to install_times" do
|
it "adds to install_times" do
|
||||||
|
|||||||
@ -24,24 +24,24 @@ describe OS::Mac do
|
|||||||
it "calls sdk_path on Xcode-only systems" do
|
it "calls sdk_path on Xcode-only systems" do
|
||||||
allow(OS::Mac::Xcode).to receive(:installed?).and_return(true)
|
allow(OS::Mac::Xcode).to receive(:installed?).and_return(true)
|
||||||
allow(OS::Mac::CLT).to receive(:installed?).and_return(false)
|
allow(OS::Mac::CLT).to receive(:installed?).and_return(false)
|
||||||
expect(OS::Mac).to receive(:sdk_path)
|
expect(described_class).to receive(:sdk_path)
|
||||||
OS::Mac.sdk_path_if_needed
|
described_class.sdk_path_if_needed
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not call sdk_path on Xcode-and-CLT systems with system headers" do
|
it "does not call sdk_path on Xcode-and-CLT systems with system headers" do
|
||||||
allow(OS::Mac::Xcode).to receive(:installed?).and_return(true)
|
allow(OS::Mac::Xcode).to receive(:installed?).and_return(true)
|
||||||
allow(OS::Mac::CLT).to receive(:installed?).and_return(true)
|
allow(OS::Mac::CLT).to receive(:installed?).and_return(true)
|
||||||
allow(OS::Mac::CLT).to receive(:separate_header_package?).and_return(false)
|
allow(OS::Mac::CLT).to receive(:separate_header_package?).and_return(false)
|
||||||
expect(OS::Mac).not_to receive(:sdk_path)
|
expect(described_class).not_to receive(:sdk_path)
|
||||||
OS::Mac.sdk_path_if_needed
|
described_class.sdk_path_if_needed
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not call sdk_path on CLT-only systems with no CLT SDK" do
|
it "does not call sdk_path on CLT-only systems with no CLT SDK" do
|
||||||
allow(OS::Mac::Xcode).to receive(:installed?).and_return(false)
|
allow(OS::Mac::Xcode).to receive(:installed?).and_return(false)
|
||||||
allow(OS::Mac::CLT).to receive(:installed?).and_return(true)
|
allow(OS::Mac::CLT).to receive(:installed?).and_return(true)
|
||||||
allow(OS::Mac::CLT).to receive(:provides_sdk?).and_return(false)
|
allow(OS::Mac::CLT).to receive(:provides_sdk?).and_return(false)
|
||||||
expect(OS::Mac).not_to receive(:sdk_path)
|
expect(described_class).not_to receive(:sdk_path)
|
||||||
OS::Mac.sdk_path_if_needed
|
described_class.sdk_path_if_needed
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not call sdk_path on CLT-only systems with a CLT SDK if the system provides headers" do
|
it "does not call sdk_path on CLT-only systems with a CLT SDK if the system provides headers" do
|
||||||
@ -49,8 +49,8 @@ describe OS::Mac do
|
|||||||
allow(OS::Mac::CLT).to receive(:installed?).and_return(true)
|
allow(OS::Mac::CLT).to receive(:installed?).and_return(true)
|
||||||
allow(OS::Mac::CLT).to receive(:provides_sdk?).and_return(true)
|
allow(OS::Mac::CLT).to receive(:provides_sdk?).and_return(true)
|
||||||
allow(OS::Mac::CLT).to receive(:separate_header_package?).and_return(false)
|
allow(OS::Mac::CLT).to receive(:separate_header_package?).and_return(false)
|
||||||
expect(OS::Mac).not_to receive(:sdk_path)
|
expect(described_class).not_to receive(:sdk_path)
|
||||||
OS::Mac.sdk_path_if_needed
|
described_class.sdk_path_if_needed
|
||||||
end
|
end
|
||||||
|
|
||||||
it "calls sdk_path on CLT-only systems with a CLT SDK if the system does not provide headers" do
|
it "calls sdk_path on CLT-only systems with a CLT SDK if the system does not provide headers" do
|
||||||
@ -58,8 +58,8 @@ describe OS::Mac do
|
|||||||
allow(OS::Mac::CLT).to receive(:installed?).and_return(true)
|
allow(OS::Mac::CLT).to receive(:installed?).and_return(true)
|
||||||
allow(OS::Mac::CLT).to receive(:provides_sdk?).and_return(true)
|
allow(OS::Mac::CLT).to receive(:provides_sdk?).and_return(true)
|
||||||
allow(OS::Mac::CLT).to receive(:separate_header_package?).and_return(true)
|
allow(OS::Mac::CLT).to receive(:separate_header_package?).and_return(true)
|
||||||
expect(OS::Mac).to receive(:sdk_path)
|
expect(described_class).to receive(:sdk_path)
|
||||||
OS::Mac.sdk_path_if_needed
|
described_class.sdk_path_if_needed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,15 +1,16 @@
|
|||||||
require "system_command"
|
require "system_command"
|
||||||
|
|
||||||
describe SystemCommand::Result do
|
describe SystemCommand::Result do
|
||||||
|
subject(:result) {
|
||||||
|
described_class.new([], output_array, instance_double(Process::Status, exitstatus: 0, success?: true))
|
||||||
|
}
|
||||||
|
|
||||||
let(:output_array) {
|
let(:output_array) {
|
||||||
[
|
[
|
||||||
[:stdout, "output\n"],
|
[:stdout, "output\n"],
|
||||||
[:stderr, "error\n"],
|
[:stderr, "error\n"],
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
subject(:result) {
|
|
||||||
described_class.new([], output_array, instance_double(Process::Status, exitstatus: 0, success?: true))
|
|
||||||
}
|
|
||||||
|
|
||||||
describe "#to_ary" do
|
describe "#to_ary" do
|
||||||
it "can be destructed like `Open3.capture3`" do
|
it "can be destructed like `Open3.capture3`" do
|
||||||
@ -41,6 +42,7 @@ describe SystemCommand::Result do
|
|||||||
|
|
||||||
describe "#plist" do
|
describe "#plist" do
|
||||||
subject { result.plist }
|
subject { result.plist }
|
||||||
|
|
||||||
let(:output_array) { [[:stdout, stdout]] }
|
let(:output_array) { [[:stdout, stdout]] }
|
||||||
let(:garbage) {
|
let(:garbage) {
|
||||||
<<~EOS
|
<<~EOS
|
||||||
@ -114,7 +116,7 @@ describe SystemCommand::Result do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when verbose" do
|
context "when verbose" do
|
||||||
before(:each) do
|
before do
|
||||||
allow(ARGV).to receive(:verbose?).and_return(true)
|
allow(ARGV).to receive(:verbose?).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -138,7 +140,7 @@ describe SystemCommand::Result do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when verbose" do
|
context "when verbose" do
|
||||||
before(:each) do
|
before do
|
||||||
allow(ARGV).to receive(:verbose?).and_return(true)
|
allow(ARGV).to receive(:verbose?).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
describe SystemCommand do
|
describe SystemCommand do
|
||||||
describe "#initialize" do
|
describe "#initialize" do
|
||||||
let(:env_args) { ["bash", "-c", 'printf "%s" "${A?}" "${B?}" "${C?}"'] }
|
|
||||||
let(:env) { { "A" => "1", "B" => "2", "C" => "3" } }
|
|
||||||
let(:sudo) { false }
|
|
||||||
|
|
||||||
subject(:command) {
|
subject(:command) {
|
||||||
described_class.new(
|
described_class.new(
|
||||||
"env",
|
"env",
|
||||||
@ -14,6 +10,10 @@ describe SystemCommand do
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let(:env_args) { ["bash", "-c", 'printf "%s" "${A?}" "${B?}" "${C?}"'] }
|
||||||
|
let(:env) { { "A" => "1", "B" => "2", "C" => "3" } }
|
||||||
|
let(:sudo) { false }
|
||||||
|
|
||||||
context "when given some environment variables" do
|
context "when given some environment variables" do
|
||||||
its("run!.stdout") { is_expected.to eq("123") }
|
its("run!.stdout") { is_expected.to eq("123") }
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ describe SystemCommand do
|
|||||||
context "when given an executable with spaces and no arguments" do
|
context "when given an executable with spaces and no arguments" do
|
||||||
let(:executable) { mktmpdir/"App Uninstaller" }
|
let(:executable) { mktmpdir/"App Uninstaller" }
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
executable.write <<~SH
|
executable.write <<~SH
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
true
|
true
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
require_relative "shared_examples"
|
require_relative "shared_examples"
|
||||||
|
|
||||||
describe UnpackStrategy::Directory do
|
describe UnpackStrategy::Directory do
|
||||||
|
subject(:strategy) { described_class.new(path) }
|
||||||
|
|
||||||
let(:path) {
|
let(:path) {
|
||||||
mktmpdir.tap do |path|
|
mktmpdir.tap do |path|
|
||||||
FileUtils.touch path/"file"
|
FileUtils.touch path/"file"
|
||||||
FileUtils.ln_s "file", path/"symlink"
|
FileUtils.ln_s "file", path/"symlink"
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
subject(:strategy) { described_class.new(path) }
|
|
||||||
let(:unpack_dir) { mktmpdir }
|
let(:unpack_dir) { mktmpdir }
|
||||||
|
|
||||||
it "does not follow symlinks" do
|
it "does not follow symlinks" do
|
||||||
|
|||||||
@ -5,7 +5,7 @@ describe UnpackStrategy::Subversion, :needs_svn do
|
|||||||
let(:working_copy) { mktmpdir }
|
let(:working_copy) { mktmpdir }
|
||||||
let(:path) { working_copy }
|
let(:path) { working_copy }
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
system "svnadmin", "create", repo
|
system "svnadmin", "create", repo
|
||||||
|
|
||||||
system "svn", "checkout", "file://#{repo}", working_copy
|
system "svn", "checkout", "file://#{repo}", working_copy
|
||||||
|
|||||||
@ -12,7 +12,7 @@ describe UpdateMigrator do
|
|||||||
let(:old_cache_file) { HOMEBREW_CACHE/"#{formula_name}-1.2.3.tar.gz" }
|
let(:old_cache_file) { HOMEBREW_CACHE/"#{formula_name}-1.2.3.tar.gz" }
|
||||||
let(:new_cache_file) { HOMEBREW_CACHE/"#{formula_name}--1.2.3.tar.gz" }
|
let(:new_cache_file) { HOMEBREW_CACHE/"#{formula_name}--1.2.3.tar.gz" }
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
FileUtils.touch old_cache_file
|
FileUtils.touch old_cache_file
|
||||||
allow(Formula).to receive(:each).and_yield(f)
|
allow(Formula).to receive(:each).and_yield(f)
|
||||||
end
|
end
|
||||||
@ -58,7 +58,7 @@ describe UpdateMigrator do
|
|||||||
HOMEBREW_CACHE/"downloads/5994e3a27baa3f448a001fb071ab1f0bf25c87aebcb254d91a6d0b02f46eef86--foo-1.2.3.tar.gz"
|
HOMEBREW_CACHE/"downloads/5994e3a27baa3f448a001fb071ab1f0bf25c87aebcb254d91a6d0b02f46eef86--foo-1.2.3.tar.gz"
|
||||||
}
|
}
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
old_cache_file.dirname.mkpath
|
old_cache_file.dirname.mkpath
|
||||||
FileUtils.touch old_cache_file
|
FileUtils.touch old_cache_file
|
||||||
allow(Formula).to receive(:[]).and_return(f)
|
allow(Formula).to receive(:[]).and_return(f)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ describe Utils::Analytics do
|
|||||||
|
|
||||||
it "returns OS_VERSION and prefix when HOMEBREW_PREFIX is a custom prefix" do
|
it "returns OS_VERSION and prefix when HOMEBREW_PREFIX is a custom prefix" do
|
||||||
stub_const("HOMEBREW_PREFIX", "blah")
|
stub_const("HOMEBREW_PREFIX", "blah")
|
||||||
expect(described_class.os_prefix_ci).to include("#{OS_VERSION}, #{Utils::Analytics.custom_prefix_label}")
|
expect(described_class.os_prefix_ci).to include("#{OS_VERSION}, #{described_class.custom_prefix_label}")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "includes CI when ENV['CI'] is set" do
|
it "includes CI when ENV['CI'] is set" do
|
||||||
@ -20,7 +20,7 @@ describe Utils::Analytics do
|
|||||||
|
|
||||||
it "does not include prefix when HOMEBREW_PREFIX is the default prefix" do
|
it "does not include prefix when HOMEBREW_PREFIX is the default prefix" do
|
||||||
stub_const("HOMEBREW_PREFIX", Homebrew::DEFAULT_PREFIX)
|
stub_const("HOMEBREW_PREFIX", Homebrew::DEFAULT_PREFIX)
|
||||||
expect(described_class.os_prefix_ci).not_to include(Utils::Analytics.custom_prefix_label)
|
expect(described_class.os_prefix_ci).not_to include(described_class.custom_prefix_label)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -9,7 +9,7 @@ describe "curl" do
|
|||||||
|
|
||||||
it "doesn't return -q as the first argument when HOMEBREW_CURLRC is set" do
|
it "doesn't return -q as the first argument when HOMEBREW_CURLRC is set" do
|
||||||
ENV["HOMEBREW_CURLRC"] = "1"
|
ENV["HOMEBREW_CURLRC"] = "1"
|
||||||
expect(curl_args("foo").first).to_not eq("-q")
|
expect(curl_args("foo").first).not_to eq("-q")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -464,8 +464,6 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
|
|||||||
If `--display-cop-names` is passed, include the RuboCop cop name for each
|
If `--display-cop-names` is passed, include the RuboCop cop name for each
|
||||||
violation in the output.
|
violation in the output.
|
||||||
|
|
||||||
If `--rspec` is passed, install and use the RuboCop RSpec gem.
|
|
||||||
|
|
||||||
Passing `--only-cops=``cops` will check for violations of only the listed
|
Passing `--only-cops=``cops` will check for violations of only the listed
|
||||||
RuboCop `cops`, while `--except-cops=``cops` will skip checking the listed
|
RuboCop `cops`, while `--except-cops=``cops` will skip checking the listed
|
||||||
`cops`. For either option `cops` should be a comma-separated list of cop names.
|
`cops`. For either option `cops` should be a comma-separated list of cop names.
|
||||||
|
|||||||
@ -425,9 +425,6 @@ If \fB\-\-fix\fR is passed, automatically fix style violations using RuboCop\'s
|
|||||||
If \fB\-\-display\-cop\-names\fR is passed, include the RuboCop cop name for each violation in the output\.
|
If \fB\-\-display\-cop\-names\fR is passed, include the RuboCop cop name for each violation in the output\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
If \fB\-\-rspec\fR is passed, install and use the RuboCop RSpec gem\.
|
|
||||||
.
|
|
||||||
.IP
|
|
||||||
Passing \fB\-\-only\-cops=\fR\fIcops\fR will check for violations of only the listed RuboCop \fIcops\fR, while \fB\-\-except\-cops=\fR\fIcops\fR will skip checking the listed \fIcops\fR\. For either option \fIcops\fR should be a comma\-separated list of cop names\.
|
Passing \fB\-\-only\-cops=\fR\fIcops\fR will check for violations of only the listed RuboCop \fIcops\fR, while \fB\-\-except\-cops=\fR\fIcops\fR will skip checking the listed \fIcops\fR\. For either option \fIcops\fR should be a comma\-separated list of cop names\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user