language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | Homebrew | brew | 82e6070ca045001eab7aec0ba9b85dbca48615f8.json | Convert Search test to spec. | Library/Homebrew/cask/test/cask/cli/search_test.rb | @@ -1,59 +0,0 @@
-require "test_helper"
-
-describe Hbc::CLI::Search do
- it "lists the available Casks that match the search term" do
- lambda {
- Hbc::CLI::Search.run("photoshop")
- }.must_output <<-EOS.undent
- ==> Partial matches
- adobe-photoshop-cc
- adobe-photoshop-lightroom
- EOS
- end
-
- it "shows that there are no Casks matching a search term that did not result in anything" do
- lambda {
- Hbc::CLI::Search.run("foo-bar-baz")
- }.must_output("No Cask found for \"foo-bar-baz\".\n")
- end
-
- it "lists all available Casks with no search term" do
- out = capture_io { Hbc::CLI::Search.run }[0]
- out.must_match(/google-chrome/)
- out.length.must_be :>, 1000
- end
-
- it "ignores hyphens in search terms" do
- out = capture_io { Hbc::CLI::Search.run("goo-gle-chrome") }[0]
- out.must_match(/google-chrome/)
- out.length.must_be :<, 100
- end
-
- it "ignores hyphens in Cask tokens" do
- out = capture_io { Hbc::CLI::Search.run("googlechrome") }[0]
- out.must_match(/google-chrome/)
- out.length.must_be :<, 100
- end
-
- it "accepts multiple arguments" do
- out = capture_io { Hbc::CLI::Search.run("google chrome") }[0]
- out.must_match(/google-chrome/)
- out.length.must_be :<, 100
- end
-
- it "accepts a regexp argument" do
- lambda {
- Hbc::CLI::Search.run("/^google-c[a-z]rome$/")
- }.must_output "==> Regexp matches\ngoogle-chrome\n"
- end
-
- it "Returns both exact and partial matches" do
- out = capture_io { Hbc::CLI::Search.run("mnemosyne") }[0]
- out.must_match(/^==> Exact match\nmnemosyne\n==> Partial matches\nsubclassed-mnemosyne/)
- end
-
- it "does not search the Tap name" do
- out = capture_io { Hbc::CLI::Search.run("caskroom") }[0]
- out.must_match(/^No Cask found for "caskroom"\.\n/)
- end
-end | true |
Other | Homebrew | brew | 20b77dfdcc4332f1d21e39571e1bbc7eefc6d4dd.json | Convert Reinstall test to spec. | Library/Homebrew/cask/spec/cask/cli/reinstall_spec.rb | @@ -0,0 +1,24 @@
+require "spec_helper"
+
+describe Hbc::CLI::Reinstall do
+ it "allows reinstalling a Cask" do
+ shutup do
+ Hbc::CLI::Install.run("local-transmission")
+ end
+ expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
+
+ shutup do
+ Hbc::CLI::Reinstall.run("local-transmission")
+ end
+ expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
+ end
+
+ it "allows reinstalling a non installed Cask" do
+ expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).not_to be_installed
+
+ shutup do
+ Hbc::CLI::Reinstall.run("local-transmission")
+ end
+ expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
+ end
+end | true |
Other | Homebrew | brew | 20b77dfdcc4332f1d21e39571e1bbc7eefc6d4dd.json | Convert Reinstall test to spec. | Library/Homebrew/cask/test/cask/cli/reinstall_test.rb | @@ -1,24 +0,0 @@
-require "test_helper"
-
-describe Hbc::CLI::Reinstall do
- it "allows reinstalling a Cask" do
- shutup do
- Hbc::CLI::Install.run("local-transmission")
- end
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").must_be :installed?
-
- shutup do
- Hbc::CLI::Reinstall.run("local-transmission")
- end
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").must_be :installed?
- end
-
- it "allows reinstalling a non installed Cask" do
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").wont_be :installed?
-
- shutup do
- Hbc::CLI::Reinstall.run("local-transmission")
- end
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").must_be :installed?
- end
-end | true |
Other | Homebrew | brew | 7b2d8ed4b3a1a71da59b1aa1859e844c37ba24c2.json | Convert Options test to spec. | Library/Homebrew/cask/spec/cask/cli/options_spec.rb | @@ -1,144 +1,140 @@
-require "test_helper"
+require "spec_helper"
describe Hbc::CLI do
it "supports setting the appdir" do
Hbc::CLI.process_options %w[help --appdir=/some/path/foo]
- Hbc.appdir.must_equal Pathname("/some/path/foo")
+ expect(Hbc.appdir).to eq(Pathname.new("/some/path/foo"))
end
it "supports setting the appdir from ENV" do
ENV["HOMEBREW_CASK_OPTS"] = "--appdir=/some/path/bar"
Hbc::CLI.process_options %w[help]
- Hbc.appdir.must_equal Pathname("/some/path/bar")
+ expect(Hbc.appdir).to eq(Pathname.new("/some/path/bar"))
end
it "supports setting the prefpanedir" do
Hbc::CLI.process_options %w[help --prefpanedir=/some/path/foo]
- Hbc.prefpanedir.must_equal Pathname("/some/path/foo")
+ expect(Hbc.prefpanedir).to eq(Pathname.new("/some/path/foo"))
end
it "supports setting the prefpanedir from ENV" do
ENV["HOMEBREW_CASK_OPTS"] = "--prefpanedir=/some/path/bar"
Hbc::CLI.process_options %w[help]
- Hbc.prefpanedir.must_equal Pathname("/some/path/bar")
+ expect(Hbc.prefpanedir).to eq(Pathname.new("/some/path/bar"))
end
it "supports setting the qlplugindir" do
Hbc::CLI.process_options %w[help --qlplugindir=/some/path/foo]
- Hbc.qlplugindir.must_equal Pathname("/some/path/foo")
+ expect(Hbc.qlplugindir).to eq(Pathname.new("/some/path/foo"))
end
it "supports setting the qlplugindir from ENV" do
ENV["HOMEBREW_CASK_OPTS"] = "--qlplugindir=/some/path/bar"
Hbc::CLI.process_options %w[help]
- Hbc.qlplugindir.must_equal Pathname("/some/path/bar")
+ expect(Hbc.qlplugindir).to eq(Pathname.new("/some/path/bar"))
end
it "supports setting the colorpickerdir" do
Hbc::CLI.process_options %w[help --colorpickerdir=/some/path/foo]
- Hbc.colorpickerdir.must_equal Pathname("/some/path/foo")
+ expect(Hbc.colorpickerdir).to eq(Pathname.new("/some/path/foo"))
end
it "supports setting the colorpickerdir from ENV" do
ENV["HOMEBREW_CASK_OPTS"] = "--colorpickerdir=/some/path/bar"
Hbc::CLI.process_options %w[help]
- Hbc.colorpickerdir.must_equal Pathname("/some/path/bar")
+ expect(Hbc.colorpickerdir).to eq(Pathname.new("/some/path/bar"))
end
it "supports setting the dictionarydir" do
Hbc::CLI.process_options %w[help --dictionarydir=/some/path/foo]
- Hbc.dictionarydir.must_equal Pathname("/some/path/foo")
+ expect(Hbc.dictionarydir).to eq(Pathname.new("/some/path/foo"))
end
it "supports setting the dictionarydir from ENV" do
ENV["HOMEBREW_CASK_OPTS"] = "--dictionarydir=/some/path/bar"
Hbc::CLI.process_options %w[help]
- Hbc.dictionarydir.must_equal Pathname("/some/path/bar")
+ expect(Hbc.dictionarydir).to eq(Pathname.new("/some/path/bar"))
end
it "supports setting the fontdir" do
Hbc::CLI.process_options %w[help --fontdir=/some/path/foo]
- Hbc.fontdir.must_equal Pathname("/some/path/foo")
+ expect(Hbc.fontdir).to eq(Pathname.new("/some/path/foo"))
end
it "supports setting the fontdir from ENV" do
ENV["HOMEBREW_CASK_OPTS"] = "--fontdir=/some/path/bar"
Hbc::CLI.process_options %w[help]
- Hbc.fontdir.must_equal Pathname("/some/path/bar")
+ expect(Hbc.fontdir).to eq(Pathname.new("/some/path/bar"))
end
it "supports setting the servicedir" do
Hbc::CLI.process_options %w[help --servicedir=/some/path/foo]
- Hbc.servicedir.must_equal Pathname("/some/path/foo")
+ expect(Hbc.servicedir).to eq(Pathname.new("/some/path/foo"))
end
it "supports setting the servicedir from ENV" do
ENV["HOMEBREW_CASK_OPTS"] = "--servicedir=/some/path/bar"
Hbc::CLI.process_options %w[help]
- Hbc.servicedir.must_equal Pathname("/some/path/bar")
+ expect(Hbc.servicedir).to eq(Pathname.new("/some/path/bar"))
end
it "allows additional options to be passed through" do
rest = Hbc::CLI.process_options %w[edit foo --create --appdir=/some/path/qux]
- Hbc.appdir.must_equal Pathname("/some/path/qux")
- rest.must_equal %w[edit foo --create]
+ expect(Hbc.appdir).to eq(Pathname.new("/some/path/qux"))
+ expect(rest).to eq(%w[edit foo --create])
end
describe "when a mandatory argument is missing" do
it "shows a user-friendly error message" do
- lambda {
+ expect {
Hbc::CLI.process_options %w[install -f]
- }.must_raise Hbc::CaskError
+ }.to raise_error(Hbc::CaskError)
end
end
describe "given an ambiguous option" do
it "shows a user-friendly error message" do
- lambda {
+ expect {
Hbc::CLI.process_options %w[edit -c]
- }.must_raise Hbc::CaskError
+ }.to raise_error(Hbc::CaskError)
end
end
describe "--debug" do
it "sets the Cask debug method to true" do
Hbc::CLI.process_options %w[help --debug]
- Hbc.debug.must_equal true
+ expect(Hbc.debug).to be true
Hbc.debug = false
end
end
describe "--help" do
it "sets the Cask help method to true" do
Hbc::CLI.process_options %w[foo --help]
- Hbc.help.must_equal true
+ expect(Hbc.help).to be true
Hbc.help = false
end
end
-
- after do
- ENV["HOMEBREW_CASK_OPTS"] = nil
- end
end | true |
Other | Homebrew | brew | 7b2d8ed4b3a1a71da59b1aa1859e844c37ba24c2.json | Convert Options test to spec. | Library/Homebrew/cask/spec/spec_helper.rb | @@ -37,11 +37,33 @@
RSpec.configure do |config|
config.order = :random
config.include(Test::Helper::Shutup)
- config.after(:each) do
- FileUtils.rm_rf [
- Hbc.appdir.children,
- Hbc.caskroom.children,
- ]
+ config.around(:each) do |example|
+ begin
+ @__appdir = Hbc.appdir
+ @__caskroom = Hbc.caskroom
+ @__prefpanedir = Hbc.prefpanedir
+ @__qlplugindir = Hbc.qlplugindir
+ @__servicedir = Hbc.servicedir
+
+ @__argv = ARGV.dup
+ @__env = ENV.to_hash # dup doesn't work on ENV
+
+ example.run
+ ensure
+ ARGV.replace(@__argv)
+ ENV.replace(@__env)
+
+ Hbc.appdir = @__appdir
+ Hbc.caskroom = @__caskroom
+ Hbc.prefpanedir = @__prefpanedir
+ Hbc.qlplugindir = @__qlplugindir
+ Hbc.servicedir = @__servicedir
+
+ FileUtils.rm_rf [
+ Hbc.appdir.children,
+ Hbc.caskroom.children,
+ ]
+ end
end
end
| true |
Other | Homebrew | brew | cd4705b7bca5f266907ea6424d721190617edbcd.json | Convert Install test to spec. | Library/Homebrew/cask/spec/cask/cli/install_spec.rb | @@ -1,15 +1,15 @@
-require "test_helper"
+require "spec_helper"
describe Hbc::CLI::Install do
it "allows staging and activation of multiple Casks at once" do
shutup do
Hbc::CLI::Install.run("local-transmission", "local-caffeine")
end
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").must_be :installed?
- Hbc.appdir.join("Transmission.app").must_be :directory?
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb").must_be :installed?
- Hbc.appdir.join("Caffeine.app").must_be :directory?
+ expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
+ expect(Hbc.appdir.join("Transmission.app")).to be_a_directory
+ expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")).to be_installed
+ expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory
end
it "skips double install (without nuking existing installation)" do
@@ -19,72 +19,74 @@
shutup do
Hbc::CLI::Install.run("local-transmission")
end
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").must_be :installed?
+ expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).to be_installed
end
it "prints a warning message on double install" do
shutup do
Hbc::CLI::Install.run("local-transmission")
end
- lambda {
+ expect {
Hbc::CLI::Install.run("local-transmission", "")
- }.must_output nil, /Warning: A Cask for local-transmission is already installed./
+ }.to output(/Warning: A Cask for local-transmission is already installed./).to_stderr
end
it "allows double install with --force" do
shutup do
Hbc::CLI::Install.run("local-transmission")
end
- lambda {
- Hbc::CLI::Install.run("local-transmission", "--force")
- }.must_output(/local-transmission was successfully installed!/)
+ expect {
+ expect {
+ Hbc::CLI::Install.run("local-transmission", "--force")
+ }.to output(/It seems there is already an App at.*overwriting\./).to_stderr
+ }.to output(/local-transmission was successfully installed!/).to_stdout
end
it "skips dependencies with --skip-cask-deps" do
shutup do
Hbc::CLI::Install.run("with-depends-on-cask-multiple", "--skip-cask-deps")
end
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-multiple.rb").must_be :installed?
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb").wont_be :installed?
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").wont_be :installed?
+ expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-multiple.rb")).to be_installed
+ expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")).not_to be_installed
+ expect(Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")).not_to be_installed
end
it "properly handles Casks that are not present" do
- lambda {
+ expect {
shutup do
Hbc::CLI::Install.run("notacask")
end
- }.must_raise Hbc::CaskError
+ }.to raise_error(Hbc::CaskError)
end
it "returns a suggestion for a misspelled Cask" do
- lambda {
+ expect {
begin
Hbc::CLI::Install.run("googlechrome")
rescue Hbc::CaskError
nil
end
- }.must_output(nil, /No available Cask for googlechrome\. Did you mean:\ngoogle-chrome/)
+ }.to output(/No available Cask for googlechrome\. Did you mean:\ngoogle-chrome/).to_stderr
end
it "returns multiple suggestions for a Cask fragment" do
- lambda {
+ expect {
begin
Hbc::CLI::Install.run("google")
rescue Hbc::CaskError
nil
end
- }.must_output(nil, /No available Cask for google\. Did you mean one of:\ngoogle/)
+ }.to output(/No available Cask for google\. Did you mean one of:\ngoogle/).to_stderr
end
describe "when no Cask is specified" do
with_options = lambda do |options|
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Install.run(*options)
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
| true |
Other | Homebrew | brew | cd4705b7bca5f266907ea6424d721190617edbcd.json | Convert Install test to spec. | Library/Homebrew/cask/spec/spec_helper.rb | @@ -31,6 +31,9 @@
FileUtils.ln_s TEST_FIXTURE_DIR.join("cask"), tap.path
end
+# pretend that the caskroom/cask Tap is installed
+FileUtils.ln_s Pathname.new(ENV["HOMEBREW_LIBRARY"]).join("Taps", "caskroom", "homebrew-cask"), Tap.fetch("caskroom", "cask").path
+
RSpec.configure do |config|
config.order = :random
config.include(Test::Helper::Shutup) | true |
Other | Homebrew | brew | 9d36734e40c064efc48a58d28da9b23c9158dedc.json | Convert Info test to spec. | Library/Homebrew/cask/spec/cask/cli/info_spec.rb | @@ -1,14 +1,14 @@
-require "test_helper"
+require "spec_helper"
describe Hbc::CLI::Info do
it "displays some nice info about the specified Cask" do
- lambda {
+ expect {
Hbc::CLI::Info.run("local-caffeine")
- }.must_output <<-EOS.undent
+ }.to output(<<-EOS.undent).to_stdout
local-caffeine: 1.2.3
http://example.com/local-caffeine
Not installed
- From: https://github.com/caskroom/homebrew-test/blob/master/Casks/local-caffeine.rb
+ From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/local-caffeine.rb
==> Name
None
==> Artifacts
@@ -17,48 +17,48 @@
end
describe "given multiple Casks" do
- before do
- @expected_output = <<-EOS.undent
+ let(:expected_output) {
+ <<-EOS.undent
local-caffeine: 1.2.3
http://example.com/local-caffeine
Not installed
- From: https://github.com/caskroom/homebrew-test/blob/master/Casks/local-caffeine.rb
+ From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/local-caffeine.rb
==> Name
None
==> Artifacts
Caffeine.app (app)
local-transmission: 2.61
http://example.com/local-transmission
Not installed
- From: https://github.com/caskroom/homebrew-test/blob/master/Casks/local-transmission.rb
+ From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/local-transmission.rb
==> Name
None
==> Artifacts
Transmission.app (app)
EOS
- end
+ }
it "displays the info" do
- lambda {
+ expect {
Hbc::CLI::Info.run("local-caffeine", "local-transmission")
- }.must_output(@expected_output)
+ }.to output(expected_output).to_stdout
end
it "throws away stray options" do
- lambda {
+ expect {
Hbc::CLI::Info.run("--notavalidoption", "local-caffeine", "local-transmission")
- }.must_output(@expected_output)
+ }.to output(expected_output).to_stdout
end
end
it "should print caveats if the Cask provided one" do
- lambda {
+ expect {
Hbc::CLI::Info.run("with-caveats")
- }.must_output <<-EOS.undent
+ }.to output(<<-EOS.undent).to_stdout
with-caveats: 1.2.3
http://example.com/local-caffeine
Not installed
- From: https://github.com/caskroom/homebrew-test/blob/master/Casks/with-caveats.rb
+ From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/with-caveats.rb
==> Name
None
==> Artifacts
@@ -78,13 +78,13 @@
end
it 'should not print "Caveats" section divider if the caveats block has no output' do
- lambda {
+ expect {
Hbc::CLI::Info.run("with-conditional-caveats")
- }.must_output <<-EOS.undent
+ }.to output(<<-EOS.undent).to_stdout
with-conditional-caveats: 1.2.3
http://example.com/local-caffeine
Not installed
- From: https://github.com/caskroom/homebrew-test/blob/master/Casks/with-conditional-caveats.rb
+ From: https://github.com/caskroom/homebrew-spec/blob/master/Casks/with-conditional-caveats.rb
==> Name
None
==> Artifacts
@@ -94,17 +94,17 @@
describe "when no Cask is specified" do
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Info.run
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
describe "when no Cask is specified, but an invalid option" do
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Info.run("--notavalidoption")
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
end | false |
Other | Homebrew | brew | 0daf01681268dd19ee5d154e484b3d97832f9ec9.json | Convert Home test to spec. | Library/Homebrew/cask/spec/cask/cli/home_spec.rb | @@ -1,4 +1,4 @@
-require "test_helper"
+require "spec_helper"
# monkeypatch for testing
module Hbc
@@ -25,23 +25,23 @@ def self.system_commands
end
it "opens the homepage for the specified Cask" do
- Hbc::CLI::Home.run("alfred")
- Hbc::CLI::Home.system_commands.must_equal [
- ["/usr/bin/open", "--", "https://www.alfredapp.com/"],
+ Hbc::CLI::Home.run("local-caffeine")
+ expect(Hbc::CLI::Home.system_commands).to eq [
+ ["/usr/bin/open", "--", "http://example.com/local-caffeine"],
]
end
it "works for multiple Casks" do
- Hbc::CLI::Home.run("alfred", "adium")
- Hbc::CLI::Home.system_commands.must_equal [
- ["/usr/bin/open", "--", "https://www.alfredapp.com/"],
- ["/usr/bin/open", "--", "https://www.adium.im/"],
+ Hbc::CLI::Home.run("local-caffeine", "local-transmission")
+ expect(Hbc::CLI::Home.system_commands).to eq [
+ ["/usr/bin/open", "--", "http://example.com/local-caffeine"],
+ ["/usr/bin/open", "--", "http://example.com/local-transmission"],
]
end
it "opens the project page when no Cask is specified" do
Hbc::CLI::Home.run
- Hbc::CLI::Home.system_commands.must_equal [
+ expect(Hbc::CLI::Home.system_commands).to eq [
["/usr/bin/open", "--", "http://caskroom.io/"],
]
end | false |
Other | Homebrew | brew | e637eb414e880559695a71b3fc1efbc7104ee64e.json | Convert Fetch test to spec. | Library/Homebrew/cask/spec/cask/cli/fetch_spec.rb | @@ -1,4 +1,4 @@
-require "test_helper"
+require "spec_helper"
describe Hbc::CLI::Fetch do
let(:local_transmission) {
@@ -13,8 +13,8 @@
shutup do
Hbc::CLI::Fetch.run("local-transmission", "local-caffeine")
end
- Hbc::CurlDownloadStrategy.new(local_transmission).cached_location.must_be :exist?
- Hbc::CurlDownloadStrategy.new(local_caffeine).cached_location.must_be :exist?
+ expect(Hbc::CurlDownloadStrategy.new(local_transmission).cached_location).to exist
+ expect(Hbc::CurlDownloadStrategy.new(local_caffeine).cached_location).to exist
end
it "prevents double fetch (without nuking existing installation)" do
@@ -30,7 +30,7 @@
end
new_ctime = File.stat(download_stategy.cached_location).ctime
- old_ctime.to_i.must_equal new_ctime.to_i
+ expect(old_ctime.to_i).to eq(new_ctime.to_i)
end
it "allows double fetch with --force" do
@@ -48,31 +48,30 @@
download_stategy = Hbc::CurlDownloadStrategy.new(local_transmission)
new_ctime = File.stat(download_stategy.cached_location).ctime
- # new_ctime.to_i.must_be :>, old_ctime.to_i
- new_ctime.to_i.must_be :>, old_ctime.to_i
+ expect(new_ctime.to_i).to be > old_ctime.to_i
end
it "properly handles Casks that are not present" do
- lambda {
+ expect {
shutup do
Hbc::CLI::Fetch.run("notacask")
end
- }.must_raise Hbc::CaskUnavailableError
+ }.to raise_error(Hbc::CaskUnavailableError)
end
describe "when no Cask is specified" do
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Fetch.run
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
describe "when no Cask is specified, but an invalid option" do
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Fetch.run("--notavalidoption")
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
end | false |
Other | Homebrew | brew | 3ef51dba055700ecca9a4f10e1fe0e714b7f9889.json | Convert Edit test to spec. | Library/Homebrew/cask/spec/cask/cli/edit_spec.rb | @@ -1,4 +1,4 @@
-require "test_helper"
+require "spec_helper"
# monkeypatch for testing
module Hbc
@@ -20,43 +20,43 @@ def self.editor_commands
end
describe Hbc::CLI::Edit do
- before do
+ before(:each) do
Hbc::CLI::Edit.reset!
end
it "opens the editor for the specified Cask" do
- Hbc::CLI::Edit.run("alfred")
- Hbc::CLI::Edit.editor_commands.must_equal [
- [Hbc.path("alfred")],
+ Hbc::CLI::Edit.run("local-caffeine")
+ expect(Hbc::CLI::Edit.editor_commands).to eq [
+ [Hbc.path("local-caffeine")],
]
end
it "throws away additional arguments and uses the first" do
- Hbc::CLI::Edit.run("adium", "alfred")
- Hbc::CLI::Edit.editor_commands.must_equal [
- [Hbc.path("adium")],
+ Hbc::CLI::Edit.run("local-caffeine", "local-transmission")
+ expect(Hbc::CLI::Edit.editor_commands).to eq [
+ [Hbc.path("local-caffeine")],
]
end
it "raises an exception when the Cask doesnt exist" do
- lambda {
+ expect {
Hbc::CLI::Edit.run("notacask")
- }.must_raise Hbc::CaskUnavailableError
+ }.to raise_error(Hbc::CaskUnavailableError)
end
describe "when no Cask is specified" do
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Edit.run
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
describe "when no Cask is specified, but an invalid option" do
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Edit.run("--notavalidoption")
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
end | false |
Other | Homebrew | brew | dcb206dd1ef1be09f75774c0f86692ad3e31c679.json | Convert Create test to spec. | Library/Homebrew/cask/spec/cask/cli/create_spec.rb | @@ -1,4 +1,4 @@
-require "test_helper"
+require "spec_helper"
# monkeypatch for testing
module Hbc
@@ -20,11 +20,11 @@ def self.editor_commands
end
describe Hbc::CLI::Create do
- before do
+ before(:each) do
Hbc::CLI::Create.reset!
end
- after do
+ after(:each) do
%w[new-cask additional-cask another-cask yet-another-cask local-caff].each do |cask|
path = Hbc.path(cask)
path.delete if path.exist?
@@ -33,15 +33,15 @@ def self.editor_commands
it "opens the editor for the specified Cask" do
Hbc::CLI::Create.run("new-cask")
- Hbc::CLI::Create.editor_commands.must_equal [
+ expect(Hbc::CLI::Create.editor_commands).to eq [
[Hbc.path("new-cask")],
]
end
it "drops a template down for the specified Cask" do
Hbc::CLI::Create.run("new-cask")
template = File.read(Hbc.path("new-cask"))
- template.must_equal <<-EOS.undent
+ expect(template).to eq <<-EOS.undent
cask 'new-cask' do
version ''
sha256 ''
@@ -57,44 +57,44 @@ def self.editor_commands
it "throws away additional Cask arguments and uses the first" do
Hbc::CLI::Create.run("additional-cask", "another-cask")
- Hbc::CLI::Create.editor_commands.must_equal [
+ expect(Hbc::CLI::Create.editor_commands).to eq [
[Hbc.path("additional-cask")],
]
end
it "throws away stray options" do
Hbc::CLI::Create.run("--notavalidoption", "yet-another-cask")
- Hbc::CLI::Create.editor_commands.must_equal [
+ expect(Hbc::CLI::Create.editor_commands).to eq [
[Hbc.path("yet-another-cask")],
]
end
it "raises an exception when the Cask already exists" do
- lambda {
+ expect {
Hbc::CLI::Create.run("basic-cask")
- }.must_raise Hbc::CaskAlreadyCreatedError
+ }.to raise_error(Hbc::CaskAlreadyCreatedError)
end
it "allows creating Casks that are substrings of existing Casks" do
Hbc::CLI::Create.run("local-caff")
- Hbc::CLI::Create.editor_commands.must_equal [
+ expect(Hbc::CLI::Create.editor_commands).to eq [
[Hbc.path("local-caff")],
]
end
describe "when no Cask is specified" do
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Create.run
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
describe "when no Cask is specified, but an invalid option" do
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Create.run("--notavalidoption")
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
end | false |
Other | Homebrew | brew | 2ade29a5cf5df84ed9fb7dcf429c59c3e084a6a1.json | Convert Cat test to spec. | Library/Homebrew/cask/spec/cask/cli/cat_spec.rb | @@ -1,9 +1,9 @@
-require "test_helper"
+require "spec_helper"
describe Hbc::CLI::Cat do
describe "given a basic Cask" do
- before do
- @expected_output = <<-EOS.undent
+ let(:expected_output) {
+ <<-EOS.undent
cask 'basic-cask' do
version '1.2.3'
sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
@@ -14,46 +14,46 @@
app 'TestCask.app'
end
EOS
- end
+ }
it "displays the Cask file content about the specified Cask" do
- lambda {
+ expect {
Hbc::CLI::Cat.run("basic-cask")
- }.must_output(@expected_output)
+ }.to output(expected_output).to_stdout
end
it "throws away additional Cask arguments and uses the first" do
- lambda {
+ expect {
Hbc::CLI::Cat.run("basic-cask", "local-caffeine")
- }.must_output(@expected_output)
+ }.to output(expected_output).to_stdout
end
it "throws away stray options" do
- lambda {
+ expect {
Hbc::CLI::Cat.run("--notavalidoption", "basic-cask")
- }.must_output(@expected_output)
+ }.to output(expected_output).to_stdout
end
end
it "raises an exception when the Cask does not exist" do
- lambda {
+ expect {
Hbc::CLI::Cat.run("notacask")
- }.must_raise Hbc::CaskUnavailableError
+ }.to raise_error(Hbc::CaskUnavailableError)
end
describe "when no Cask is specified" do
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Cat.run
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
describe "when no Cask is specified, but an invalid option" do
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Cat.run("--notavalidoption")
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
end | false |
Other | Homebrew | brew | 9e31b51cb0f14ca8e9491de90248532fc44f123f.json | Convert Audit test to spec. | Library/Homebrew/cask/spec/cask/cli/audit_spec.rb | @@ -0,0 +1,61 @@
+require "spec_helper"
+
+describe Hbc::CLI::Audit do
+ let(:auditor) { double }
+ let(:cask) { double }
+
+ describe "selection of Casks to audit" do
+ it "audits all Casks if no tokens are given" do
+ allow(Hbc).to receive(:all).and_return([cask, cask])
+
+ expect(auditor).to receive(:audit).twice
+
+ run_audit([], auditor)
+ end
+
+ it "audits specified Casks if tokens are given" do
+ cask_token = "nice-app"
+ expect(Hbc).to receive(:load).with(cask_token).and_return(cask)
+
+ expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: false)
+
+ run_audit([cask_token], auditor)
+ end
+ end
+
+ describe "rules for downloading a Cask" do
+ it "does not download the Cask per default" do
+ allow(Hbc).to receive(:load).and_return(cask)
+ expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: false)
+
+ run_audit(["casktoken"], auditor)
+ end
+
+ it "download a Cask if --download flag is set" do
+ allow(Hbc).to receive(:load).and_return(cask)
+ expect(auditor).to receive(:audit).with(cask, audit_download: true, check_token_conflicts: false)
+
+ run_audit(["casktoken", "--download"], auditor)
+ end
+ end
+
+ describe "rules for checking token conflicts" do
+ it "does not check for token conflicts per default" do
+ allow(Hbc).to receive(:load).and_return(cask)
+ expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: false)
+
+ run_audit(["casktoken"], auditor)
+ end
+
+ it "checks for token conflicts if --token-conflicts flag is set" do
+ allow(Hbc).to receive(:load).and_return(cask)
+ expect(auditor).to receive(:audit).with(cask, audit_download: false, check_token_conflicts: true)
+
+ run_audit(["casktoken", "--token-conflicts"], auditor)
+ end
+ end
+
+ def run_audit(args, auditor)
+ Hbc::CLI::Audit.new(args, auditor).run
+ end
+end | true |
Other | Homebrew | brew | 9e31b51cb0f14ca8e9491de90248532fc44f123f.json | Convert Audit test to spec. | Library/Homebrew/cask/test/cask/cli/audit_test.rb | @@ -1,64 +0,0 @@
-require "test_helper"
-
-describe Hbc::CLI::Audit do
- let(:auditor) { mock }
- let(:cask) { mock }
-
- describe "selection of Casks to audit" do
- it "audits all Casks if no tokens are given" do
- Hbc.stub :all, [cask, cask] do
- auditor.expects(:audit).times(2)
-
- run_audit([], auditor)
- end
- end
-
- it "audits specified Casks if tokens are given" do
- cask_token = "nice-app"
- Hbc.expects(:load).with(cask_token).returns(cask)
- auditor.expects(:audit).with(cask, audit_download: false, check_token_conflicts: false)
-
- run_audit([cask_token], auditor)
- end
- end
-
- describe "rules for downloading a Cask" do
- it "does not download the Cask per default" do
- Hbc.stub :load, cask do
- auditor.expects(:audit).with(cask, audit_download: false, check_token_conflicts: false)
-
- run_audit(["casktoken"], auditor)
- end
- end
-
- it "download a Cask if --download flag is set" do
- Hbc.stub :load, cask do
- auditor.expects(:audit).with(cask, audit_download: true, check_token_conflicts: false)
-
- run_audit(["casktoken", "--download"], auditor)
- end
- end
- end
-
- describe "rules for checking token conflicts" do
- it "does not check for token conflicts per default" do
- Hbc.stub :load, cask do
- auditor.expects(:audit).with(cask, audit_download: false, check_token_conflicts: false)
-
- run_audit(["casktoken"], auditor)
- end
- end
-
- it "checks for token conflicts if --token-conflicts flag is set" do
- Hbc.stub :load, cask do
- auditor.expects(:audit).with(cask, audit_download: false, check_token_conflicts: true)
-
- run_audit(["casktoken", "--token-conflicts"], auditor)
- end
- end
- end
-
- def run_audit(args, auditor)
- Hbc::CLI::Audit.new(args, auditor).run
- end
-end | true |
Other | Homebrew | brew | d197e79d35c121fbd79491886cf6d13b8037faef.json | Convert `Installer` test to spec. | Library/Homebrew/cask/spec/cask/installer_spec.rb | @@ -1,9 +1,9 @@
-require "test_helper"
+require "spec_helper"
describe Hbc::Installer do
describe "install" do
let(:empty_depends_on_stub) {
- stub(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
+ double(formula: [], cask: [], macos: nil, arch: nil, x11: nil)
}
it "downloads and installs a nice fresh Cask" do
@@ -13,8 +13,8 @@
Hbc::Installer.new(caffeine).install
end
- expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).must_be :directory?
- expect(Hbc.appdir.join("Caffeine.app")).must_be :directory?
+ expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).to be_a_directory
+ expect(Hbc.appdir.join("Caffeine.app")).to be_a_directory
end
it "works with dmg-based Casks" do
@@ -24,8 +24,8 @@
Hbc::Installer.new(asset).install
end
- expect(Hbc.caskroom.join("container-dmg", asset.version)).must_be :directory?
- expect(Hbc.appdir.join("container")).must_be :file?
+ expect(Hbc.caskroom.join("container-dmg", asset.version)).to be_a_directory
+ expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with tar-gz-based Casks" do
@@ -35,22 +35,22 @@
Hbc::Installer.new(asset).install
end
- expect(Hbc.caskroom.join("container-tar-gz", asset.version)).must_be :directory?
- expect(Hbc.appdir.join("container")).must_be :file?
+ expect(Hbc.caskroom.join("container-tar-gz", asset.version)).to be_a_directory
+ expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with cab-based Casks" do
skip("cabextract not installed") if which("cabextract").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-cab.rb")
- asset.stub :depends_on, empty_depends_on_stub do
- shutup do
- Hbc::Installer.new(asset).install
- end
+ allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
+
+ shutup do
+ Hbc::Installer.new(asset).install
end
- expect(Hbc.caskroom.join("container-cab", asset.version)).must_be :directory?
- expect(Hbc.appdir.join("container")).must_be :file?
+ expect(Hbc.caskroom.join("container-cab", asset.version)).to be_a_directory
+ expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with Adobe AIR-based Casks" do
@@ -61,22 +61,21 @@
Hbc::Installer.new(asset).install
end
- expect(Hbc.caskroom.join("container-air", asset.version)).must_be :directory?
- expect(Hbc.appdir.join("container.app")).must_be :directory?
+ expect(Hbc.caskroom.join("container-air", asset.version)).to be_a_directory
+ expect(Hbc.appdir.join("container.app")).to be_a_directory
end
it "works with 7z-based Casks" do
skip("unar not installed") if which("unar").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-7z.rb")
- asset.stub :depends_on, empty_depends_on_stub do
- shutup do
- Hbc::Installer.new(asset).install
- end
+ allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
+ shutup do
+ Hbc::Installer.new(asset).install
end
- expect(Hbc.caskroom.join("container-7z", asset.version)).must_be :directory?
- expect(Hbc.appdir.join("container")).must_be :file?
+ expect(Hbc.caskroom.join("container-7z", asset.version)).to be_a_directory
+ expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with xar-based Casks" do
@@ -86,36 +85,34 @@
Hbc::Installer.new(asset).install
end
- expect(Hbc.caskroom.join("container-xar", asset.version)).must_be :directory?
- expect(Hbc.appdir.join("container")).must_be :file?
+ expect(Hbc.caskroom.join("container-xar", asset.version)).to be_a_directory
+ expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with Stuffit-based Casks" do
skip("unar not installed") if which("unar").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-sit.rb")
- asset.stub :depends_on, empty_depends_on_stub do
- shutup do
- Hbc::Installer.new(asset).install
- end
+ allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
+ shutup do
+ Hbc::Installer.new(asset).install
end
- expect(Hbc.caskroom.join("container-sit", asset.version)).must_be :directory?
- expect(Hbc.appdir.join("container")).must_be :file?
+ expect(Hbc.caskroom.join("container-sit", asset.version)).to be_a_directory
+ expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with RAR-based Casks" do
skip("unar not installed") if which("unar").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-rar.rb")
- asset.stub :depends_on, empty_depends_on_stub do
- shutup do
- Hbc::Installer.new(asset).install
- end
+ allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
+ shutup do
+ Hbc::Installer.new(asset).install
end
- expect(Hbc.caskroom.join("container-rar", asset.version)).must_be :directory?
- expect(Hbc.appdir.join("container")).must_be :file?
+ expect(Hbc.caskroom.join("container-rar", asset.version)).to be_a_directory
+ expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with pure bzip2-based Casks" do
@@ -125,8 +122,8 @@
Hbc::Installer.new(asset).install
end
- expect(Hbc.caskroom.join("container-bzip2", asset.version)).must_be :directory?
- expect(Hbc.appdir.join("container-bzip2--#{asset.version}")).must_be :file?
+ expect(Hbc.caskroom.join("container-bzip2", asset.version)).to be_a_directory
+ expect(Hbc.appdir.join("container-bzip2--#{asset.version}")).to be_a_file
end
it "works with pure gzip-based Casks" do
@@ -136,36 +133,34 @@
Hbc::Installer.new(asset).install
end
- expect(Hbc.caskroom.join("container-gzip", asset.version)).must_be :directory?
- expect(Hbc.appdir.join("container")).must_be :file?
+ expect(Hbc.caskroom.join("container-gzip", asset.version)).to be_a_directory
+ expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with pure xz-based Casks" do
skip("unxz not installed") if which("unxz").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-xz.rb")
- asset.stub :depends_on, empty_depends_on_stub do
- shutup do
- Hbc::Installer.new(asset).install
- end
+ allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
+ shutup do
+ Hbc::Installer.new(asset).install
end
- expect(Hbc.caskroom.join("container-xz", asset.version)).must_be :directory?
- expect(Hbc.appdir.join("container-xz--#{asset.version}")).must_be :file?
+ expect(Hbc.caskroom.join("container-xz", asset.version)).to be_a_directory
+ expect(Hbc.appdir.join("container-xz--#{asset.version}")).to be_a_file
end
it "works with lzma-based Casks" do
skip("unlzma not installed") if which("unlzma").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-lzma.rb")
- asset.stub :depends_on, empty_depends_on_stub do
- shutup do
- Hbc::Installer.new(asset).install
- end
+ allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
+ shutup do
+ Hbc::Installer.new(asset).install
end
- expect(Hbc.caskroom.join("container-lzma", asset.version)).must_be :directory?
- expect(Hbc.appdir.join("container-lzma--#{asset.version}")).must_be :file?
+ expect(Hbc.caskroom.join("container-lzma", asset.version)).to be_a_directory
+ expect(Hbc.appdir.join("container-lzma--#{asset.version}")).to be_a_file
end
it "blows up on a bad checksum" do
@@ -174,7 +169,7 @@
shutup do
Hbc::Installer.new(bad_checksum).install
end
- }.must_raise(Hbc::CaskSha256MismatchError)
+ }.to raise_error(Hbc::CaskSha256MismatchError)
end
it "blows up on a missing checksum" do
@@ -183,7 +178,7 @@
shutup do
Hbc::Installer.new(missing_checksum).install
end
- }.must_raise(Hbc::CaskSha256MissingError)
+ }.to raise_error(Hbc::CaskSha256MissingError)
end
it "installs fine if sha256 :no_check is used" do
@@ -193,14 +188,14 @@
Hbc::Installer.new(no_checksum).install
end
- expect(no_checksum).must_be :installed?
+ expect(no_checksum).to be_installed
end
it "fails to install if sha256 :no_check is used with --require-sha" do
no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb")
expect {
Hbc::Installer.new(no_checksum, require_sha: true).install
- }.must_raise(Hbc::CaskNoShasumError)
+ }.to raise_error(Hbc::CaskNoShasumError)
end
it "installs fine if sha256 :no_check is used with --require-sha and --force" do
@@ -210,27 +205,27 @@
Hbc::Installer.new(no_checksum, require_sha: true, force: true).install
end
- expect(no_checksum).must_be :installed?
+ expect(no_checksum).to be_installed
end
it "prints caveats if they're present" do
with_caveats = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-caveats.rb")
expect {
Hbc::Installer.new(with_caveats).install
- }.must_output(/Here are some things you might want to know/)
+ }.to output(/Here are some things you might want to know/).to_stdout
- expect(with_caveats).must_be :installed?
+ expect(with_caveats).to be_installed
end
it "prints installer :manual instructions when present" do
with_installer_manual = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installer-manual.rb")
expect {
Hbc::Installer.new(with_installer_manual).install
- }.must_output(/To complete the installation of Cask with-installer-manual, you must also\nrun the installer at\n\n '#{with_installer_manual.staged_path.join('Caffeine.app')}'/)
+ }.to output(/To complete the installation of Cask with-installer-manual, you must also\nrun the installer at\n\n '#{with_installer_manual.staged_path.join('Caffeine.app')}'/).to_stdout
- expect(with_installer_manual).must_be :installed?
+ expect(with_installer_manual).to be_installed
end
it "does not extract __MACOSX directories from zips" do
@@ -240,13 +235,13 @@
Hbc::Installer.new(with_macosx_dir).install
end
- expect(with_macosx_dir.staged_path.join("__MACOSX")).wont_be :directory?
+ expect(with_macosx_dir.staged_path.join("__MACOSX")).not_to be_a_directory
end
it "installer method raises an exception when already-installed Casks which auto-update are attempted" do
with_auto_updates = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb")
- expect(with_auto_updates).wont_be :installed?
+ expect(with_auto_updates).not_to be_installed
installer = Hbc::Installer.new(with_auto_updates)
@@ -256,28 +251,30 @@
expect {
installer.install
- }.must_raise(Hbc::CaskAlreadyInstalledAutoUpdatesError)
+ }.to raise_error(Hbc::CaskAlreadyInstalledAutoUpdatesError)
end
it "allows already-installed Casks which auto-update to be installed if force is provided" do
with_auto_updates = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb")
- expect(with_auto_updates).wont_be :installed?
+ expect(with_auto_updates).not_to be_installed
shutup do
Hbc::Installer.new(with_auto_updates).install
end
- shutup do
- Hbc::Installer.new(with_auto_updates, force: true).install
- end # wont_raise
+ expect {
+ shutup do
+ Hbc::Installer.new(with_auto_updates, force: true).install
+ end
+ }.not_to raise_error
end
# unlike the CLI, the internal interface throws exception on double-install
it "installer method raises an exception when already-installed Casks are attempted" do
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
- expect(transmission).wont_be :installed?
+ expect(transmission).not_to be_installed
installer = Hbc::Installer.new(transmission)
@@ -287,13 +284,13 @@
expect {
installer.install
- }.must_raise(Hbc::CaskAlreadyInstalledError)
+ }.to raise_error(Hbc::CaskAlreadyInstalledError)
end
it "allows already-installed Casks to be installed if force is provided" do
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
- expect(transmission).wont_be :installed?
+ expect(transmission).not_to be_installed
shutup do
Hbc::Installer.new(transmission).install
@@ -311,7 +308,7 @@
Hbc::Installer.new(naked_pkg).install
end
- expect(Hbc.caskroom.join("container-pkg", naked_pkg.version, "container.pkg")).must_be :file?
+ expect(Hbc.caskroom.join("container-pkg", naked_pkg.version, "container.pkg")).to be_a_file
end
it "works properly with an overridden container :type" do
@@ -321,7 +318,7 @@
Hbc::Installer.new(naked_executable).install
end
- expect(Hbc.caskroom.join("naked-executable", naked_executable.version, "naked_executable")).must_be :file?
+ expect(Hbc.caskroom.join("naked-executable", naked_executable.version, "naked_executable")).to be_a_file
end
it "works fine with a nested container" do
@@ -331,7 +328,7 @@
Hbc::Installer.new(nested_app).install
end
- expect(Hbc.appdir.join("MyNestedApp.app")).must_be :directory?
+ expect(Hbc.appdir.join("MyNestedApp.app")).to be_a_directory
end
it "generates and finds a timestamped metadata directory for an installed Cask" do
@@ -342,8 +339,8 @@
end
m_path = caffeine.metadata_path(:now, true)
- expect(caffeine.metadata_path(:now, false)).must_equal(m_path)
- expect(caffeine.metadata_path(:latest)).must_equal(m_path)
+ expect(caffeine.metadata_path(:now, false)).to eq(m_path)
+ expect(caffeine.metadata_path(:latest)).to eq(m_path)
end
it "generates and finds a metadata subdirectory for an installed Cask" do
@@ -355,8 +352,8 @@
subdir_name = "Casks"
m_subdir = caffeine.metadata_subdir(subdir_name, :now, true)
- expect(caffeine.metadata_subdir(subdir_name, :now, false)).must_equal(m_subdir)
- expect(caffeine.metadata_subdir(subdir_name, :latest)).must_equal(m_subdir)
+ expect(caffeine.metadata_subdir(subdir_name, :now, false)).to eq(m_subdir)
+ expect(caffeine.metadata_subdir(subdir_name, :latest)).to eq(m_subdir)
end
end
@@ -370,9 +367,9 @@
installer.uninstall
end
- expect(Hbc.caskroom.join("local-caffeine", caffeine.version, "Caffeine.app")).wont_be :directory?
- expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).wont_be :directory?
- expect(Hbc.caskroom.join("local-caffeine")).wont_be :directory?
+ expect(Hbc.caskroom.join("local-caffeine", caffeine.version, "Caffeine.app")).not_to be_a_directory
+ expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).not_to be_a_directory
+ expect(Hbc.caskroom.join("local-caffeine")).not_to be_a_directory
end
it "uninstalls all versions if force is set" do
@@ -383,19 +380,19 @@
Hbc::Installer.new(caffeine).install
end
- expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).must_be :directory?
- expect(Hbc.caskroom.join("local-caffeine", mutated_version)).wont_be :directory?
+ expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).to be_a_directory
+ expect(Hbc.caskroom.join("local-caffeine", mutated_version)).not_to be_a_directory
FileUtils.mv(Hbc.caskroom.join("local-caffeine", caffeine.version), Hbc.caskroom.join("local-caffeine", mutated_version))
- expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).wont_be :directory?
- expect(Hbc.caskroom.join("local-caffeine", mutated_version)).must_be :directory?
+ expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).not_to be_a_directory
+ expect(Hbc.caskroom.join("local-caffeine", mutated_version)).to be_a_directory
shutup do
Hbc::Installer.new(caffeine, force: true).uninstall
end
- expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).wont_be :directory?
- expect(Hbc.caskroom.join("local-caffeine", mutated_version)).wont_be :directory?
- expect(Hbc.caskroom.join("local-caffeine")).wont_be :directory?
+ expect(Hbc.caskroom.join("local-caffeine", caffeine.version)).not_to be_a_directory
+ expect(Hbc.caskroom.join("local-caffeine", mutated_version)).not_to be_a_directory
+ expect(Hbc.caskroom.join("local-caffeine")).not_to be_a_directory
end
end
end | false |
Other | Homebrew | brew | d8e515004c68b82532401a26ae0d6a4f27844d91.json | Convert DSL test to spec. | Library/Homebrew/cask/spec/cask/dsl_spec.rb | @@ -0,0 +1,548 @@
+require "spec_helper"
+
+describe Hbc::DSL do
+ let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/#{token}.rb") }
+ let(:token) { "basic-cask" }
+
+ context "stanzas" do
+ it "lets you set url, homepage, and version" do
+ expect(cask.url.to_s).to eq("http://example.com/TestCask.dmg")
+ expect(cask.homepage).to eq("http://example.com/")
+ expect(cask.version.to_s).to eq("1.2.3")
+ end
+ end
+
+ describe "when a Cask includes an unknown method" do
+ let(:attempt_unknown_method) {
+ lambda do
+ Hbc::Cask.new("unexpected-method-cask") do
+ future_feature :not_yet_on_your_machine
+ end
+ end
+ }
+
+ it "prints a warning that it has encountered an unexpected method" do
+ expected = Regexp.compile(<<-EOS.undent.lines.map(&:chomp).join(""))
+ (?m)
+ Warning:
+ .*
+ Unexpected method 'future_feature' called on Cask unexpected-method-cask\\.
+ .*
+ https://github.com/caskroom/homebrew-cask/blob/master/doc/reporting_bugs/pre_bug_report.md
+ .*
+ https://github.com/caskroom/homebrew-cask#reporting-bugs
+ EOS
+
+ expect {
+ expect(attempt_unknown_method).not_to output.to_stdout
+ }.to output(expected).to_stderr
+ end
+
+ it "will simply warn, not throw an exception" do
+ expect {
+ shutup do
+ attempt_unknown_method.call
+ end
+ }.not_to raise_error
+ end
+ end
+
+ describe "header line" do
+ context "when invalid" do
+ let(:token) { "invalid/invalid-header-format" }
+ it "raises an error" do
+ expect { cask }.to raise_error(SyntaxError)
+ end
+ end
+
+ context "when token does not match the file name" do
+ let(:token) { "invalid/invalid-header-token-mismatch" }
+
+ it "raises an error" do
+ expect {
+ cask
+ }.to raise_error(Hbc::CaskTokenDoesNotMatchError, /Bad header line:.*does not match file name/)
+ end
+ end
+
+ context "when it contains no DSL version" do
+ let(:token) { "no-dsl-version" }
+
+ it "does not require a DSL version in the header" do
+ expect(cask.token).to eq("no-dsl-version")
+ expect(cask.url.to_s).to eq("http://example.com/TestCask.dmg")
+ expect(cask.homepage).to eq("http://example.com/")
+ expect(cask.version.to_s).to eq("1.2.3")
+ end
+ end
+
+ context "when it contains a deprecated DSL version" do
+ let(:token) { "with-dsl-version" }
+
+ it "may use deprecated DSL version hash syntax" do
+ allow(ENV).to receive(:[]).with("HOMEBREW_DEVELOPER").and_return(nil)
+
+ shutup do
+ expect(cask.token).to eq("with-dsl-version")
+ expect(cask.url.to_s).to eq("http://example.com/TestCask.dmg")
+ expect(cask.homepage).to eq("http://example.com/")
+ expect(cask.version.to_s).to eq("1.2.3")
+ end
+ end
+ end
+ end
+
+ describe "name stanza" do
+ it "lets you set the full name via a name stanza" do
+ cask = Hbc::Cask.new("name-cask") do
+ name "Proper Name"
+ end
+
+ expect(cask.name).to eq([
+ "Proper Name",
+ ])
+ end
+
+ it "Accepts an array value to the name stanza" do
+ cask = Hbc::Cask.new("array-name-cask") do
+ name ["Proper Name", "Alternate Name"]
+ end
+
+ expect(cask.name).to eq([
+ "Proper Name",
+ "Alternate Name",
+ ])
+ end
+
+ it "Accepts multiple name stanzas" do
+ cask = Hbc::Cask.new("multi-name-cask") do
+ name "Proper Name"
+ name "Alternate Name"
+ end
+
+ expect(cask.name).to eq([
+ "Proper Name",
+ "Alternate Name",
+ ])
+ end
+ end
+
+ describe "sha256 stanza" do
+ it "lets you set checksum via sha256" do
+ cask = Hbc::Cask.new("checksum-cask") do
+ sha256 "imasha2"
+ end
+
+ expect(cask.sha256).to eq("imasha2")
+ end
+ end
+
+ describe "language stanza" do
+ it "allows multilingual casks" do
+ cask = lambda do
+ Hbc::Cask.new("cask-with-apps") do
+ language "zh" do
+ sha256 "abc123"
+ "zh-CN"
+ end
+
+ language "en-US", default: true do
+ sha256 "xyz789"
+ "en-US"
+ end
+
+ url "https://example.org/#{language}.zip"
+ end
+ end
+
+ allow(MacOS).to receive(:languages).and_return(["zh"])
+ expect(cask.call.language).to eq("zh-CN")
+ expect(cask.call.sha256).to eq("abc123")
+ expect(cask.call.url.to_s).to eq("https://example.org/zh-CN.zip")
+
+ allow(MacOS).to receive(:languages).and_return(["zh-XX"])
+ expect(cask.call.language).to eq("zh-CN")
+ expect(cask.call.sha256).to eq("abc123")
+ expect(cask.call.url.to_s).to eq("https://example.org/zh-CN.zip")
+
+ allow(MacOS).to receive(:languages).and_return(["en"])
+ expect(cask.call.language).to eq("en-US")
+ expect(cask.call.sha256).to eq("xyz789")
+ expect(cask.call.url.to_s).to eq("https://example.org/en-US.zip")
+
+ allow(MacOS).to receive(:languages).and_return(["xx-XX"])
+ expect(cask.call.language).to eq("en-US")
+ expect(cask.call.sha256).to eq("xyz789")
+ expect(cask.call.url.to_s).to eq("https://example.org/en-US.zip")
+
+ allow(MacOS).to receive(:languages).and_return(["xx-XX", "zh", "en"])
+ expect(cask.call.language).to eq("zh-CN")
+ expect(cask.call.sha256).to eq("abc123")
+ expect(cask.call.url.to_s).to eq("https://example.org/zh-CN.zip")
+
+ allow(MacOS).to receive(:languages).and_return(["xx-XX", "en-US", "zh"])
+ expect(cask.call.language).to eq("en-US")
+ expect(cask.call.sha256).to eq("xyz789")
+ expect(cask.call.url.to_s).to eq("https://example.org/en-US.zip")
+ end
+ end
+
+ describe "app stanza" do
+ it "allows you to specify app stanzas" do
+ cask = Hbc::Cask.new("cask-with-apps") do
+ app "Foo.app"
+ app "Bar.app"
+ end
+
+ expect(Array(cask.artifacts[:app])).to eq([["Foo.app"], ["Bar.app"]])
+ end
+
+ it "allow app stanzas to be empty" do
+ cask = Hbc::Cask.new("cask-with-no-apps")
+ expect(Array(cask.artifacts[:app])).to eq([])
+ end
+ end
+
+ describe "caveats stanza" do
+ it "allows caveats to be specified via a method define" do
+ cask = Hbc::Cask.new("plain-cask")
+
+ expect(cask.caveats).to be_empty
+
+ cask = Hbc::Cask.new("cask-with-caveats") do
+ def caveats; <<-EOS.undent
+ When you install this Cask, you probably want to know this.
+ EOS
+ end
+ end
+
+ expect(cask.caveats).to eq("When you install this Cask, you probably want to know this.\n")
+ end
+ end
+
+ describe "pkg stanza" do
+ it "allows installable pkgs to be specified" do
+ cask = Hbc::Cask.new("cask-with-pkgs") do
+ pkg "Foo.pkg"
+ pkg "Bar.pkg"
+ end
+
+ expect(Array(cask.artifacts[:pkg])).to eq([["Foo.pkg"], ["Bar.pkg"]])
+ end
+ end
+
+ describe "url stanza" do
+ let(:token) { "invalid/invalid-two-url" }
+
+ it "prevents defining multiple urls" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError, /'url' stanza may only appear once/)
+ end
+ end
+
+ describe "homepage stanza" do
+ let(:token) { "invalid/invalid-two-homepage" }
+
+ it "prevents defining multiple homepages" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError, /'homepage' stanza may only appear once/)
+ end
+ end
+
+ describe "version stanza" do
+ let(:token) { "invalid/invalid-two-version" }
+ it "prevents defining multiple versions" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError, /'version' stanza may only appear once/)
+ end
+ end
+
+ describe "appcast stanza" do
+ let(:token) { "with-appcast" }
+
+ it "allows appcasts to be specified" do
+ expect(cask.appcast.to_s).to match(/^http/)
+ end
+
+ context "when multiple appcasts are defined" do
+ let(:token) { "invalid/invalid-appcast-multiple" }
+
+ it "raises an error" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError, /'appcast' stanza may only appear once/)
+ end
+ end
+
+ context "when appcast URL is invalid" do
+ let(:token) { "invalid/invalid-appcast-url" }
+
+ it "refuses to load" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError)
+ end
+ end
+ end
+
+ describe "GPG stanza" do
+ context "valid" do
+ let(:token) { "with-gpg" }
+
+ it "is allowed to be specified" do
+ expect(cask.gpg.to_s).to match(/\S/)
+ end
+ end
+
+ context "with :key_url" do
+ let(:token) { "with-gpg-key-url" }
+ it "is allowed to be specified" do
+ expect(cask.gpg.to_s).to match(/\S/)
+ end
+ end
+
+ context "specifying mmultiple times" do
+ let(:token) { "invalid/invalid-gpg-multiple-stanzas" }
+
+ it "is not allowed" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError, /'gpg' stanza may only appear once/)
+ end
+ end
+
+ context "missing GPG key parameters" do
+ let(:token) { "invalid/invalid-gpg-missing-key" }
+
+ it "refuses to load" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError, /'gpg' stanza must include exactly one/)
+ end
+ end
+
+ context "conflicting GPG key parameters" do
+ let(:token) { "invalid/invalid-gpg-conflicting-keys" }
+
+ it "refuses to load" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError, /'gpg' stanza must include exactly one/)
+ end
+ end
+
+ context "invalid GPG signature URLs" do
+ let(:token) { "invalid/invalid-gpg-signature-url" }
+
+ it "refuses to load" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError)
+ end
+ end
+
+ context "invalid GPG key URLs" do
+ let(:token) { "invalid/invalid-gpg-key-url" }
+
+ it "refuses to load" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError)
+ end
+ end
+
+ context "invalid GPG key IDs" do
+ let(:token) { "invalid/invalid-gpg-key-id" }
+
+ it "refuses to load" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError)
+ end
+ end
+
+ context "GPG parameter is unknown" do
+ let(:token) { "invalid/invalid-gpg-parameter" }
+
+ it "refuses to load" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError)
+ end
+ end
+ end
+
+ describe "depends_on stanza" do
+ let(:token) { "invalid/invalid-depends-on-key" }
+
+ it "refuses to load with an invalid depends_on key" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError)
+ end
+ end
+
+ describe "depends_on formula" do
+ context "with one Formula" do
+ let(:token) { "with-depends-on-formula" }
+
+ it "allows depends_on formula to be specified" do
+ expect(cask.depends_on.formula).not_to be nil
+ end
+ end
+
+ context "with multiple Formulae" do
+ let(:token) { "with-depends-on-formula-multiple" }
+
+ it "allows multiple depends_on formula to be specified" do
+ expect(cask.depends_on.formula).not_to be nil
+ end
+ end
+ end
+
+ describe "depends_on cask" do
+ context "specifying one" do
+ let(:token) { "with-depends-on-cask" }
+ it "is allowed" do
+ expect(cask.depends_on.cask).not_to be nil
+ end
+ end
+
+ context "specifying multiple" do
+ let(:token) { "with-depends-on-cask-multiple" }
+
+ it "is allowed" do
+ expect(cask.depends_on.cask).not_to be nil
+ end
+ end
+ end
+
+ describe "depends_on macos" do
+ context "valid" do
+ let(:token) { "with-depends-on-macos-string" }
+
+ it "allows depends_on macos to be specified" do
+ expect(cask.depends_on.macos).not_to be nil
+ end
+ end
+
+ context "invalid depends_on macos value" do
+ let(:token) { "invalid/invalid-depends-on-macos-bad-release" }
+
+ it "refuses to load" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError)
+ end
+ end
+
+ context "conflicting depends_on macos forms" do
+ let(:token) { "invalid/invalid-depends-on-macos-conflicting-forms" }
+
+ it "refuses to load" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError)
+ end
+ end
+ end
+
+ describe "depends_on arch" do
+ context "valid" do
+ let(:token) { "with-depends-on-arch" }
+
+ it "is allowed to be specified" do
+ expect(cask.depends_on.arch).not_to be nil
+ end
+ end
+
+ context "invalid depends_on arch value" do
+ let(:token) { "invalid/invalid-depends-on-arch-value" }
+
+ it "refuses to load" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError)
+ end
+ end
+ end
+
+ describe "depends_on x11" do
+ context "valid" do
+ let(:token) { "with-depends-on-x11" }
+
+ it "is allowed to be specified" do
+ expect(cask.depends_on.x11).not_to be nil
+ end
+ end
+
+ context "invalid depends_on x11 value" do
+ let(:token) { "invalid/invalid-depends-on-x11-value" }
+
+ it "refuses to load" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError)
+ end
+ end
+ end
+
+ describe "conflicts_with stanza" do
+ context "valid" do
+ let(:token) { "with-conflicts-with" }
+
+ it "allows conflicts_with stanza to be specified" do
+ expect(cask.conflicts_with.formula).not_to be nil
+ end
+ end
+
+ context "invalid conflicts_with key" do
+ let(:token) { "invalid/invalid-conflicts-with-key" }
+
+ it "refuses to load invalid conflicts_with key" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError)
+ end
+ end
+ end
+
+ describe "installer stanza" do
+ context "script" do
+ let(:token) { "with-installer-script" }
+
+ it "allows installer script to be specified" do
+ expect(cask.artifacts[:installer].first.script[:executable]).to eq("/usr/bin/true")
+ expect(cask.artifacts[:installer].first.script[:args]).to eq(["--flag"])
+ expect(cask.artifacts[:installer].to_a[1].script[:executable]).to eq("/usr/bin/false")
+ expect(cask.artifacts[:installer].to_a[1].script[:args]).to eq(["--flag"])
+ end
+ end
+
+ context "manual" do
+ let(:token) { "with-installer-manual" }
+
+ it "allows installer manual to be specified" do
+ expect(cask.artifacts[:installer].first.manual).to eq("Caffeine.app")
+ end
+ end
+ end
+
+ describe "stage_only stanza" do
+ context "when there is no other activatable artifact" do
+ let(:token) { "stage-only" }
+
+ it "allows stage_only stanza to be specified" do
+ expect(cask.artifacts[:stage_only].first).to eq([true])
+ end
+ end
+
+ context "when there is are activatable artifacts" do
+ let(:token) { "invalid/invalid-stage-only-conflict" }
+
+ it "prevents specifying stage_only" do
+ expect { cask }.to raise_error(Hbc::CaskInvalidError, /'stage_only' must be the only activatable artifact/)
+ end
+ end
+ end
+
+ describe "auto_updates stanza" do
+ let(:token) { "auto-updates" }
+
+ it "allows auto_updates stanza to be specified" do
+ expect(cask.auto_updates).to be true
+ end
+ end
+
+ describe "appdir" do
+ context "interpolation of the appdir in stanzas" do
+ let(:token) { "appdir-interpolation" }
+
+ it "is allowed" do
+ expect(cask.artifacts[:binary].first).to eq(["#{Hbc.appdir}/some/path"])
+ end
+ end
+
+ it "does not include a trailing slash" do
+ begin
+ original_appdir = Hbc.appdir
+ Hbc.appdir = "#{original_appdir}/"
+
+ cask = Hbc::Cask.new("appdir-trailing-slash") do
+ binary "#{appdir}/some/path"
+ end
+
+ expect(cask.artifacts[:binary].first).to eq(["#{original_appdir}/some/path"])
+ ensure
+ Hbc.appdir = original_appdir
+ end
+ end
+ end
+end | true |
Other | Homebrew | brew | d8e515004c68b82532401a26ae0d6a4f27844d91.json | Convert DSL test to spec. | Library/Homebrew/cask/test/cask/dsl_test.rb | @@ -1,479 +0,0 @@
-require "test_helper"
-
-describe Hbc::DSL do
- it "lets you set url, homepage, and version" do
- test_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb")
- test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
- test_cask.homepage.must_equal "http://example.com/"
- test_cask.version.to_s.must_equal "1.2.3"
- end
-
- describe "when a Cask includes an unknown method" do
- attempt_unknown_method = nil
-
- before do
- attempt_unknown_method = lambda do
- Hbc::Cask.new("unexpected-method-cask") do
- future_feature :not_yet_on_your_machine
- end
- end
- end
-
- it "prints a warning that it has encountered an unexpected method" do
- expected = Regexp.compile(<<-EOS.undent.lines.map(&:chomp).join(""))
- (?m)
- Warning:
- .*
- Unexpected method 'future_feature' called on Cask unexpected-method-cask\\.
- .*
- https://github.com/caskroom/homebrew-cask/blob/master/doc/reporting_bugs/pre_bug_report.md
- .*
- https://github.com/caskroom/homebrew-cask#reporting-bugs
- EOS
-
- attempt_unknown_method.must_output nil, expected
- end
-
- it "will simply warn, not throw an exception" do
- begin
- shutup do
- attempt_unknown_method.call
- end
- rescue StandardError => e
- flunk("Wanted unexpected method to simply warn, but got exception #{e}")
- end
- end
- end
-
- describe "header line" do
- it "requires a valid header format" do
- lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-header-format.rb")
- }.must_raise(SyntaxError)
- end
-
- it "requires the header token to match the file name" do
- err = lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-header-token-mismatch.rb")
- }.must_raise(Hbc::CaskTokenDoesNotMatchError)
- err.message.must_include "Bad header line:"
- err.message.must_include "does not match file name"
- end
-
- it "does not require a DSL version in the header" do
- test_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-dsl-version.rb")
- test_cask.token.must_equal "no-dsl-version"
- test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
- test_cask.homepage.must_equal "http://example.com/"
- test_cask.version.to_s.must_equal "1.2.3"
- end
-
- it "may use deprecated DSL version hash syntax" do
- stub = proc do |arg|
- arg == "HOMEBREW_DEVELOPER" ? nil : ENV[arg]
- end
-
- ENV.stub :[], stub do
- shutup do
- test_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-dsl-version.rb")
- test_cask.token.must_equal "with-dsl-version"
- test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
- test_cask.homepage.must_equal "http://example.com/"
- test_cask.version.to_s.must_equal "1.2.3"
- end
- end
- end
- end
-
- describe "name stanza" do
- it "lets you set the full name via a name stanza" do
- cask = Hbc::Cask.new("name-cask") do
- name "Proper Name"
- end
-
- cask.name.must_equal [
- "Proper Name",
- ]
- end
-
- it "Accepts an array value to the name stanza" do
- cask = Hbc::Cask.new("array-name-cask") do
- name ["Proper Name", "Alternate Name"]
- end
-
- cask.name.must_equal [
- "Proper Name",
- "Alternate Name",
- ]
- end
-
- it "Accepts multiple name stanzas" do
- cask = Hbc::Cask.new("multi-name-cask") do
- name "Proper Name"
- name "Alternate Name"
- end
-
- cask.name.must_equal [
- "Proper Name",
- "Alternate Name",
- ]
- end
- end
-
- describe "sha256 stanza" do
- it "lets you set checksum via sha256" do
- cask = Hbc::Cask.new("checksum-cask") do
- sha256 "imasha2"
- end
-
- cask.sha256.must_equal "imasha2"
- end
- end
-
- describe "language stanza" do
- it "allows multilingual casks" do
- cask = lambda do
- Hbc::Cask.new("cask-with-apps") do
- language "zh" do
- sha256 "abc123"
- "zh-CN"
- end
-
- language "en-US", default: true do
- sha256 "xyz789"
- "en-US"
- end
-
- url "https://example.org/#{language}.zip"
- end
- end
-
- MacOS.stub :languages, ["zh"] do
- cask.call.language.must_equal "zh-CN"
- cask.call.sha256.must_equal "abc123"
- cask.call.url.to_s.must_equal "https://example.org/zh-CN.zip"
- end
-
- MacOS.stub :languages, ["zh-XX"] do
- cask.call.language.must_equal "zh-CN"
- cask.call.sha256.must_equal "abc123"
- cask.call.url.to_s.must_equal "https://example.org/zh-CN.zip"
- end
-
- MacOS.stub :languages, ["en"] do
- cask.call.language.must_equal "en-US"
- cask.call.sha256.must_equal "xyz789"
- cask.call.url.to_s.must_equal "https://example.org/en-US.zip"
- end
-
- MacOS.stub :languages, ["xx-XX"] do
- cask.call.language.must_equal "en-US"
- cask.call.sha256.must_equal "xyz789"
- cask.call.url.to_s.must_equal "https://example.org/en-US.zip"
- end
-
- MacOS.stub :languages, ["xx-XX", "zh", "en"] do
- cask.call.language.must_equal "zh-CN"
- cask.call.sha256.must_equal "abc123"
- cask.call.url.to_s.must_equal "https://example.org/zh-CN.zip"
- end
-
- MacOS.stub :languages, ["xx-XX", "en-US", "zh"] do
- cask.call.language.must_equal "en-US"
- cask.call.sha256.must_equal "xyz789"
- cask.call.url.to_s.must_equal "https://example.org/en-US.zip"
- end
- end
- end
-
- describe "app stanza" do
- it "allows you to specify app stanzas" do
- cask = Hbc::Cask.new("cask-with-apps") do
- app "Foo.app"
- app "Bar.app"
- end
-
- Array(cask.artifacts[:app]).must_equal [["Foo.app"], ["Bar.app"]]
- end
-
- it "allow app stanzas to be empty" do
- cask = Hbc::Cask.new("cask-with-no-apps")
- Array(cask.artifacts[:app]).must_equal %w[]
- end
- end
-
- describe "caveats stanza" do
- it "allows caveats to be specified via a method define" do
- cask = Hbc::Cask.new("plain-cask")
-
- cask.caveats.must_be :empty?
-
- cask = Hbc::Cask.new("cask-with-caveats") do
- def caveats; <<-EOS.undent
- When you install this Cask, you probably want to know this.
- EOS
- end
- end
-
- cask.caveats.must_equal "When you install this Cask, you probably want to know this.\n"
- end
- end
-
- describe "pkg stanza" do
- it "allows installable pkgs to be specified" do
- cask = Hbc::Cask.new("cask-with-pkgs") do
- pkg "Foo.pkg"
- pkg "Bar.pkg"
- end
-
- Array(cask.artifacts[:pkg]).must_equal [["Foo.pkg"], ["Bar.pkg"]]
- end
- end
-
- describe "url stanza" do
- it "prevents defining multiple urls" do
- err = lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-two-url.rb")
- }.must_raise(Hbc::CaskInvalidError)
- err.message.must_include "'url' stanza may only appear once"
- end
- end
-
- describe "homepage stanza" do
- it "prevents defining multiple homepages" do
- err = lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-two-homepage.rb")
- }.must_raise(Hbc::CaskInvalidError)
- err.message.must_include "'homepage' stanza may only appear once"
- end
- end
-
- describe "version stanza" do
- it "prevents defining multiple versions" do
- err = lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-two-version.rb")
- }.must_raise(Hbc::CaskInvalidError)
- err.message.must_include "'version' stanza may only appear once"
- end
- end
-
- describe "appcast stanza" do
- it "allows appcasts to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-appcast.rb")
- cask.appcast.to_s.must_match(/^http/)
- end
-
- it "prevents defining multiple appcasts" do
- err = lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-appcast-multiple.rb")
- }.must_raise(Hbc::CaskInvalidError)
- err.message.must_include "'appcast' stanza may only appear once"
- end
-
- it "refuses to load invalid appcast URLs" do
- lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-appcast-url.rb")
- }.must_raise(Hbc::CaskInvalidError)
- end
- end
-
- describe "gpg stanza" do
- it "allows gpg stanza to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-gpg.rb")
- cask.gpg.to_s.must_match(/\S/)
- end
-
- it "allows gpg stanza to be specified with :key_url" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-gpg-key-url.rb")
- cask.gpg.to_s.must_match(/\S/)
- end
-
- it "prevents specifying gpg stanza multiple times" do
- err = lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-multiple-stanzas.rb")
- }.must_raise(Hbc::CaskInvalidError)
- err.message.must_include "'gpg' stanza may only appear once"
- end
-
- it "prevents missing gpg key parameters" do
- err = lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-missing-key.rb")
- }.must_raise(Hbc::CaskInvalidError)
- err.message.must_include "'gpg' stanza must include exactly one"
- end
-
- it "prevents conflicting gpg key parameters" do
- err = lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-conflicting-keys.rb")
- }.must_raise(Hbc::CaskInvalidError)
- err.message.must_include "'gpg' stanza must include exactly one"
- end
-
- it "refuses to load invalid gpg signature URLs" do
- lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-signature-url.rb")
- }.must_raise(Hbc::CaskInvalidError)
- end
-
- it "refuses to load invalid gpg key URLs" do
- lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-key-url.rb")
- }.must_raise(Hbc::CaskInvalidError)
- end
-
- it "refuses to load invalid gpg key IDs" do
- lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-key-id.rb")
- }.must_raise(Hbc::CaskInvalidError)
- end
-
- it "refuses to load if gpg parameter is unknown" do
- lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-parameter.rb")
- }.must_raise(Hbc::CaskInvalidError)
- end
- end
-
- describe "depends_on stanza" do
- it "refuses to load with an invalid depends_on key" do
- lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-key.rb")
- }.must_raise(Hbc::CaskInvalidError)
- end
- end
-
- describe "depends_on formula" do
- it "allows depends_on formula to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-formula.rb")
- cask.depends_on.formula.wont_be_nil
- end
-
- it "allows multiple depends_on formula to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-formula-multiple.rb")
- cask.depends_on.formula.wont_be_nil
- end
- end
-
- describe "depends_on cask" do
- it "allows depends_on cask to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask.rb")
- cask.depends_on.cask.wont_be_nil
- end
-
- it "allows multiple depends_on cask to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-multiple.rb")
- cask.depends_on.cask.wont_be_nil
- end
- end
-
- describe "depends_on macos" do
- it "allows depends_on macos to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-string.rb")
- cask.depends_on.macos.wont_be_nil
- end
- it "refuses to load with an invalid depends_on macos value" do
- lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-macos-bad-release.rb")
- }.must_raise(Hbc::CaskInvalidError)
- end
- it "refuses to load with conflicting depends_on macos forms" do
- lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-macos-conflicting-forms.rb")
- }.must_raise(Hbc::CaskInvalidError)
- end
- end
-
- describe "depends_on arch" do
- it "allows depends_on arch to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-arch.rb")
- cask.depends_on.arch.wont_be_nil
- end
- it "refuses to load with an invalid depends_on arch value" do
- lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-arch-value.rb")
- }.must_raise(Hbc::CaskInvalidError)
- end
- end
-
- describe "depends_on x11" do
- it "allows depends_on x11 to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-x11.rb")
- cask.depends_on.x11.wont_be_nil
- end
- it "refuses to load with an invalid depends_on x11 value" do
- lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-x11-value.rb")
- }.must_raise(Hbc::CaskInvalidError)
- end
- end
-
- describe "conflicts_with stanza" do
- it "allows conflicts_with stanza to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-conflicts-with.rb")
- cask.conflicts_with.formula.wont_be_nil
- end
-
- it "refuses to load invalid conflicts_with key" do
- lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-conflicts-with-key.rb")
- }.must_raise(Hbc::CaskInvalidError)
- end
- end
-
- describe "installer stanza" do
- it "allows installer script to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installer-script.rb")
- cask.artifacts[:installer].first.script[:executable].must_equal "/usr/bin/true"
- cask.artifacts[:installer].first.script[:args].must_equal ["--flag"]
- cask.artifacts[:installer].to_a[1].script[:executable].must_equal "/usr/bin/false"
- cask.artifacts[:installer].to_a[1].script[:args].must_equal ["--flag"]
- end
- it "allows installer manual to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installer-manual.rb")
- cask.artifacts[:installer].first.manual.must_equal "Caffeine.app"
- end
- end
-
- describe "stage_only stanza" do
- it "allows stage_only stanza to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/stage-only.rb")
- cask.artifacts[:stage_only].first.must_equal [true]
- end
-
- it "prevents specifying stage_only with other activatables" do
- err = lambda {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-stage-only-conflict.rb")
- }.must_raise(Hbc::CaskInvalidError)
- err.message.must_include "'stage_only' must be the only activatable artifact"
- end
- end
-
- describe "auto_updates stanza" do
- it "allows auto_updates stanza to be specified" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb")
- cask.auto_updates.must_equal true
- end
- end
-
- describe "appdir" do
- it "allows interpolation of the appdir value in stanzas" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/appdir-interpolation.rb")
- cask.artifacts[:binary].first.must_equal ["#{Hbc.appdir}/some/path"]
- end
-
- it "does not include a trailing slash" do
- original_appdir = Hbc.appdir
- Hbc.appdir = "#{original_appdir}/"
-
- begin
- cask = Hbc::Cask.new("appdir-trailing-slash") do
- binary "#{appdir}/some/path"
- end
-
- cask.artifacts[:binary].first.must_equal ["#{original_appdir}/some/path"]
- ensure
- Hbc.appdir = original_appdir
- end
- end
- end
-end | true |
Other | Homebrew | brew | 8155d27e5c11f9d0adfbb6c911d1c5d6b479aa53.json | Convert Pre/PostflightBlock test to spec. | Library/Homebrew/cask/spec/cask/artifact/postflight_block_spec.rb | @@ -1,9 +1,9 @@
-require "test_helper"
+require "spec_helper"
describe Hbc::Artifact::PostflightBlock do
describe "install_phase" do
it "calls the specified block after installing, passing a Cask mini-dsl" do
- called = false
+ called = false
yielded_arg = nil
cask = Hbc::Cask.new("with-postflight") do
@@ -13,16 +13,16 @@
end
end
- Hbc::Artifact::PostflightBlock.new(cask).install_phase
+ described_class.new(cask).install_phase
- called.must_equal true
- yielded_arg.must_be_kind_of Hbc::DSL::Postflight
+ expect(called).to be true
+ expect(yielded_arg).to be_kind_of(Hbc::DSL::Postflight)
end
end
describe "uninstall_phase" do
it "calls the specified block after uninstalling, passing a Cask mini-dsl" do
- called = false
+ called = false
yielded_arg = nil
cask = Hbc::Cask.new("with-uninstall-postflight") do
@@ -32,10 +32,10 @@
end
end
- Hbc::Artifact::PostflightBlock.new(cask).uninstall_phase
+ described_class.new(cask).uninstall_phase
- called.must_equal true
- yielded_arg.must_be_kind_of Hbc::DSL::UninstallPostflight
+ expect(called).to be true
+ expect(yielded_arg).to be_kind_of(Hbc::DSL::UninstallPostflight)
end
end
end | true |
Other | Homebrew | brew | 8155d27e5c11f9d0adfbb6c911d1c5d6b479aa53.json | Convert Pre/PostflightBlock test to spec. | Library/Homebrew/cask/spec/cask/artifact/preflight_block_spec.rb | @@ -1,9 +1,9 @@
-require "test_helper"
+require "spec_helper"
describe Hbc::Artifact::PreflightBlock do
describe "install_phase" do
it "calls the specified block before installing, passing a Cask mini-dsl" do
- called = false
+ called = false
yielded_arg = nil
cask = Hbc::Cask.new("with-preflight") do
@@ -13,16 +13,16 @@
end
end
- Hbc::Artifact::PreflightBlock.new(cask).install_phase
+ described_class.new(cask).install_phase
- called.must_equal true
- yielded_arg.must_be_kind_of Hbc::DSL::Preflight
+ expect(called).to be true
+ expect(yielded_arg).to be_kind_of Hbc::DSL::Preflight
end
end
describe "uninstall_phase" do
it "calls the specified block before uninstalling, passing a Cask mini-dsl" do
- called = false
+ called = false
yielded_arg = nil
cask = Hbc::Cask.new("with-uninstall-preflight") do
@@ -32,10 +32,10 @@
end
end
- Hbc::Artifact::PreflightBlock.new(cask).uninstall_phase
+ described_class.new(cask).uninstall_phase
- called.must_equal true
- yielded_arg.must_be_kind_of Hbc::DSL::UninstallPreflight
+ expect(called).to be true
+ expect(yielded_arg).to be_kind_of Hbc::DSL::UninstallPreflight
end
end
end | true |
Other | Homebrew | brew | d9d15d3670fa9f425f852feac0868ca2ace8f813.json | Convert `Pkg` test to spec. | Library/Homebrew/cask/spec/cask/pkg_spec.rb | @@ -0,0 +1,114 @@
+require "spec_helper"
+
+describe Hbc::Pkg do
+ describe "uninstall" do
+ let(:fake_system_command) { Hbc::NeverSudoSystemCommand }
+ let(:empty_response) { double(stdout: "") }
+ let(:pkg) { described_class.new("my.fake.pkg", fake_system_command) }
+
+ it "removes files and dirs referenced by the pkg" do
+ some_files = Array.new(3) { Pathname.new(Tempfile.new("testfile").path) }
+ allow(pkg).to receive(:pkgutil_bom_files).and_return(some_files)
+
+ some_specials = Array.new(3) { Pathname.new(Tempfile.new("testfile").path) }
+ allow(pkg).to receive(:pkgutil_bom_specials).and_return(some_specials)
+
+ some_dirs = Array.new(3) { Pathname.new(Dir.mktmpdir) }
+ allow(pkg).to receive(:pkgutil_bom_dirs).and_return(some_dirs)
+
+ allow(pkg).to receive(:forget)
+
+ pkg.uninstall
+
+ some_files.each do |file|
+ expect(file).not_to exist
+ end
+
+ some_dirs.each do |dir|
+ expect(dir).not_to exist
+ end
+ end
+
+ context "pkgutil" do
+ let(:fake_system_command) { class_double(Hbc::SystemCommand) }
+
+ it "forgets the pkg" do
+ allow(fake_system_command).to receive(:run!).with(
+ "/usr/sbin/pkgutil",
+ args: ["--only-files", "--files", "my.fake.pkg"]
+ ).and_return(empty_response)
+
+ allow(fake_system_command).to receive(:run!).with(
+ "/usr/sbin/pkgutil",
+ args: ["--only-dirs", "--files", "my.fake.pkg"]
+ ).and_return(empty_response)
+
+ allow(fake_system_command).to receive(:run!).with(
+ "/usr/sbin/pkgutil",
+ args: ["--files", "my.fake.pkg"]
+ ).and_return(empty_response)
+
+ expect(fake_system_command).to receive(:run!).with(
+ "/usr/sbin/pkgutil",
+ args: ["--forget", "my.fake.pkg"],
+ sudo: true
+ )
+
+ pkg.uninstall
+ end
+ end
+
+ it "removes broken symlinks" do
+ fake_dir = Pathname.new(Dir.mktmpdir)
+ fake_file = fake_dir.join("ima_file").tap { |path| FileUtils.touch(path) }
+
+ intact_symlink = fake_dir.join("intact_symlink").tap { |path| path.make_symlink(fake_file) }
+ broken_symlink = fake_dir.join("broken_symlink").tap { |path| path.make_symlink("im_nota_file") }
+
+ allow(pkg).to receive(:pkgutil_bom_specials).and_return([])
+ allow(pkg).to receive(:pkgutil_bom_files).and_return([])
+ allow(pkg).to receive(:pkgutil_bom_dirs).and_return([fake_dir])
+ allow(pkg).to receive(:forget)
+
+ pkg.uninstall
+
+ expect(intact_symlink).to exist
+ expect(broken_symlink).not_to exist
+ expect(fake_dir).to exist
+ end
+
+ it "removes files incorrectly reportes as directories" do
+ fake_dir = Pathname.new(Dir.mktmpdir)
+ fake_file = fake_dir.join("ima_file_pretending_to_be_a_dir").tap { |path| FileUtils.touch(path) }
+
+ allow(pkg).to receive(:pkgutil_bom_specials).and_return([])
+ allow(pkg).to receive(:pkgutil_bom_files).and_return([])
+ allow(pkg).to receive(:pkgutil_bom_dirs).and_return([fake_file, fake_dir])
+ allow(pkg).to receive(:forget)
+
+ pkg.uninstall
+
+ expect(fake_file).not_to exist
+ expect(fake_dir).not_to exist
+ end
+
+ it "snags permissions on ornery dirs, but returns them afterwards" do
+ fake_dir = Pathname.new(Dir.mktmpdir)
+ fake_file = fake_dir.join("ima_installed_file").tap { |path| FileUtils.touch(path) }
+ fake_dir.chmod(0000)
+
+ allow(pkg).to receive(:pkgutil_bom_specials).and_return([])
+ allow(pkg).to receive(:pkgutil_bom_files).and_return([fake_file])
+ allow(pkg).to receive(:pkgutil_bom_dirs).and_return([fake_dir])
+ allow(pkg).to receive(:forget)
+
+ shutup do
+ pkg.uninstall
+ end
+
+ expect(fake_dir).to be_a_directory
+ expect(fake_file).not_to be_a_file
+ expect((fake_dir.stat.mode % 01000).to_s(8)).to eq("0")
+ end
+ end
+end | true |
Other | Homebrew | brew | d9d15d3670fa9f425f852feac0868ca2ace8f813.json | Convert `Pkg` test to spec. | Library/Homebrew/cask/spec/spec_helper.rb | @@ -41,3 +41,11 @@
]
end
end
+
+module Hbc
+ class NeverSudoSystemCommand < SystemCommand
+ def self.run(command, options = {})
+ super(command, options.merge(sudo: false))
+ end
+ end
+end | true |
Other | Homebrew | brew | d9d15d3670fa9f425f852feac0868ca2ace8f813.json | Convert `Pkg` test to spec. | Library/Homebrew/cask/test/cask/pkg_test.rb | @@ -1,111 +0,0 @@
-require "test_helper"
-
-describe Hbc::Pkg do
- describe "uninstall" do
- it "removes files and dirs referenced by the pkg" do
- pkg = Hbc::Pkg.new("my.fake.pkg", Hbc::NeverSudoSystemCommand)
-
- some_files = Array.new(3) { Pathname.new(Tempfile.new("testfile").path) }
- pkg.stubs(:pkgutil_bom_files).returns some_files
-
- some_specials = Array.new(3) { Pathname.new(Tempfile.new("testfile").path) }
- pkg.stubs(:pkgutil_bom_specials).returns some_specials
-
- some_dirs = Array.new(3) { Pathname.new(Dir.mktmpdir) }
- pkg.stubs(:pkgutil_bom_dirs).returns some_dirs
-
- pkg.stubs(:forget)
-
- pkg.uninstall
-
- some_files.each do |file|
- file.wont_be :exist?
- end
-
- some_dirs.each do |dir|
- dir.wont_be :exist?
- end
- end
-
- it "forgets the pkg" do
- pkg = Hbc::Pkg.new("my.fake.pkg", Hbc::FakeSystemCommand)
-
- Hbc::FakeSystemCommand.stubs_command(
- ["/usr/sbin/pkgutil", "--only-files", "--files", "my.fake.pkg"]
- )
- Hbc::FakeSystemCommand.stubs_command(
- ["/usr/sbin/pkgutil", "--only-dirs", "--files", "my.fake.pkg"]
- )
- Hbc::FakeSystemCommand.stubs_command(
- ["/usr/sbin/pkgutil", "--files", "my.fake.pkg"]
- )
-
- Hbc::FakeSystemCommand.expects_command(
- ["/usr/bin/sudo", "-E", "--", "/usr/sbin/pkgutil", "--forget", "my.fake.pkg"]
- )
-
- pkg.uninstall
- end
-
- it "cleans broken symlinks, but leaves AOK symlinks" do
- pkg = Hbc::Pkg.new("my.fake.pkg", Hbc::NeverSudoSystemCommand)
-
- fake_dir = Pathname.new(Dir.mktmpdir)
- fake_file = fake_dir.join("ima_file").tap { |path| FileUtils.touch(path) }
-
- intact_symlink = fake_dir.join("intact_symlink").tap { |path| path.make_symlink(fake_file) }
- broken_symlink = fake_dir.join("broken_symlink").tap { |path| path.make_symlink("im_nota_file") }
-
- pkg.stubs(:pkgutil_bom_specials).returns([])
- pkg.stubs(:pkgutil_bom_files).returns([])
- pkg.stubs(:pkgutil_bom_dirs).returns([fake_dir])
- pkg.stubs(:forget)
-
- pkg.uninstall
-
- intact_symlink.must_be :exist?
- broken_symlink.wont_be :exist?
- fake_dir.must_be :exist?
- end
-
- it "cleans files incorrectly reported as directories" do
- pkg = Hbc::Pkg.new("my.fake.pkg", Hbc::NeverSudoSystemCommand)
-
- fake_dir = Pathname.new(Dir.mktmpdir)
- fake_file = fake_dir.join("ima_file_pretending_to_be_a_dir").tap { |path| FileUtils.touch(path) }
-
- pkg.stubs(:pkgutil_bom_specials).returns([])
- pkg.stubs(:pkgutil_bom_files).returns([])
- pkg.stubs(:pkgutil_bom_dirs).returns([fake_file, fake_dir])
- pkg.stubs(:forget)
-
- pkg.uninstall
-
- fake_file.wont_be :exist?
- fake_dir.wont_be :exist?
- end
-
- it "snags permissions on ornery dirs, but returns them afterwords" do
- pkg = Hbc::Pkg.new("my.fake.pkg", Hbc::NeverSudoSystemCommand)
-
- fake_dir = Pathname.new(Dir.mktmpdir)
-
- fake_file = fake_dir.join("ima_installed_file").tap { |path| FileUtils.touch(path) }
-
- fake_dir.chmod(0000)
-
- pkg.stubs(:pkgutil_bom_specials).returns([])
- pkg.stubs(:pkgutil_bom_files).returns([fake_file])
- pkg.stubs(:pkgutil_bom_dirs).returns([fake_dir])
- pkg.stubs(:forget)
-
- shutup do
- pkg.uninstall
- end
-
- fake_dir.must_be :directory?
- fake_file.wont_be :file?
- (fake_dir.stat.mode % 01000).to_s(8).must_equal "0"
- end
- end
-end | true |
Other | Homebrew | brew | af8b91746c8ee67cc5c050fdd4182089171dd0ab.json | Convert Accessibility test to spec. | Library/Homebrew/cask/spec/cask/accessibility_spec.rb | @@ -0,0 +1,82 @@
+require "spec_helper"
+
+# TODO: this test should be named after the corresponding class, once
+# that class is abstracted from installer.rb.
+describe "Accessibility Access" do
+ let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-accessibility-access.rb") }
+ let(:fake_system_command) { class_double(Hbc::SystemCommand) }
+ let(:installer) { Hbc::Installer.new(cask, command: fake_system_command) }
+
+ before(:each) do
+ allow(MacOS).to receive(:version).and_return(MacOS::Version.new(macos_version))
+ allow(installer).to receive(:bundle_identifier).and_return("com.example.BasicCask")
+ end
+
+ context "on MacOS 10.8 and below" do
+ let(:macos_version) { "10.8" }
+
+ it "can enable accessibility access in macOS releases prior to Mavericks" do
+ expect(fake_system_command).to receive(:run!).with(
+ "/usr/bin/touch",
+ args: [Hbc.pre_mavericks_accessibility_dotfile],
+ sudo: true
+ )
+
+ shutup do
+ installer.enable_accessibility_access
+ end
+ end
+
+ it "warns about disabling accessibility access on old macOS releases" do
+ expect {
+ installer.disable_accessibility_access
+ }.to output(/Warning: Accessibility access cannot be disabled automatically on this version of macOS\./).to_stderr
+ end
+ end
+
+ context "on MacOS 10.9" do
+ let(:macos_version) { "10.9" }
+
+ it "can enable accessibility access" do
+ expect(fake_system_command).to receive(:run!).with(
+ "/usr/bin/sqlite3",
+ args: [Hbc.tcc_db, "INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','com.example.BasicCask',0,1,1,NULL);"],
+ sudo: true
+ )
+
+ shutup do
+ installer.enable_accessibility_access
+ end
+ end
+
+ it "can disable accessibility access" do
+ expect(fake_system_command).to receive(:run!).with(
+ "/usr/bin/sqlite3",
+ args: [Hbc.tcc_db, "DELETE FROM access WHERE client='com.example.BasicCask';"],
+ sudo: true
+ )
+
+ shutup do
+ installer.disable_accessibility_access
+ end
+ end
+ end
+
+ context "on MacOS 10.12 and above" do
+ let(:macos_version) { "10.12" }
+
+ it "warns about enabling accessibility access on new macOS releases" do
+ expect {
+ expect {
+ installer.enable_accessibility_access
+ }.to output.to_stdout
+ }.to output(/Warning: Accessibility access cannot be enabled automatically on this version of macOS\./).to_stderr
+ end
+
+ it "warns about disabling accessibility access on new macOS releases" do
+ expect {
+ installer.disable_accessibility_access
+ }.to output(/Warning: Accessibility access cannot be disabled automatically on this version of macOS\./).to_stderr
+ end
+ end
+end | true |
Other | Homebrew | brew | af8b91746c8ee67cc5c050fdd4182089171dd0ab.json | Convert Accessibility test to spec. | Library/Homebrew/cask/test/cask/accessibility_test.rb | @@ -1,77 +0,0 @@
-require "test_helper"
-
-# TODO: this test should be named after the corresponding class, once
-# that class is abstracted from installer.rb.
-describe "Accessibility Access" do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-accessibility-access.rb") }
- let(:with_fake_command) { { command: Hbc::FakeSystemCommand } }
- let(:installer) { Hbc::Installer.new(cask, with_fake_command) }
-
- describe "install" do
- it "can enable accessibility access" do
- MacOS.stub :version, MacOS::Version.new("10.9") do
- installer.stub :bundle_identifier, "com.example.BasicCask" do
- Hbc::FakeSystemCommand.expects_command(
- ["/usr/bin/sudo", "-E", "--", "/usr/bin/sqlite3", Hbc.tcc_db, "INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','com.example.BasicCask',0,1,1,NULL);"]
- )
- shutup do
- installer.enable_accessibility_access
- end
- end
- end
- end
-
- it "can enable accessibility access in macOS releases prior to Mavericks" do
- MacOS.stub :version, MacOS::Version.new("10.8") do
- Hbc::FakeSystemCommand.expects_command(
- ["/usr/bin/sudo", "-E", "--", "/usr/bin/touch", Hbc.pre_mavericks_accessibility_dotfile]
- )
- shutup do
- installer.enable_accessibility_access
- end
- end
- end
-
- it "warns about enabling accessibility access on new macOS releases" do
- MacOS.stub :version, MacOS::Version.new("10.12") do
- installer.stub :bundle_identifier, "com.example.BasicCask" do
- capture_io { installer.enable_accessibility_access }[1]
- .must_match("Warning: Accessibility access cannot be enabled automatically on this version of macOS.")
- end
- end
- end
- end
-
- describe "uninstall" do
- it "can disable accessibility access" do
- MacOS.stub :version, MacOS::Version.new("10.9") do
- installer.stub :bundle_identifier, "com.example.BasicCask" do
- Hbc::FakeSystemCommand.expects_command(
- ["/usr/bin/sudo", "-E", "--", "/usr/bin/sqlite3", Hbc.tcc_db, "DELETE FROM access WHERE client='com.example.BasicCask';"]
- )
- shutup do
- installer.disable_accessibility_access
- end
- end
- end
- end
-
- it "warns about disabling accessibility access on old macOS releases" do
- MacOS.stub :version, MacOS::Version.new("10.8") do
- installer.stub :bundle_identifier, "com.example.BasicCask" do
- capture_io { installer.disable_accessibility_access }[1]
- .must_match("Warning: Accessibility access cannot be disabled automatically on this version of macOS.")
- end
- end
- end
-
- it "warns about disabling accessibility access on new macOS releases" do
- MacOS.stub :version, MacOS::Version.new("10.12") do
- installer.stub :bundle_identifier, "com.example.BasicCask" do
- capture_io { installer.disable_accessibility_access }[1]
- .must_match("Warning: Accessibility access cannot be disabled automatically on this version of macOS.")
- end
- end
- end
- end
-end | true |
Other | Homebrew | brew | fe0b68a5ad76bc3a91518f54a97bdd7a9144eda5.json | Convert `Plist` test to spec. | Library/Homebrew/cask/spec/plist/parser_spec.rb | @@ -0,0 +1,75 @@
+require "spec_helper"
+
+describe Plist do
+ subject { described_class.parse_xml(input) }
+
+ describe "::parse_xml" do
+ context "given a hdiutil output as input" do
+ let(:input) {
+ <<-EOS.undent
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+ <plist version="1.0">
+ <dict>
+ <key>system-entities</key>
+ <array>
+ <dict>
+ <key>content-hint</key>
+ <string>Apple_partition_map</string>
+ <key>dev-entry</key>
+ <string>/dev/disk3s1</string>
+ <key>potentially-mountable</key>
+ <false/>
+ <key>unmapped-content-hint</key>
+ <string>Apple_partition_map</string>
+ </dict>
+ <dict>
+ <key>content-hint</key>
+ <string>Apple_partition_scheme</string>
+ <key>dev-entry</key>
+ <string>/dev/disk3</string>
+ <key>potentially-mountable</key>
+ <false/>
+ <key>unmapped-content-hint</key>
+ <string>Apple_partition_scheme</string>
+ </dict>
+ <dict>
+ <key>content-hint</key>
+ <string>Apple_HFS</string>
+ <key>dev-entry</key>
+ <string>/dev/disk3s2</string>
+ <key>mount-point</key>
+ <string>/private/tmp/dmg.BhfS2g</string>
+ <key>potentially-mountable</key>
+ <true/>
+ <key>unmapped-content-hint</key>
+ <string>Apple_HFS</string>
+ <key>volume-kind</key>
+ <string>hfs</string>
+ </dict>
+ </array>
+ </dict>
+ </plist>
+ EOS
+ }
+
+ it "successfully parses it" do
+ expect(subject.keys).to eq(["system-entities"])
+ expect(subject["system-entities"].length).to eq(3)
+ expect(subject["system-entities"].map { |e| e["dev-entry"] }).to eq(
+ %w[
+ /dev/disk3s1
+ /dev/disk3
+ /dev/disk3s2
+ ]
+ )
+ end
+ end
+
+ context "given an empty input" do
+ let(:input) { "" }
+
+ it { is_expected.to be_nil }
+ end
+ end
+end | true |
Other | Homebrew | brew | fe0b68a5ad76bc3a91518f54a97bdd7a9144eda5.json | Convert `Plist` test to spec. | Library/Homebrew/cask/test/plist/parser_test.rb | @@ -1,65 +0,0 @@
-require "test_helper"
-
-describe Plist do
- it "parses some hdiutil output okay" do
- hdiutil_output = <<-EOS.undent
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
- <plist version="1.0">
- <dict>
- <key>system-entities</key>
- <array>
- <dict>
- <key>content-hint</key>
- <string>Apple_partition_map</string>
- <key>dev-entry</key>
- <string>/dev/disk3s1</string>
- <key>potentially-mountable</key>
- <false/>
- <key>unmapped-content-hint</key>
- <string>Apple_partition_map</string>
- </dict>
- <dict>
- <key>content-hint</key>
- <string>Apple_partition_scheme</string>
- <key>dev-entry</key>
- <string>/dev/disk3</string>
- <key>potentially-mountable</key>
- <false/>
- <key>unmapped-content-hint</key>
- <string>Apple_partition_scheme</string>
- </dict>
- <dict>
- <key>content-hint</key>
- <string>Apple_HFS</string>
- <key>dev-entry</key>
- <string>/dev/disk3s2</string>
- <key>mount-point</key>
- <string>/private/tmp/dmg.BhfS2g</string>
- <key>potentially-mountable</key>
- <true/>
- <key>unmapped-content-hint</key>
- <string>Apple_HFS</string>
- <key>volume-kind</key>
- <string>hfs</string>
- </dict>
- </array>
- </dict>
- </plist>
- EOS
-
- parsed = Plist.parse_xml(hdiutil_output)
-
- parsed.keys.must_equal ["system-entities"]
- parsed["system-entities"].length.must_equal 3
- parsed["system-entities"].map { |e| e["dev-entry"] }.must_equal %w[
- /dev/disk3s1
- /dev/disk3
- /dev/disk3s2
- ]
- end
-
- it "does not choke on empty input" do
- Plist.parse_xml("").must_equal {}
- end
-end | true |
Other | Homebrew | brew | 31c51108ce43ae97f6b8c061be90ccc1a567010b.json | Use explicit checks instead of custom matcher. | Library/Homebrew/cask/spec/cask/artifact/binary_spec.rb | @@ -20,7 +20,8 @@
shutup do
Hbc::Artifact::Binary.new(cask).install_phase
end
- expect(expected_path).to be_a_valid_symlink
+ expect(expected_path).to be_a_symlink
+ expect(expected_path.readlink).to exist
end
it "avoids clobbering an existing binary by linking over it" do
@@ -82,7 +83,8 @@
Hbc::Artifact::Binary.new(cask).install_phase
end
- expect(expected_path).to be_a_valid_symlink
+ expect(expected_path).to be_a_symlink
+ expect(expected_path.readlink).to exist
end
end
end | true |
Other | Homebrew | brew | 31c51108ce43ae97f6b8c061be90ccc1a567010b.json | Use explicit checks instead of custom matcher. | Library/Homebrew/cask/spec/spec_helper.rb | @@ -34,5 +34,4 @@
RSpec.configure do |config|
config.order = :random
config.include(Test::Helper::Shutup)
- config.include(FileMatchers)
end | true |
Other | Homebrew | brew | 31c51108ce43ae97f6b8c061be90ccc1a567010b.json | Use explicit checks instead of custom matcher. | Library/Homebrew/cask/spec/support/file_matchers.rb | @@ -1,9 +0,0 @@
-module FileMatchers
- extend RSpec::Matchers::DSL
-
- matcher :be_a_valid_symlink do
- match do |path|
- path.symlink? && path.readlink.exist?
- end
- end
-end | true |
Other | Homebrew | brew | 9aa4888d2b45c7a07a95183cc4c026d828391914.json | README: note MacStadium, add more links. | README.md | @@ -61,15 +61,19 @@ Please consider a regular donation through Patreon:
[](https://www.patreon.com/homebrew)
## Sponsors
-Our CI infrastructure was paid for by [our Kickstarter supporters](http://docs.brew.sh/Kickstarter-Supporters.html).
+Our Xserve ESXi boxes for CI are hosted by [MacStadium](https://www.macstadium.com).
-Our CI infrastructure is hosted by [The Positive Internet Company](http://www.positive-internet.com).
+[](https://www.macstadium.com)
-Our bottles (binary packages) are hosted by Bintray.
+Our Mac Minis for CI were paid for by [our Kickstarter supporters](http://docs.brew.sh/Kickstarter-Supporters.html).
+
+Our Mac Minis for CI are hosted by [The Positive Internet Company](http://www.positive-internet.com).
+
+Our bottles (binary packages) are hosted by [Bintray](https://bintray.com/homebrew).
[](https://bintray.com/homebrew)
-Secure password storage and syncing provided by [1Password for Teams](https://1password.com/teams/) by AgileBits
+Secure password storage and syncing provided by [1Password for Teams](https://1password.com/teams/) by [AgileBits](https://agilebits.com)
[](https://agilebits.com)
| false |
Other | Homebrew | brew | 6cd36428505b1b3548b1e15fe7e0a850b2e2aeaa.json | Create custom matchers for “valid symlink”. | Library/Homebrew/cask/spec/cask/artifact/binary_spec.rb | @@ -20,7 +20,7 @@
shutup do
Hbc::Artifact::Binary.new(cask).install_phase
end
- expect(FileHelper.valid_alias?(expected_path)).to be true
+ expect(expected_path).to be_a_valid_symlink
end
it "avoids clobbering an existing binary by linking over it" do
@@ -82,7 +82,7 @@
Hbc::Artifact::Binary.new(cask).install_phase
end
- expect(FileHelper.valid_alias?(expected_path)).to be true
+ expect(expected_path).to be_a_valid_symlink
end
end
end | true |
Other | Homebrew | brew | 6cd36428505b1b3548b1e15fe7e0a850b2e2aeaa.json | Create custom matchers for “valid symlink”. | Library/Homebrew/cask/spec/spec_helper.rb | @@ -34,4 +34,5 @@
RSpec.configure do |config|
config.order = :random
config.include(Test::Helper::Shutup)
+ config.include(FileMatchers)
end | true |
Other | Homebrew | brew | 6cd36428505b1b3548b1e15fe7e0a850b2e2aeaa.json | Create custom matchers for “valid symlink”. | Library/Homebrew/cask/spec/support/file_helper.rb | @@ -1,8 +0,0 @@
-module FileHelper
- module_function
-
- def valid_alias?(candidate)
- return false unless candidate.symlink?
- candidate.readlink.exist?
- end
-end | true |
Other | Homebrew | brew | 6cd36428505b1b3548b1e15fe7e0a850b2e2aeaa.json | Create custom matchers for “valid symlink”. | Library/Homebrew/cask/spec/support/file_matchers.rb | @@ -0,0 +1,9 @@
+module FileMatchers
+ extend RSpec::Matchers::DSL
+
+ matcher :be_a_valid_symlink do
+ match do |path|
+ path.symlink? && path.readlink.exist?
+ end
+ end
+end | true |
Other | Homebrew | brew | 6cd36428505b1b3548b1e15fe7e0a850b2e2aeaa.json | Create custom matchers for “valid symlink”. | Library/Homebrew/cask/test/cask/artifact/suite_test.rb | @@ -20,7 +20,7 @@
end
target_path.must_be :directory?
- TestHelper.valid_alias?(target_path).must_equal false
+ TestHelper.valid_symlink?(target_path).must_equal false
source_path.wont_be :exist?
end
| true |
Other | Homebrew | brew | 6cd36428505b1b3548b1e15fe7e0a850b2e2aeaa.json | Create custom matchers for “valid symlink”. | Library/Homebrew/cask/test/test_helper.rb | @@ -58,7 +58,7 @@ def self.local_binary_url(name)
"file://" + local_binary_path(name)
end
- def self.valid_alias?(candidate)
+ def self.valid_symlink?(candidate)
return false unless candidate.symlink?
candidate.readlink.exist?
end | true |
Other | Homebrew | brew | 11ebfdafb227ae36559f65c6bd098172301e82f0.json | audit: enforce https for github.com urls | Library/Homebrew/dev-cmd/audit.rb | @@ -1343,6 +1343,7 @@ def audit_urls
%r{^http://(?:[^/]*\.)?bintray\.com/},
%r{^http://tools\.ietf\.org/},
%r{^http://launchpad\.net/},
+ %r{^http://github\.com/},
%r{^http://bitbucket\.org/},
%r{^http://anonscm\.debian\.org/},
%r{^http://cpan\.metacpan\.org/}, | false |
Other | Homebrew | brew | 8113a9fed9fe6dcd41f6a382cb19e61c0abe2887.json | Remove XIP support. | Library/Homebrew/cask/lib/hbc/container.rb | @@ -16,7 +16,6 @@
require "hbc/container/ttf"
require "hbc/container/rar"
require "hbc/container/xar"
-require "hbc/container/xip"
require "hbc/container/xz"
require "hbc/container/zip"
@@ -34,7 +33,6 @@ def self.autodetect_containers
Sit,
Rar,
Zip,
- Xip, # needs to be before xar as this is a cpio inside a gzip inside a xar
Xar, # need to be before tar as tar can also list xar
Tar, # or compressed tar (bzip2/gzip/lzma/xz)
Bzip2, # pure bzip2 | true |
Other | Homebrew | brew | 8113a9fed9fe6dcd41f6a382cb19e61c0abe2887.json | Remove XIP support. | Library/Homebrew/cask/lib/hbc/container/xip.rb | @@ -1,29 +0,0 @@
-require "tmpdir"
-
-module Hbc
- class Container
- class Xip < Base
- def self.me?(criteria)
- criteria.magic_number(/^xar!/n) &&
- IO.popen(["/usr/bin/xar", "-t", "-f", criteria.path.to_s], err: "/dev/null") { |io| io.read =~ /\AContent\nMetadata\n\Z/ }
- end
-
- def extract
- Dir.mktmpdir do |unpack_dir|
- begin
- ohai "Verifying signature for #{@path.basename}"
- @command.run!("/usr/sbin/pkgutil", args: ["--check-signature", @path])
- rescue
- raise "Signature check failed."
- end
-
- @command.run!("/usr/bin/xar", args: ["-x", "-f", @path, "Content", "-C", unpack_dir])
-
- Dir.chdir(@cask.staged_path) do
- @command.run!("/usr/bin/cpio", args: ["--quiet", "-i", "-I", Pathname(unpack_dir).join("Content")])
- end
- end
- end
- end
- end
-end | true |
Other | Homebrew | brew | d8eab8c2114f8f89decb4293283ec747f82f9d08.json | Simplify rendering of environment variables. | Library/Homebrew/cask/lib/hbc/cli/doctor.rb | @@ -7,25 +7,28 @@ def self.run
ohai "Homebrew-Cask Staging Location:", render_staging_location(Hbc.caskroom)
ohai "Homebrew-Cask Cached Downloads:", render_cached_downloads
ohai "Homebrew-Cask Taps:"
- puts render_taps(Hbc.default_tap)
- puts render_taps(*alt_taps)
+ puts render_taps(Hbc.default_tap, *alt_taps)
ohai "Contents of $LOAD_PATH:", render_load_path($LOAD_PATH)
ohai "Environment Variables:"
- render_env_var("RUBYLIB")
- render_env_var("RUBYOPT")
- render_env_var("RUBYPATH")
- render_env_var("RBENV_VERSION")
- render_env_var("CHRUBY_VERSION")
- render_env_var("GEM_HOME")
- render_env_var("GEM_PATH")
- render_env_var("BUNDLE_PATH")
- render_env_var("PATH")
- render_env_var("SHELL")
- locale_variables
+
+ environment_variables = [
+ "RUBYLIB",
+ "RUBYOPT",
+ "RUBYPATH",
+ "RBENV_VERSION",
+ "CHRUBY_VERSION",
+ "GEM_HOME",
+ "GEM_PATH",
+ "BUNDLE_PATH",
+ "PATH",
+ "SHELL",
+ ]
+
+ (locale_variables + environment_variables).sort.each(&method(:render_env_var))
end
def self.locale_variables
- ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).sort.each(&method(:render_env_var))
+ ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).sort
end
def self.none_string
@@ -63,10 +66,9 @@ def self.render_taps(*taps)
end
def self.render_env_var(var)
- if ENV.key?(var)
- var = %Q(#{var}="#{ENV[var]}")
- puts user_tilde(var)
- end
+ return unless ENV.key?(var)
+ var = %Q(#{var}="#{ENV[var]}")
+ puts user_tilde(var)
end
def self.user_tilde(path) | false |
Other | Homebrew | brew | 46e051b1c2ed44ce4db151da9a09a1870c485334.json | Simplify cache output. | Library/Homebrew/cask/lib/hbc/cli/doctor.rb | @@ -106,13 +106,11 @@ def self.render_load_path(paths)
def self.render_cached_downloads
cleanup = CLI::Cleanup.default
- files = cleanup.cache_files
- count = files.count
+ count = cleanup.cache_files.count
size = cleanup.disk_cleanup_size
- size_msg = "#{number_readable(count)} files, #{disk_usage_readable(size)}"
- warn_msg = error_string('warning: run "brew cask cleanup"')
- size_msg << " #{warn_msg}" if count > 0
- [Hbc.cache, size_msg]
+ msg = user_tilde(Hbc.cache.to_s)
+ msg << " (#{number_readable(count)} files, #{disk_usage_readable(size)})" unless count.zero?
+ msg
end
def self.help | false |
Other | Homebrew | brew | 7d312e4ccadd1852b0ae956e19248eea7ec13696.json | Remove legacy tap pattern. | Library/Homebrew/cask/lib/hbc/cli/doctor.rb | @@ -31,10 +31,6 @@ def self.none_string
"<NONE>"
end
- def self.legacy_tap_pattern
- /phinze/
- end
-
def self.error_string(string = "Error")
Formatter.error("(#{string})")
end
@@ -59,8 +55,6 @@ def self.render_taps(*taps)
taps.collect do |tap|
if tap.path.nil? || tap.path.to_s.empty?
none_string
- elsif tap.path.to_s.match(legacy_tap_pattern)
- tap.path.to_s.concat(" #{error_string "Warning: legacy tap path"}")
else
"#{tap.path} (#{cask_count_for_tap(tap)})"
end | false |
Other | Homebrew | brew | 6594650eb1c37170e7d70e7e9c75b48d154e38a9.json | Pass invalid option names to formula installer
This is the same that happens in the command 'install'. By passing
the invalid option names, we enable the formula installer to output
warnings if necessary. | Library/Homebrew/cmd/reinstall.rb | @@ -25,19 +25,21 @@ def reinstall_formula(f)
backup keg
end
- options = BuildOptions.new(Options.create(ARGV.flags_only), f.options).used_options
+ build_options = BuildOptions.new(Options.create(ARGV.flags_only), f.options)
+ options = build_options.used_options
options |= f.build.used_options
options &= f.options
fi = FormulaInstaller.new(f)
- fi.options = options
- fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
- fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
- fi.force_bottle = ARGV.force_bottle?
- fi.interactive = ARGV.interactive?
- fi.git = ARGV.git?
- fi.verbose = ARGV.verbose?
- fi.debug = ARGV.debug?
+ fi.options = options
+ fi.invalid_option_names = build_options.invalid_option_names
+ fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
+ fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
+ fi.force_bottle = ARGV.force_bottle?
+ fi.interactive = ARGV.interactive?
+ fi.git = ARGV.git?
+ fi.verbose = ARGV.verbose?
+ fi.debug = ARGV.debug?
fi.prelude
oh1 "Reinstalling #{f.full_name} #{options.to_a.join " "}" | false |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/cask/lib/hbc/cask_loader.rb | @@ -36,11 +36,6 @@ def cask(header_token, &block)
build_cask(header_token, &block)
end
- def test_cask(header_token, &block)
- @klass = TestCask
- build_cask(header_token, &block)
- end
-
def build_cask(header_token, &block)
raise CaskTokenDoesNotMatchError.new(@token, header_token) unless @token == header_token
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/cask/spec/spec_helper.rb | @@ -21,10 +21,6 @@
require "hbc"
-module Hbc
- class TestCask < Cask; end
-end
-
# create and override default directories
Hbc.appdir = Pathname.new(TEST_TMPDIR).join("Applications").tap(&:mkpath)
Hbc.cache.mkpath | true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/cask/test/cask/cli/cat_test.rb | @@ -4,7 +4,7 @@
describe "given a basic Cask" do
before do
@expected_output = <<-EOS.undent
- test_cask 'basic-cask' do
+ cask 'basic-cask' do
version '1.2.3'
sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/cask/test/test_helper.rb | @@ -35,10 +35,6 @@ def sudo(*args)
# our baby
require "hbc"
-module Hbc
- class TestCask < Cask; end
-end
-
# create and override default directories
Hbc.appdir = Pathname.new(TEST_TMPDIR).join("Applications").tap(&:mkpath)
Hbc.cache.mkpath | true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/appcast-checkpoint-sha256-for-empty-string.rb | @@ -1,4 +1,4 @@
-test_cask 'appcast-checkpoint-sha256-for-empty-string' do
+cask 'appcast-checkpoint-sha256-for-empty-string' do
appcast 'http://localhost/appcast.xml',
checkpoint: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
end | true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/appcast-invalid-checkpoint.rb | @@ -1,4 +1,4 @@
-test_cask 'appcast-invalid-checkpoint' do
+cask 'appcast-invalid-checkpoint' do
appcast 'http://localhost/appcast.xml',
checkpoint: 'not a valid shasum'
end | true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/appcast-missing-checkpoint.rb | @@ -1,3 +1,3 @@
-test_cask 'appcast-missing-checkpoint' do
+cask 'appcast-missing-checkpoint' do
appcast 'http://localhost/appcast.xml'
end | true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/appcast-valid-checkpoint.rb | @@ -1,4 +1,4 @@
-test_cask 'appcast-valid-checkpoint' do
+cask 'appcast-valid-checkpoint' do
appcast 'http://localhost/appcast.xml',
checkpoint: 'd5b2dfbef7ea28c25f7a77cd7fa14d013d82b626db1d82e00e25822464ba19e2'
end | true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/appdir-interpolation.rb | @@ -1,4 +1,4 @@
-test_cask 'appdir-interpolation' do
+cask 'appdir-interpolation' do
version '2.61'
sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/auto-updates.rb | @@ -1,4 +1,4 @@
-test_cask 'auto-updates' do
+cask 'auto-updates' do
version '2.61'
sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/bad-checksum.rb | @@ -1,4 +1,4 @@
-test_cask 'bad-checksum' do
+cask 'bad-checksum' do
version '1.2.3'
sha256 'badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/basic-cask.rb | @@ -1,4 +1,4 @@
-test_cask 'basic-cask' do
+cask 'basic-cask' do
version '1.2.3'
sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-7z.rb | @@ -1,4 +1,4 @@
-test_cask 'container-7z' do
+cask 'container-7z' do
version '1.2.3'
sha256 '3f9542ace85ed5f88549e2d0ea82210f8ddc87e0defbb78469d3aed719b3c964'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-air.rb | @@ -1,4 +1,4 @@
-test_cask 'container-air' do
+cask 'container-air' do
version '0.1'
sha256 '554472e163f8a028629b12b468e29acda9f16b223dff74fcd218bba73cc2365a'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-bzip2.rb | @@ -1,4 +1,4 @@
-test_cask 'container-bzip2' do
+cask 'container-bzip2' do
version '1.2.3'
sha256 'eaf67b3a62cb9275f96e45d05c70b94bef9ef1dae344083e93eda6b0b388a61c'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-cab.rb | @@ -1,4 +1,4 @@
-test_cask 'container-cab' do
+cask 'container-cab' do
version '1.2.3'
sha256 'c267f5cebb14814c8e612a8b7d2bda02aec913f869509b6f1d3883427c0f552b'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-dmg.rb | @@ -1,4 +1,4 @@
-test_cask 'container-dmg' do
+cask 'container-dmg' do
version '1.2.3'
sha256 '74d89d4fa5cef175cf43666ce11fefa3741aa1522114042ac75e656be37141a1'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-gzip.rb | @@ -1,4 +1,4 @@
-test_cask 'container-gzip' do
+cask 'container-gzip' do
version '1.2.3'
sha256 'fa4ebb5246583c4b6e62e1df4e3b71b4e38a1d7d91c025665827195d36214b20'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-lzma.rb | @@ -1,4 +1,4 @@
-test_cask 'container-lzma' do
+cask 'container-lzma' do
version '1.2.3'
sha256 '9d7edb32d02ab9bd9749a5bde8756595ea4cfcb1da02ca11c30fb591d4c1ed85'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-pkg.rb | @@ -1,4 +1,4 @@
-test_cask 'container-pkg' do
+cask 'container-pkg' do
version '1.2.3'
sha256 '611c50c8a2a2098951d2cd0fd54787ed81b92cd97b4b08bd7cba17f1e1d8e40b'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-rar.rb | @@ -1,4 +1,4 @@
-test_cask 'container-rar' do
+cask 'container-rar' do
version '1.2.3'
sha256 '419af7864c0e1f125515c49b08bd22e0f7de39f5285897c440fe03c714871763'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-sit.rb | @@ -1,4 +1,4 @@
-test_cask 'container-sit' do
+cask 'container-sit' do
version '1.2.3'
sha256 '0d21a64dce625044345c8ecca888e5439feaf254dac7f884917028a744f93cf3'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-tar-gz.rb | @@ -1,4 +1,4 @@
-test_cask 'container-tar-gz' do
+cask 'container-tar-gz' do
version '1.2.3'
sha256 'fab685fabf73d5a9382581ce8698fce9408f5feaa49fa10d9bc6c510493300f5'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-xar.rb | @@ -1,4 +1,4 @@
-test_cask 'container-xar' do
+cask 'container-xar' do
version '1.2.3'
sha256 '5bb8e09a6fc630ebeaf266b1fd2d15e2ae7d32d7e4da6668a8093426fa1ba509'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/container-xz.rb | @@ -1,4 +1,4 @@
-test_cask 'container-xz' do
+cask 'container-xz' do
version '1.2.3'
sha256 '839263f474edde1d54a9101606e6f0dc9d963acc93f6dcc5af8d10ebc3187c02'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-absolute-target.rb | @@ -1,3 +1,3 @@
-test_cask 'generic-artifact-absolute-target' do
+cask 'generic-artifact-absolute-target' do
artifact 'Caffeine.app', target: "#{Hbc.appdir}/Caffeine.app"
end | true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-no-target.rb | @@ -1,3 +1,3 @@
-test_cask 'generic-artifact-no-target' do
+cask 'generic-artifact-no-target' do
artifact 'Caffeine.app'
end | true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/generic-artifact-relative-target.rb | @@ -1,3 +1,3 @@
-test_cask 'generic-artifact-relative-target' do
+cask 'generic-artifact-relative-target' do
artifact 'Caffeine.app', target: 'Caffeine.app'
end | true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid-sha256.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-sha256' do
+cask 'invalid-sha256' do
version '1.2.3'
sha256 'not a valid shasum'
end | true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-multiple.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-appcast-multiple' do
+cask 'invalid-appcast-multiple' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-appcast-url.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-appcast-url' do
+cask 'invalid-appcast-url' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-conflicts-with-key.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-conflicts-with-key' do
+cask 'invalid-conflicts-with-key' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-arch-value.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-depends-on-arch-value' do
+cask 'invalid-depends-on-arch-value' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-key.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-depends-on-key' do
+cask 'invalid-depends-on-key' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-bad-release.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-depends-on-macos-bad-release' do
+cask 'invalid-depends-on-macos-bad-release' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-macos-conflicting-forms.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-depends-on-macos-conflicting-forms' do
+cask 'invalid-depends-on-macos-conflicting-forms' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-depends-on-x11-value.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-depends-on-x11-value' do
+cask 'invalid-depends-on-x11-value' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-conflicting-keys.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-gpg-conflicting-keys' do
+cask 'invalid-gpg-conflicting-keys' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-key-id.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-gpg-key-id' do
+cask 'invalid-gpg-key-id' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-key-url.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-gpg-key-url' do
+cask 'invalid-gpg-key-url' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-missing-key.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-gpg-missing-key' do
+cask 'invalid-gpg-missing-key' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-multiple-stanzas.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-gpg-multiple-stanzas' do
+cask 'invalid-gpg-multiple-stanzas' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-parameter.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-gpg-parameter' do
+cask 'invalid-gpg-parameter' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-signature-url.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-gpg-signature-url' do
+cask 'invalid-gpg-signature-url' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-gpg-type.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-gpg-type' do
+cask 'invalid-gpg-type' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-format.rb | @@ -1,4 +1,4 @@
-test_cask => 'invalid-header-format' do
+cask => 'invalid-header-format' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-token-mismatch.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-header-token-mismatch-this-text-does-not-belong' do
+cask 'invalid-header-token-mismatch-this-text-does-not-belong' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-header-version.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-header-version' do
+cask 'invalid-header-version' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-stage-only-conflict.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-stage-only-conflict' do
+cask 'invalid-stage-only-conflict' do
version '2.61'
sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-homepage.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-two-homepage' do
+cask 'invalid-two-homepage' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-url.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-two-url' do
+cask 'invalid-two-url' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/invalid/invalid-two-version.rb | @@ -1,4 +1,4 @@
-test_cask 'invalid-two-version' do
+cask 'invalid-two-version' do
version '1.2.3'
version '2.0'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94' | true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/local-caffeine.rb | @@ -1,4 +1,4 @@
-test_cask 'local-caffeine' do
+cask 'local-caffeine' do
version '1.2.3'
sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/local-transmission.rb | @@ -1,4 +1,4 @@
-test_cask 'local-transmission' do
+cask 'local-transmission' do
version '2.61'
sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
| true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/missing-checksum.rb | @@ -1,4 +1,4 @@
-test_cask 'missing-checksum' do
+cask 'missing-checksum' do
version '1.2.3'
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip" | true |
Other | Homebrew | brew | 4eef60c6a6d9c39cb6f4261f80bb6f8b1f895b03.json | Remove `TestCask` class. | Library/Homebrew/test/support/fixtures/cask/Casks/missing-homepage.rb | @@ -1,4 +1,4 @@
-test_cask 'missing-homepage' do
+cask 'missing-homepage' do
version '1.2.3'
url 'http://localhost/something.dmg' | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.