summaryrefslogtreecommitdiff
path: root/spec/unit/provider
diff options
context:
space:
mode:
authorantima-gupta <agupta@msystechnologies.com>2020-05-08 17:56:56 +0530
committerantima-gupta <agupta@msystechnologies.com>2020-06-10 10:51:40 +0530
commit578a69011eadda14e51c2ca83f9206f58b9a6243 (patch)
tree62ee4ddf2ef2fe7ce8fd94762a11fc08c033a0aa /spec/unit/provider
parent4be3d8d01e9b757444d8e374ac0a541a68f75dab (diff)
downloadchef-578a69011eadda14e51c2ca83f9206f58b9a6243.tar.gz
Fixed cron resource weekday property.
Implemented same weekday functionality for cron_d resource. Fixed rspec failure. Added cron helper for weekday functionality Added spec for cron helper. Signed-off-by: antima-gupta <agupta@msystechnologies.com>
Diffstat (limited to 'spec/unit/provider')
-rw-r--r--spec/unit/provider/cron_spec.rb44
1 files changed, 1 insertions, 43 deletions
diff --git a/spec/unit/provider/cron_spec.rb b/spec/unit/provider/cron_spec.rb
index bebde66a8b..da77e6698c 100644
--- a/spec/unit/provider/cron_spec.rb
+++ b/spec/unit/provider/cron_spec.rb
@@ -322,7 +322,7 @@ describe Chef::Provider::Cron do
expect(cron.hour).to eq("5")
expect(cron.day).to eq("*")
expect(cron.month).to eq("Jan")
- expect(cron.weekday).to eq("Mon")
+ expect(cron.weekday).to eq("1")
expect(cron.command).to eq("/bin/true param1 param2")
end
@@ -1040,48 +1040,6 @@ describe Chef::Provider::Cron do
end
end
- describe "weekday_in_crontab" do
- context "when weekday is symbol" do
- it "should return weekday in crontab format" do
- @new_resource.weekday :wednesday
- expect(@provider.send(:weekday_in_crontab)).to eq("3")
- end
-
- it "should raise an error with an unknown weekday" do
- expect { @new_resource.weekday :caturday }.to raise_error(RangeError)
- end
- end
-
- context "when weekday is a number in a string" do
- it "should return the string" do
- @new_resource.weekday "3"
- expect(@provider.send(:weekday_in_crontab)).to eq("3")
- end
-
- it "should raise an error with an out of range number" do
- expect { @new_resource.weekday "-1" }.to raise_error(RangeError)
- end
- end
-
- context "when weekday is string with the name of the week" do
- it "should return the string" do
- @new_resource.weekday "mon"
- expect(@provider.send(:weekday_in_crontab)).to eq("mon")
- end
- end
-
- context "when weekday is an integer" do
- it "should return the integer" do
- @new_resource.weekday 1
- expect(@provider.send(:weekday_in_crontab)).to eq("1")
- end
-
- it "should raise an error with an out of range integer" do
- expect { @new_resource.weekday 45 }.to raise_error(RangeError)
- end
- end
- end
-
describe "#env_var_str" do
context "when no env vars are set" do
it "returns an empty string" do