summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-01-15 12:41:07 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-01-15 12:41:07 -0800
commit89d6d7dedcc29bb68341c46f917bc522c24b2539 (patch)
tree1b5503d0c6dffec48b58cc52bb11190488041890
parent8ba8dbb6e2d5ba51802e1c9fc98b2eed732d5e6b (diff)
parentd4b7f83e92a8da5b0f4e3fd02369fa1d3b752da0 (diff)
downloadchef-89d6d7dedcc29bb68341c46f917bc522c24b2539.tar.gz
Merge pull request #4415 from chef/lcg/chefstyle-catchup
fix chefstyle failures
-rw-r--r--.travis.yml2
-rw-r--r--Gemfile2
-rw-r--r--lib/chef/provider/package/chocolatey.rb2
-rw-r--r--spec/functional/resource/chocolatey_package_spec.rb62
-rw-r--r--spec/unit/provider/package/chocolatey_spec.rb4
5 files changed, 36 insertions, 36 deletions
diff --git a/.travis.yml b/.travis.yml
index cd91884f68..a4d00b79a7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,10 +16,10 @@ branches:
# do not run expensive spec tests on PRs, only on branches
script: "
set -e;
-bundle exec rake style;
echo '--color\n-fp' > .rspec;
sudo sed -i -e 's/^Defaults\tsecure_path.*$//' /etc/sudoers;
sudo -E $(which bundle) exec rake spec;
+bundle exec rake style;
"
env:
diff --git a/Gemfile b/Gemfile
index 0dc69a120a..cacfa3096c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -29,7 +29,7 @@ group(:development, :test) do
# for testing new chefstyle rules
# gem 'chefstyle', github: 'chef/chefstyle'
- gem "chefstyle", "= 0.1.0"
+ gem "chefstyle"
gem "ruby-shadow", :platforms => :ruby unless RUBY_PLATFORM.downcase.match(/(aix|cygwin)/)
diff --git a/lib/chef/provider/package/chocolatey.rb b/lib/chef/provider/package/chocolatey.rb
index 3bf2ced297..87abe299b6 100644
--- a/lib/chef/provider/package/chocolatey.rb
+++ b/lib/chef/provider/package/chocolatey.rb
@@ -238,7 +238,7 @@ class Chef
def parse_list_output(*args)
list = []
choco_command(*args).stdout.each_line do |line|
- name, version = line.split('|')
+ name, version = line.split("|")
list << [ name.downcase, version.chomp ]
end
list
diff --git a/spec/functional/resource/chocolatey_package_spec.rb b/spec/functional/resource/chocolatey_package_spec.rb
index ad9025420b..201ab3238c 100644
--- a/spec/functional/resource/chocolatey_package_spec.rb
+++ b/spec/functional/resource/chocolatey_package_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/powershell_out'
+require "spec_helper"
+require "chef/mixin/powershell_out"
describe Chef::Resource::ChocolateyPackage, :windows_only do
include Chef::Mixin::PowershellOut
@@ -25,97 +25,97 @@ describe Chef::Resource::ChocolateyPackage, :windows_only do
powershell_out("iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))")
end
- let(:package_name) { 'test-A' }
+ let(:package_name) { "test-A" }
let(:package_list) { proc { powershell_out("choco list -lo -r #{Array(package_name).join(' ')}").stdout.chomp } }
- let(:package_source) { File.join(CHEF_SPEC_ASSETS, 'chocolatey_feed') }
+ let(:package_source) { File.join(CHEF_SPEC_ASSETS, "chocolatey_feed") }
subject do
- new_resource = Chef::Resource::ChocolateyPackage.new('test choco package', run_context)
+ new_resource = Chef::Resource::ChocolateyPackage.new("test choco package", run_context)
new_resource.package_name package_name
new_resource.source package_source if package_source
new_resource
end
- context 'installing a package' do
+ context "installing a package" do
after { Chef::Resource::ChocolateyPackage.new(package_name, run_context).run_action(:remove) }
- it 'installs the latest version' do
+ it "installs the latest version" do
subject.run_action(:install)
expect(package_list.call).to eq("#{package_name}|2.0")
end
- it 'does not install if already installed' do
+ it "does not install if already installed" do
subject.run_action(:install)
subject.run_action(:install)
expect(subject).not_to be_updated_by_last_action
end
- it 'installs version given' do
- subject.version '1.0'
+ it "installs version given" do
+ subject.version "1.0"
subject.run_action(:install)
expect(package_list.call).to eq("#{package_name}|1.0")
end
- it 'installs new version if one is already installed' do
- subject.version '1.0'
+ it "installs new version if one is already installed" do
+ subject.version "1.0"
subject.run_action(:install)
expect(package_list.call).to eq("#{package_name}|1.0")
- subject.version '2.0'
+ subject.version "2.0"
subject.run_action(:install)
expect(package_list.call).to eq("#{package_name}|2.0")
end
- context 'installing multiple packages' do
- let(:package_name) { [ 'test-A', 'test-B' ] }
+ context "installing multiple packages" do
+ let(:package_name) { [ "test-A", "test-B" ] }
- it 'installs both packages' do
+ it "installs both packages" do
subject.run_action(:install)
expect(package_list.call).to eq("test-A|2.0\r\ntest-B|1.0")
end
end
- it 'raises if package is not found' do
- subject.package_name 'blah'
+ it "raises if package is not found" do
+ subject.package_name "blah"
expect{ subject.run_action(:install) }.to raise_error Chef::Exceptions::Package
end
- it 'raises if package version is not found' do
- subject.version '3.0'
+ it "raises if package version is not found" do
+ subject.version "3.0"
expect{ subject.run_action(:install) }.to raise_error Chef::Exceptions::Package
- end
+ end
end
- context 'upgrading a package' do
+ context "upgrading a package" do
after { Chef::Resource::ChocolateyPackage.new(package_name, run_context).run_action(:remove) }
- it 'upgrades to a specific version' do
- subject.version '1.0'
+ it "upgrades to a specific version" do
+ subject.version "1.0"
subject.run_action(:install)
expect(package_list.call).to eq("#{package_name}|1.0")
- subject.version '1.5'
+ subject.version "1.5"
subject.run_action(:upgrade)
expect(package_list.call).to eq("#{package_name}|1.5")
end
- it 'upgrades to the latest version if no version given' do
- subject.version '1.0'
+ it "upgrades to the latest version if no version given" do
+ subject.version "1.0"
subject.run_action(:install)
expect(package_list.call).to eq("#{package_name}|1.0")
- subject2 = Chef::Resource::ChocolateyPackage.new('test-A', run_context)
+ subject2 = Chef::Resource::ChocolateyPackage.new("test-A", run_context)
subject2.source package_source
subject2.run_action(:upgrade)
expect(package_list.call).to eq("#{package_name}|2.0")
end
end
- context 'removing a package' do
- it 'removes an installed package' do
+ context "removing a package" do
+ it "removes an installed package" do
subject.run_action(:install)
Chef::Resource::ChocolateyPackage.new(package_name, run_context).run_action(:remove)
- expect(package_list.call).to eq('')
+ expect(package_list.call).to eq("")
end
end
end \ No newline at end of file
diff --git a/spec/unit/provider/package/chocolatey_spec.rb b/spec/unit/provider/package/chocolatey_spec.rb
index f8df129c6e..1770869ccd 100644
--- a/spec/unit/provider/package/chocolatey_spec.rb
+++ b/spec/unit/provider/package/chocolatey_spec.rb
@@ -76,13 +76,13 @@ munin-node|1.6.1.20130823
it "should set the candidate_version to pinned version if available" do
allow_remote_list(["git"])
- new_resource.version('2.6.1')
+ new_resource.version("2.6.1")
expect(provider.candidate_version).to eql(["2.6.1"])
end
it "should set the candidate_version to nill if pinning to bogus version" do
allow_remote_list(["git"])
- new_resource.version('2.5.0')
+ new_resource.version("2.5.0")
expect(provider.candidate_version).to eql([nil])
end