summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2016-10-13 11:34:26 +0100
committerTim Smith <tsmith@chef.io>2016-10-13 11:34:26 +0100
commit2d3d986c751ceadc1022a46b2a856ae943fb4d65 (patch)
tree4b2484074ac07afc5b3023f249cea83eea2239ec
parentc46df55ae142310baf225eac1d1250d17f547844 (diff)
downloadmixlib-authentication-2d3d986c751ceadc1022a46b2a856ae943fb4d65.tar.gz
Chefstyle fixes
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/mixlib/authentication/digester.rb4
-rw-r--r--lib/mixlib/authentication/signedheaderauth.rb2
-rw-r--r--spec/mixlib/authentication/digester_spec.rb4
3 files changed, 4 insertions, 6 deletions
diff --git a/lib/mixlib/authentication/digester.rb b/lib/mixlib/authentication/digester.rb
index 8628d53..f826b4c 100644
--- a/lib/mixlib/authentication/digester.rb
+++ b/lib/mixlib/authentication/digester.rb
@@ -27,9 +27,7 @@ module Mixlib
def hash_file(f, digest = OpenSSL::Digest::SHA1)
digester = digest.new
buf = ""
- while f.read(16384, buf)
- digester.update buf
- end
+ digester.update buf while f.read(16384, buf)
::Base64.encode64(digester.digest).chomp
end
diff --git a/lib/mixlib/authentication/signedheaderauth.rb b/lib/mixlib/authentication/signedheaderauth.rb
index ab8d989..855fd80 100644
--- a/lib/mixlib/authentication/signedheaderauth.rb
+++ b/lib/mixlib/authentication/signedheaderauth.rb
@@ -274,7 +274,7 @@ module Mixlib
def server_api_version
key = (self[:headers] || {}).keys.select do |k|
- k.downcase == "x-ops-server-api-version"
+ k.casecmp("x-ops-server-api-version").zero?
end.first
if key
self[:headers][key]
diff --git a/spec/mixlib/authentication/digester_spec.rb b/spec/mixlib/authentication/digester_spec.rb
index fd3eb41..4688d5c 100644
--- a/spec/mixlib/authentication/digester_spec.rb
+++ b/spec/mixlib/authentication/digester_spec.rb
@@ -7,14 +7,14 @@ describe Mixlib::Authentication::Digester do
let(:test_string) { "hello" }
let(:test_string_checksum) { "qvTGHdzF6KLavt4PO0gs2a6pQ00=" }
- describe '#hash_file' do
+ describe "#hash_file" do
it "should default to use SHA1" do
expect(described_class.hash_file(StringIO.new(test_string))).to(
eq(test_string_checksum))
end
end
- describe '#hash_string' do
+ describe "#hash_string" do
it "should default to use SHA1" do
expect(described_class.hash_string(test_string)).to(
eq(test_string_checksum))