Clear all tap caches before each test.
This commit is contained in:
parent
ab27efbd9d
commit
9cfc7ef9bd
@ -1,13 +1,13 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
RSpec.describe Cask::CaskLoader::FromTapLoader do
|
RSpec.describe Cask::CaskLoader::FromTapLoader do
|
||||||
|
let(:tap) { CoreCaskTap.instance }
|
||||||
let(:cask_name) { "testball" }
|
let(:cask_name) { "testball" }
|
||||||
let(:cask_full_name) { "homebrew/cask/#{cask_name}" }
|
let(:cask_full_name) { "homebrew/cask/#{cask_name}" }
|
||||||
let(:cask_path) { CoreCaskTap.instance.cask_dir/"#{cask_name}.rb" }
|
let(:cask_path) { tap.cask_dir/"#{cask_name}.rb" }
|
||||||
|
|
||||||
describe "#load" do
|
describe "#load" do
|
||||||
before do
|
before do
|
||||||
CoreCaskTap.instance.clear_cache
|
|
||||||
cask_path.parent.mkpath
|
cask_path.parent.mkpath
|
||||||
cask_path.write <<~RUBY
|
cask_path.write <<~RUBY
|
||||||
cask '#{cask_name}' do
|
cask '#{cask_name}' do
|
||||||
@ -25,7 +25,7 @@ RSpec.describe Cask::CaskLoader::FromTapLoader do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "with sharded Cask directory" do
|
context "with sharded Cask directory" do
|
||||||
let(:cask_path) { CoreCaskTap.instance.cask_dir/cask_name[0]/"#{cask_name}.rb" }
|
let(:cask_path) { tap.cask_dir/cask_name[0]/"#{cask_name}.rb" }
|
||||||
|
|
||||||
it "returns a Cask" do
|
it "returns a Cask" do
|
||||||
expect(described_class.new(cask_full_name).load(config: nil)).to be_a(Cask::Cask)
|
expect(described_class.new(cask_full_name).load(config: nil)).to be_a(Cask::Cask)
|
||||||
|
|||||||
@ -84,8 +84,6 @@ RSpec.describe Cask::CaskLoader, :cask do
|
|||||||
|
|
||||||
before do
|
before do
|
||||||
(old_tap.path/"tap_migrations.json").write tap_migrations.to_json
|
(old_tap.path/"tap_migrations.json").write tap_migrations.to_json
|
||||||
old_tap.clear_cache
|
|
||||||
default_tap.clear_cache
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not warn when loading the short token" do
|
it "does not warn when loading the short token" do
|
||||||
@ -112,7 +110,6 @@ RSpec.describe Cask::CaskLoader, :cask do
|
|||||||
# (default_tap.path/"tap_migrations.json").write({
|
# (default_tap.path/"tap_migrations.json").write({
|
||||||
# token => old_tap.name,
|
# token => old_tap.name,
|
||||||
# }.to_json)
|
# }.to_json)
|
||||||
# default_tap.clear_cache
|
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# it "stops recursing" do
|
# it "stops recursing" do
|
||||||
|
|||||||
@ -547,8 +547,6 @@ RSpec.describe Formulary do
|
|||||||
before do
|
before do
|
||||||
old_tap.path.mkpath
|
old_tap.path.mkpath
|
||||||
(old_tap.path/"tap_migrations.json").write tap_migrations.to_json
|
(old_tap.path/"tap_migrations.json").write tap_migrations.to_json
|
||||||
old_tap.clear_cache
|
|
||||||
default_tap.clear_cache
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not warn when loading the short token" do
|
it "does not warn when loading the short token" do
|
||||||
@ -575,7 +573,6 @@ RSpec.describe Formulary do
|
|||||||
# (default_tap.path/"tap_migrations.json").write({
|
# (default_tap.path/"tap_migrations.json").write({
|
||||||
# token => old_tap.name,
|
# token => old_tap.name,
|
||||||
# }.to_json)
|
# }.to_json)
|
||||||
# default_tap.clear_cache
|
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# it "stops recursing" do
|
# it "stops recursing" do
|
||||||
|
|||||||
@ -203,6 +203,7 @@ RSpec.configure do |config|
|
|||||||
Homebrew.raise_deprecation_exceptions = true
|
Homebrew.raise_deprecation_exceptions = true
|
||||||
|
|
||||||
Formulary.clear_cache
|
Formulary.clear_cache
|
||||||
|
Tap.each(&:clear_cache)
|
||||||
Tap.clear_cache
|
Tap.clear_cache
|
||||||
DependencyCollector.clear_cache
|
DependencyCollector.clear_cache
|
||||||
Formula.clear_cache
|
Formula.clear_cache
|
||||||
@ -249,6 +250,9 @@ RSpec.configure do |config|
|
|||||||
rescue SystemExit => e
|
rescue SystemExit => e
|
||||||
example.example.set_exception(e)
|
example.example.set_exception(e)
|
||||||
ensure
|
ensure
|
||||||
|
# This depends on `HOMEBREW_NO_INSTALL_FROM_API`.
|
||||||
|
Tap.each(&:clear_cache)
|
||||||
|
|
||||||
ENV.replace(@__env)
|
ENV.replace(@__env)
|
||||||
Context.current = Context::ContextStruct.new
|
Context.current = Context::ContextStruct.new
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user