2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
describe Cask::Cmd, :cask do
|
2016-08-18 22:11:42 +03:00
|
|
|
it "supports setting the appdir" do
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help", "--appdir=/some/path/foo")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.appdir).to eq(Pathname.new("/some/path/foo"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the appdir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--appdir=/some/path/bar"
|
|
|
|
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.appdir).to eq(Pathname.new("/some/path/bar"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the prefpanedir" do
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help", "--prefpanedir=/some/path/foo")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.prefpanedir).to eq(Pathname.new("/some/path/foo"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the prefpanedir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--prefpanedir=/some/path/bar"
|
|
|
|
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.prefpanedir).to eq(Pathname.new("/some/path/bar"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the qlplugindir" do
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help", "--qlplugindir=/some/path/foo")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.qlplugindir).to eq(Pathname.new("/some/path/foo"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the qlplugindir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--qlplugindir=/some/path/bar"
|
|
|
|
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.qlplugindir).to eq(Pathname.new("/some/path/bar"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
2020-04-05 16:35:39 +02:00
|
|
|
it "supports setting the mdimporterdir" do
|
|
|
|
described_class.new.process_options("help", "--mdimporterdir=/some/path/foo")
|
|
|
|
|
|
|
|
expect(Cask::Config.global.mdimporterdir).to eq(Pathname.new("/some/path/foo"))
|
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the mdimporterdir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--mdimporterdir=/some/path/bar"
|
|
|
|
|
|
|
|
described_class.new.process_options("help")
|
|
|
|
|
|
|
|
expect(Cask::Config.global.mdimporterdir).to eq(Pathname.new("/some/path/bar"))
|
|
|
|
end
|
|
|
|
|
2016-08-18 22:11:42 +03:00
|
|
|
it "supports setting the colorpickerdir" do
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help", "--colorpickerdir=/some/path/foo")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.colorpickerdir).to eq(Pathname.new("/some/path/foo"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the colorpickerdir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--colorpickerdir=/some/path/bar"
|
|
|
|
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.colorpickerdir).to eq(Pathname.new("/some/path/bar"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
2016-10-23 17:32:19 +02:00
|
|
|
it "supports setting the dictionarydir" do
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help", "--dictionarydir=/some/path/foo")
|
2016-10-23 17:32:19 +02:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.dictionarydir).to eq(Pathname.new("/some/path/foo"))
|
2016-10-23 17:32:19 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the dictionarydir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--dictionarydir=/some/path/bar"
|
|
|
|
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help")
|
2016-10-23 17:32:19 +02:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.dictionarydir).to eq(Pathname.new("/some/path/bar"))
|
2016-10-23 17:32:19 +02:00
|
|
|
end
|
|
|
|
|
2016-08-18 22:11:42 +03:00
|
|
|
it "supports setting the fontdir" do
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help", "--fontdir=/some/path/foo")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.fontdir).to eq(Pathname.new("/some/path/foo"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the fontdir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--fontdir=/some/path/bar"
|
|
|
|
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.fontdir).to eq(Pathname.new("/some/path/bar"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the servicedir" do
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help", "--servicedir=/some/path/foo")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.servicedir).to eq(Pathname.new("/some/path/foo"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "supports setting the servicedir from ENV" do
|
|
|
|
ENV["HOMEBREW_CASK_OPTS"] = "--servicedir=/some/path/bar"
|
|
|
|
|
2017-10-03 10:49:58 +02:00
|
|
|
described_class.new.process_options("help")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.servicedir).to eq(Pathname.new("/some/path/bar"))
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it "allows additional options to be passed through" do
|
2017-10-03 10:49:58 +02:00
|
|
|
rest = described_class.new.process_options("edit", "foo", "--create", "--appdir=/some/path/qux")
|
2016-08-18 22:11:42 +03:00
|
|
|
|
2018-09-06 08:29:14 +02:00
|
|
|
expect(Cask::Config.global.appdir).to eq(Pathname.new("/some/path/qux"))
|
2017-02-08 13:25:10 +01:00
|
|
|
expect(rest).to eq(%w[edit foo --create])
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "--help" do
|
|
|
|
it "sets the Cask help method to true" do
|
2017-10-03 10:49:58 +02:00
|
|
|
command = described_class.new("foo", "--help")
|
2017-05-21 02:32:46 +02:00
|
|
|
expect(command.help?).to be true
|
2016-08-18 22:11:42 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|