diff --git a/lib/crontab/cron_expression/parser.ex b/lib/crontab/cron_expression/parser.ex index b88d92a..4109c85 100644 --- a/lib/crontab/cron_expression/parser.ex +++ b/lib/crontab/cron_expression/parser.ex @@ -17,7 +17,7 @@ defmodule Crontab.CronExpression.Parser do midnight: %CronExpression{minute: [0], hour: [0]}, hourly: %CronExpression{minute: [0]}, minutely: %CronExpression{}, - secondly: %CronExpression{}, + secondly: %CronExpression{extended: true}, } @intervals [ diff --git a/test/crontab/cron_expression/parser_test.exs b/test/crontab/cron_expression/parser_test.exs index ab23745..f7112fd 100644 --- a/test/crontab/cron_expression/parser_test.exs +++ b/test/crontab/cron_expression/parser_test.exs @@ -43,6 +43,14 @@ defmodule Crontab.CronExpression.ParserTest do assert parse("@hourly") == {:ok, %Crontab.CronExpression{minute: [0], hour: [:*], day: [:*], month: [:*], weekday: [:*], year: [:*]}} end + test "parse \"@minutely\" gives hourly" do + assert parse("@minutely") == {:ok, %Crontab.CronExpression{minute: [:*], hour: [:*], day: [:*], month: [:*], weekday: [:*], year: [:*]}} + end + + test "parse \"@secondly\" gives hourly" do + assert parse("@secondly") == {:ok, %Crontab.CronExpression{extended: true, second: [:*], minute: [:*], hour: [:*], day: [:*], month: [:*], weekday: [:*], year: [:*]}} + end + test "parse \"1 2 3 4 5 6 7\" gives error" do assert parse("1 2 3 4 5 6 7") == {:error, "The Cron Format String contains to many parts."} end