Raise error when passed invalid config file path

This commit is contained in:
Stuart Frost 2023-07-24 15:30:38 +01:00
parent 8c9d234d0b
commit 01a943d0d6
2 changed files with 10 additions and 2 deletions

View file

@ -20,8 +20,14 @@ module Ameba::Cli
%w(-c --config).each do |f|
it "accepts #{f} flag" do
c = Cli.parse_args [f, "config.yml"]
c.config.should eq Path["config.yml"]
c = Cli.parse_args [f, "shard.yml"]
c.config.should eq Path["shard.yml"]
end
it "raises when config file doesn't exist" do
expect_raises(ArgumentError, "Unable to find config file foo.yml") do
Cli.parse_args [f, "foo.yml"]
end
end
end