Skip to content

Commit

Permalink
Fix Special Expressions secondly
Browse files Browse the repository at this point in the history
  • Loading branch information
maennchen committed Jul 11, 2017
1 parent 13e095f commit 9a51fb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/crontab/cron_expression/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
8 changes: 8 additions & 0 deletions test/crontab/cron_expression/parser_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9a51fb3

Please sign in to comment.