Skip to content

Commit

Permalink
GemSpec: Fix Ruby < 2 support (fixes #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
zuazo committed Apr 2, 2015
1 parent 9f6eea4 commit 12bfcb0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions chef-encrypted-attributes.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ Gem::Specification.new do |s|

s.add_dependency 'ffi-yajl', '~> 1.0'
s.add_dependency 'chef', chef_version
# Support old deprecated Ruby versions:
s.add_dependency 'mixlib-shellout', '< 1.6.1' if RUBY_VERSION < '1.9.3'
if RUBY_VERSION < '2'
s.add_dependency 'highline', '< 1.7'
s.add_dependency 'ohai', '< 8'
end

s.add_development_dependency 'rake', '~> 10.0'
s.add_development_dependency 'chef-zero', '~> 3.2'
Expand Down
6 changes: 4 additions & 2 deletions spec/unit/encrypted_attribute/encrypted_mash/version1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ class EncryptedMashVersionBadCipher <
)
end

it 'throws an error if the hmac generation fails' do
it 'throws an error if the hmac generation fails',
unless: RUBY_VERSION < '2' do
body = encrypted_mash_version1_class.new
expect(OpenSSL::HMAC).to receive(:digest).and_raise(OpenSSL::HMACError)
expect { body.encrypt('value1', key1) }
Expand Down Expand Up @@ -285,7 +286,8 @@ class EncryptedMashVersionBadCipher <
)
end

it 'throws an error if the hmac generation for checking fails' do
it 'throws an error if the hmac generation for checking fails',
unless: RUBY_VERSION < '2' do
body = encrypted_mash_version1_class.new
body.encrypt('value1', key1.public_key)
expect(OpenSSL::HMAC).to receive(:digest).and_raise(OpenSSL::HMACError)
Expand Down

0 comments on commit 12bfcb0

Please sign in to comment.