mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
parent
bfe18f4a77
commit
1d436fbb94
5 changed files with 53 additions and 25 deletions
|
@ -3,10 +3,6 @@ require "../../../src/ameba/cli/cmd"
|
|||
|
||||
module Ameba::Cli
|
||||
describe "Cmd" do
|
||||
it "has a list of available formatters" do
|
||||
AVAILABLE_FORMATTERS.should_not be_nil
|
||||
end
|
||||
|
||||
describe ".run" do
|
||||
it "runs ameba" do
|
||||
r = Cli.run %w(-f silent file.cr)
|
||||
|
@ -58,7 +54,7 @@ module Ameba::Cli
|
|||
|
||||
it "allows args to be blank" do
|
||||
c = Cli.parse_args [] of String
|
||||
c.formatter.should eq :progress
|
||||
c.formatter.should be_nil
|
||||
c.files.should be_nil
|
||||
c.only.should be_nil
|
||||
c.except.should be_nil
|
||||
|
|
|
@ -4,6 +4,10 @@ module Ameba
|
|||
describe Config do
|
||||
config_sample = "config/ameba.yml"
|
||||
|
||||
it "should have a list of available formatters" do
|
||||
Config::AVAILABLE_FORMATTERS.should_not be_nil
|
||||
end
|
||||
|
||||
describe ".load" do
|
||||
it "loads custom config" do
|
||||
config = Config.load config_sample
|
||||
|
@ -45,6 +49,17 @@ module Ameba
|
|||
config.formatter = formatter
|
||||
config.formatter.should eq formatter
|
||||
end
|
||||
|
||||
it "allows to set formatter using a name" do
|
||||
config.formatter = :progress
|
||||
config.formatter.should_not be_nil
|
||||
end
|
||||
|
||||
it "raises an error if not available formatter is set" do
|
||||
expect_raises(Exception) do
|
||||
config.formatter = :no_such_formatter
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#update_rule" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue