summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasu1105 <vasundhara.jagdale@msystechnologies.com>2017-12-19 10:35:30 +0000
committerVasu1105 <vasundhara.jagdale@msystechnologies.com>2018-01-05 06:38:55 +0000
commitdba1aa7fd9e8358abea5e1dcd26e2430645d5c8b (patch)
tree369a6fb7f476667c42730ae1e957877d2d9ca966
parentaefec12e4657657b1227af0be373c1644cddbe1e (diff)
downloadchef-dba1aa7fd9e8358abea5e1dcd26e2430645d5c8b.tar.gz
Fixed chefstyle issues
Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
-rw-r--r--lib/chef/provider/windows_task.rb8
-rw-r--r--spec/unit/provider/windows_task_spec.rb34
-rw-r--r--spec/unit/resource/windows_task_spec.rb2
3 files changed, 22 insertions, 22 deletions
diff --git a/lib/chef/provider/windows_task.rb b/lib/chef/provider/windows_task.rb
index d2d7397352..8f9995203f 100644
--- a/lib/chef/provider/windows_task.rb
+++ b/lib/chef/provider/windows_task.rb
@@ -251,9 +251,9 @@ class Chef
def random_delay_updated?
if new_resource.random_delay.nil?
false
- elsif current_resource.random_delay.nil? && new_resource.random_delay == 'PT0S' # when user sets random_dealy to 0 sec
+ elsif current_resource.random_delay.nil? && new_resource.random_delay == "PT0S" # when user sets random_dealy to 0 sec
false
- elsif current_resource.random_delay.nil? && new_resource.random_delay != nil
+ elsif current_resource.random_delay.nil? && !new_resource.random_delay.nil?
true
else
ISO8601::Duration.new(current_resource.random_delay) != ISO8601::Duration.new(new_resource.random_delay)
@@ -264,9 +264,9 @@ class Chef
def execution_time_limit_updated?
if new_resource.execution_time_limit.nil?
false
- elsif current_resource.execution_time_limit.nil? && new_resource.execution_time_limit == 'PT0S' # when user sets random_dealy to 0 sec
+ elsif current_resource.execution_time_limit.nil? && new_resource.execution_time_limit == "PT0S" # when user sets random_dealy to 0 sec
false
- elsif current_resource.execution_time_limit.nil? && new_resource.execution_time_limit != nil
+ elsif current_resource.execution_time_limit.nil? && !new_resource.execution_time_limit.nil?
true
else
ISO8601::Duration.new(current_resource.execution_time_limit) != ISO8601::Duration.new(new_resource.execution_time_limit)
diff --git a/spec/unit/provider/windows_task_spec.rb b/spec/unit/provider/windows_task_spec.rb
index f06d847b17..a71ce92f56 100644
--- a/spec/unit/provider/windows_task_spec.rb
+++ b/spec/unit/provider/windows_task_spec.rb
@@ -636,39 +636,39 @@ describe Chef::Provider::WindowsTask do
task_hash[:random_delay] = nil
allow(provider).to receive(:load_task_hash).and_return(task_hash)
provider.load_current_resource
- new_resource.random_delay = 'PT0S'
+ new_resource.random_delay = "PT0S"
expect(provider.send(:random_delay_updated?)).to be(false)
end
it "returns false if current_resource.random_delay = 'P7D' & random_delay is set to '604800' seconds " do
- task_hash[:random_delay] = 'P7D'
+ task_hash[:random_delay] = "P7D"
allow(provider).to receive(:load_task_hash).and_return(task_hash)
provider.load_current_resource
- new_resource.random_delay = 'PT604800S'
+ new_resource.random_delay = "PT604800S"
expect(provider.send(:random_delay_updated?)).to be(false)
end
it "returns false if current_resource.random_delay = 'P7DT1S' & random_delay is set to '604801' seconds" do
- task_hash[:random_delay] = 'P7DT1S'
+ task_hash[:random_delay] = "P7DT1S"
allow(provider).to receive(:load_task_hash).and_return(task_hash)
provider.load_current_resource
- new_resource.random_delay = 'PT604801S'
+ new_resource.random_delay = "PT604801S"
expect(provider.send(:random_delay_updated?)).to be(false)
end
it "returns true if current_resource.random_delay = 'PT1S' & random_delay is set to '3600' seconds" do
- task_hash[:random_delay] = 'PT1S'
+ task_hash[:random_delay] = "PT1S"
allow(provider).to receive(:load_task_hash).and_return(task_hash)
provider.load_current_resource
- new_resource.random_delay = 'PT3600S'
+ new_resource.random_delay = "PT3600S"
expect(provider.send(:random_delay_updated?)).to be(true)
end
it "returns false if current_resource.random_delay = 'P2Y1MT2H' & random_delay is set to '65707200' seconds" do
- task_hash[:random_delay] = 'P2Y1MT2H'
+ task_hash[:random_delay] = "P2Y1MT2H"
allow(provider).to receive(:load_task_hash).and_return(task_hash)
provider.load_current_resource
- new_resource.random_delay = 'PT65707200S'
+ new_resource.random_delay = "PT65707200S"
expect(provider.send(:random_delay_updated?)).to be(false)
end
end
@@ -683,34 +683,34 @@ describe Chef::Provider::WindowsTask do
end
it "returns false if current_resource.execution_time_limit = 'P7D' & execution_time_limit is set to 604800 seconds " do
- task_hash[:execution_time_limit] = 'P7D'
+ task_hash[:execution_time_limit] = "P7D"
allow(provider).to receive(:load_task_hash).and_return(task_hash)
provider.load_current_resource
- new_resource.execution_time_limit = 'PT604800S'
+ new_resource.execution_time_limit = "PT604800S"
expect(provider.send(:execution_time_limit_updated?)).to be(false)
end
it "returns false if current_resource.execution_time_limit = 'P7DT1S' & execution_time_limit is set to 604801 seconds" do
- task_hash[:execution_time_limit] = 'P7DT1S'
+ task_hash[:execution_time_limit] = "P7DT1S"
allow(provider).to receive(:load_task_hash).and_return(task_hash)
provider.load_current_resource
- new_resource.execution_time_limit = 'PT604801S'
+ new_resource.execution_time_limit = "PT604801S"
expect(provider.send(:execution_time_limit_updated?)).to be(false)
end
it "returns true if current_resource.execution_time_limit = 'PT1S' & execution_time_limit is set to '3600' seconds" do
- task_hash[:execution_time_limit] = 'PT1S'
+ task_hash[:execution_time_limit] = "PT1S"
allow(provider).to receive(:load_task_hash).and_return(task_hash)
provider.load_current_resource
- new_resource.execution_time_limit = 'PT3600S'
+ new_resource.execution_time_limit = "PT3600S"
expect(provider.send(:execution_time_limit_updated?)).to be(true)
end
it "returns false if current_resource.execution_time_limit = 'P2Y1MT2H' & execution_time_limit is set to '65707200' seconds" do
- task_hash[:execution_time_limit] = 'P2Y1MT2H'
+ task_hash[:execution_time_limit] = "P2Y1MT2H"
allow(provider).to receive(:load_task_hash).and_return(task_hash)
provider.load_current_resource
- new_resource.execution_time_limit = 'PT65707200S'
+ new_resource.execution_time_limit = "PT65707200S"
expect(provider.send(:execution_time_limit_updated?)).to be(false)
end
end
diff --git a/spec/unit/resource/windows_task_spec.rb b/spec/unit/resource/windows_task_spec.rb
index f9349ad9bd..145063b53e 100644
--- a/spec/unit/resource/windows_task_spec.rb
+++ b/spec/unit/resource/windows_task_spec.rb
@@ -282,7 +282,7 @@ describe Chef::Resource::WindowsTask do
context "#sec_to_dur" do
it "return nil when passed 0" do
- expect(resource.send(:sec_to_dur, 0)).to eql('PT0S')
+ expect(resource.send(:sec_to_dur, 0)).to eql("PT0S")
end
it "return PT1S when passed 1" do
expect(resource.send(:sec_to_dur, 1)).to eql("PT1S")