Sha256: 92cd530af717b7254fe5d317216d20a709ffb826efe9023a35d6c52775e22ead
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
require "spec_helper" RSpec.describe CronToGoSync::Parser do describe "#parse_hash" do it "accepts a valid schedule" do input_hash = {"job_name" => {schedule: "* * * * *", enabled: true, ttl: 86400, dyno_size: "Basic", command: "/bin/true"}} expect(described_class.parse_hash(input_hash)).to eq({ "job_name" => { alias: "job_name", schedule: "* * * * *", enabled: true, ttl: 86400, dyno_size: "Basic", command: "/bin/true" } }) end it "validates number of fields" do input_hash = {"job_name" => {schedule: "* * * *", enabled: true, ttl: 86400, dyno_size: "Basic", command: "/bin/true"}} expect { described_class.parse_hash(input_hash) }.to raise_error(RuntimeError, /must contain exactly five fields/) end it "validates schedule numerator" do input_hash = {"job_name" => {schedule: "* 25 * * *", enabled: true, ttl: 86400, dyno_size: "Basic", command: "/bin/true"}} expect { described_class.parse_hash(input_hash) }.to raise_error(RuntimeError, /invalid range value/) end it "validates schedule denominator" do input_hash = {"job_name" => {schedule: "*/99 * * * *", enabled: true, ttl: 86400, dyno_size: "Basic", command: "/bin/true"}} expect { described_class.parse_hash(input_hash) }.to raise_error(RuntimeError, /invalid denominator value/) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cron_to_go_sync-0.0.2 | spec/parser_spec.rb |
cron_to_go_sync-0.0.1 | spec/parser_spec.rb |