summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-01-12 09:18:16 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-01-12 09:18:16 -0800
commit812101f11a6c33e49f401ad72598ca6ffb38adc4 (patch)
treebab654bbd8d6310d46c0f1787691133a2b6bb743 /spec
parentc7194aea7c145b94c46a97dd3f218aff1b0116c2 (diff)
parentc844e1c87374b18ee634a06a5325518631607c90 (diff)
downloadchef-812101f11a6c33e49f401ad72598ca6ffb38adc4.tar.gz
Merge pull request #4381 from chef/lcg/useless-to-s
chefstyle: fix Lint/StringConversionInInterpolation
Diffstat (limited to 'spec')
-rw-r--r--spec/functional/resource/powershell_script_spec.rb2
-rw-r--r--spec/support/shared/unit/file_system_support.rb2
-rw-r--r--spec/unit/cookbook/metadata_spec.rb10
-rw-r--r--spec/unit/provider/group/groupadd_spec.rb4
-rw-r--r--spec/unit/provider/group/usermod_spec.rb4
-rw-r--r--spec/unit/resource/deploy_spec.rb4
-rw-r--r--spec/unit/resource/env_spec.rb2
-rw-r--r--spec/unit/resource/link_spec.rb2
8 files changed, 15 insertions, 15 deletions
diff --git a/spec/functional/resource/powershell_script_spec.rb b/spec/functional/resource/powershell_script_spec.rb
index 91b74fd752..d7e5b9888b 100644
--- a/spec/functional/resource/powershell_script_spec.rb
+++ b/spec/functional/resource/powershell_script_spec.rb
@@ -81,7 +81,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
# PowerShell 4.0 and later versions return a 32-bit signed value.
file = Tempfile.new(['foo', '.ps1'])
begin
- file.write "exit #{negative_exit_status.to_s}"
+ file.write "exit #{negative_exit_status}"
file.close
resource.code(". \"#{file.path}\"")
diff --git a/spec/support/shared/unit/file_system_support.rb b/spec/support/shared/unit/file_system_support.rb
index 358f0c405c..3f9e6df3b9 100644
--- a/spec/support/shared/unit/file_system_support.rb
+++ b/spec/support/shared/unit/file_system_support.rb
@@ -56,7 +56,7 @@ module FileSystemSupport
def no_blocking_calls_allowed
[ Chef::ChefFS::FileSystem::MemoryFile, Chef::ChefFS::FileSystem::MemoryDir ].each do |c|
[ :children, :exists?, :read ].each do |m|
- allow_any_instance_of(c).to receive(m).and_raise("#{m.to_s} should not be called")
+ allow_any_instance_of(c).to receive(m).and_raise("#{m} should not be called")
end
end
end
diff --git a/spec/unit/cookbook/metadata_spec.rb b/spec/unit/cookbook/metadata_spec.rb
index fbd07f7e69..633632b58c 100644
--- a/spec/unit/cookbook/metadata_spec.rb
+++ b/spec/unit/cookbook/metadata_spec.rb
@@ -891,31 +891,31 @@ describe Chef::Cookbook::Metadata do
:suggestions,
:conflicting,
:replacing].each do |to_check|
- it "should transform deprecated greater than syntax for :#{to_check.to_s}" do
+ it "should transform deprecated greater than syntax for :#{to_check}" do
@hash[to_check.to_s]["foo::bar"] = ">> 0.2"
deserial = Chef::Cookbook::Metadata.from_hash(@hash)
expect(deserial.send(to_check)["foo::bar"]).to eq('> 0.2')
end
- it "should transform deprecated less than syntax for :#{to_check.to_s}" do
+ it "should transform deprecated less than syntax for :#{to_check}" do
@hash[to_check.to_s]["foo::bar"] = "<< 0.2"
deserial = Chef::Cookbook::Metadata.from_hash(@hash)
expect(deserial.send(to_check)["foo::bar"]).to eq('< 0.2')
end
- it "should ignore multiple dependency constraints for :#{to_check.to_s}" do
+ it "should ignore multiple dependency constraints for :#{to_check}" do
@hash[to_check.to_s]["foo::bar"] = [ ">= 1.0", "<= 5.2" ]
deserial = Chef::Cookbook::Metadata.from_hash(@hash)
expect(deserial.send(to_check)["foo::bar"]).to eq([])
end
- it "should accept an empty array of dependency constraints for :#{to_check.to_s}" do
+ it "should accept an empty array of dependency constraints for :#{to_check}" do
@hash[to_check.to_s]["foo::bar"] = []
deserial = Chef::Cookbook::Metadata.from_hash(@hash)
expect(deserial.send(to_check)["foo::bar"]).to eq([])
end
- it "should accept single-element arrays of dependency constraints for :#{to_check.to_s}" do
+ it "should accept single-element arrays of dependency constraints for :#{to_check}" do
@hash[to_check.to_s]["foo::bar"] = [ ">= 2.0" ]
deserial = Chef::Cookbook::Metadata.from_hash(@hash)
expect(deserial.send(to_check)["foo::bar"]).to eq(">= 2.0")
diff --git a/spec/unit/provider/group/groupadd_spec.rb b/spec/unit/provider/group/groupadd_spec.rb
index 94150b7a88..47021a9af3 100644
--- a/spec/unit/provider/group/groupadd_spec.rb
+++ b/spec/unit/provider/group/groupadd_spec.rb
@@ -42,7 +42,7 @@ describe Chef::Provider::Group::Groupadd, "set_options" do
}
field_list.each do |attribute, option|
- it "should check for differences in #{attribute.to_s} between the current and new resources" do
+ it "should check for differences in #{attribute} between the current and new resources" do
expect(@new_resource).to receive(attribute)
expect(@current_resource).to receive(attribute)
@provider.set_options
@@ -145,7 +145,7 @@ describe Chef::Provider::Group::Groupadd do
[:add_member, :remove_member, :set_members].each do |m|
it "should raise an error when calling #{m}" do
- expect { @provider.send(m, [ ]) }.to raise_error(Chef::Exceptions::Group, "you must override #{m} in #{@provider.to_s}")
+ expect { @provider.send(m, [ ]) }.to raise_error(Chef::Exceptions::Group, "you must override #{m} in #{@provider}")
end
end
diff --git a/spec/unit/provider/group/usermod_spec.rb b/spec/unit/provider/group/usermod_spec.rb
index 3f06e9ebf1..a11d790d07 100644
--- a/spec/unit/provider/group/usermod_spec.rb
+++ b/spec/unit/provider/group/usermod_spec.rb
@@ -65,7 +65,7 @@ describe Chef::Provider::Group::Usermod do
@provider.load_current_resource
@provider.instance_variable_set("@group_exists", true)
@provider.action = :modify
- expect { @provider.run_action(@provider.process_resource_requirements) }.to raise_error(Chef::Exceptions::Group, "setting group members directly is not supported by #{@provider.to_s}, must set append true in group")
+ expect { @provider.run_action(@provider.process_resource_requirements) }.to raise_error(Chef::Exceptions::Group, "setting group members directly is not supported by #{@provider}, must set append true in group")
end
it "should raise an error when excluded_members are set" do
@@ -75,7 +75,7 @@ describe Chef::Provider::Group::Usermod do
@provider.action = :modify
allow(@new_resource).to receive(:append).and_return(true)
allow(@new_resource).to receive(:excluded_members).and_return(["someone"])
- expect { @provider.run_action(@provider.process_resource_requirements) }.to raise_error(Chef::Exceptions::Group, "excluded_members is not supported by #{@provider.to_s}")
+ expect { @provider.run_action(@provider.process_resource_requirements) }.to raise_error(Chef::Exceptions::Group, "excluded_members is not supported by #{@provider}")
end
platforms.each do |platform, flags|
diff --git a/spec/unit/resource/deploy_spec.rb b/spec/unit/resource/deploy_spec.rb
index 5b6a452784..2338e37173 100644
--- a/spec/unit/resource/deploy_spec.rb
+++ b/spec/unit/resource/deploy_spec.rb
@@ -31,7 +31,7 @@ describe Chef::Resource::Deploy do
class << self
def resource_has_a_string_attribute(attr_name)
- it "has a String attribute for #{attr_name.to_s}" do
+ it "has a String attribute for #{attr_name}" do
@resource.send(attr_name, "this is a string")
expect(@resource.send(attr_name)).to eql("this is a string")
expect {@resource.send(attr_name, 8675309)}.to raise_error(ArgumentError)
@@ -39,7 +39,7 @@ describe Chef::Resource::Deploy do
end
def resource_has_a_boolean_attribute(attr_name, opts={:defaults_to=>false})
- it "has a Boolean attribute for #{attr_name.to_s}" do
+ it "has a Boolean attribute for #{attr_name}" do
expect(@resource.send(attr_name)).to eql(opts[:defaults_to])
@resource.send(attr_name, !opts[:defaults_to])
expect(@resource.send(attr_name)).to eql( !opts[:defaults_to] )
diff --git a/spec/unit/resource/env_spec.rb b/spec/unit/resource/env_spec.rb
index 9bee07c593..60e85ac31e 100644
--- a/spec/unit/resource/env_spec.rb
+++ b/spec/unit/resource/env_spec.rb
@@ -39,7 +39,7 @@ describe Chef::Resource::Env do
end
{ :create => false, :delete => false, :modify => false, :flibber => true }.each do |action,bad_value|
- it "should #{bad_value ? 'not' : ''} accept #{action.to_s}" do
+ it "should #{bad_value ? 'not' : ''} accept #{action}" do
if bad_value
expect { @resource.action action }.to raise_error(ArgumentError)
else
diff --git a/spec/unit/resource/link_spec.rb b/spec/unit/resource/link_spec.rb
index 0246fcd13b..220ad735bd 100644
--- a/spec/unit/resource/link_spec.rb
+++ b/spec/unit/resource/link_spec.rb
@@ -40,7 +40,7 @@ describe Chef::Resource::Link do
end
{ :create => false, :delete => false, :blues => true }.each do |action,bad_value|
- it "should #{bad_value ? 'not' : ''} accept #{action.to_s}" do
+ it "should #{bad_value ? 'not' : ''} accept #{action}" do
if bad_value
expect { @resource.action action }.to raise_error(ArgumentError)
else