Skip to content

Commit

Permalink
Fixed all rspec deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
zuazo committed Aug 11, 2014
1 parent 1db1221 commit b719438
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions spec/integration/encrypted_attribute/remote_users.rb
Expand Up @@ -56,8 +56,8 @@
pkey_pem = @RemoteUsers.get_public_keys([ 'user1' ])[0]
expect(pkey_pem).to be_a(String)
pkey = OpenSSL::PKey::RSA.new(pkey_pem)
expect(pkey.public?).to be_true
expect(pkey.private?).to be_false
expect(pkey.public?).to be_truthy
expect(pkey.private?).to be_falsey
end

it 'should throw an error if the user is not found' do
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Expand Up @@ -33,6 +33,6 @@
RSpec.configure do |config|
config.order = 'random'

config.color_enabled = true
config.color = true
config.tty = true
end
6 changes: 3 additions & 3 deletions spec/unit/encrypted_attribute/cache_lru.rb
Expand Up @@ -103,9 +103,9 @@
(11..14).step.each { |x| @cache[x] = x }

# expectations
(1..3).step.each { |x| expect(@cache.has_key?(x)).to be_false }
(4..8).step.each { |x| expect(@cache.has_key?(x)).to be_true }
(10..14).step.each { |x| expect(@cache.has_key?(x)).to be_true }
(1..3).step.each { |x| expect(@cache.has_key?(x)).to be_falsey }
(4..8).step.each { |x| expect(@cache.has_key?(x)).to be_truthy }
(10..14).step.each { |x| expect(@cache.has_key?(x)).to be_truthy }
end

end
Expand Down
8 changes: 4 additions & 4 deletions spec/unit/encrypted_attribute/encrypted_mash.rb
Expand Up @@ -62,7 +62,7 @@
].each do |o|
it "should return true for #{o.inspect}" do
expect(Chef::Log).to_not receive(:warn)
expect(@EncryptedMash.exist?(o)).to be_true
expect(@EncryptedMash.exist?(o)).to be_truthy
end
end

Expand All @@ -76,7 +76,7 @@
].each do |o|
it "should return false for #{o.inspect}" do
expect(Chef::Log).to_not receive(:warn)
expect(@EncryptedMash.exist?(o)).to be_false
expect(@EncryptedMash.exist?(o)).to be_falsey
end
end

Expand All @@ -94,7 +94,7 @@
].each do |o|
it "should return true for #{o.inspect}" do
expect(Chef::Log).to receive(:warn).once.with(/is deprecated in favor of/)
expect(@EncryptedMash.exists?(o)).to be_true
expect(@EncryptedMash.exists?(o)).to be_truthy
end
end

Expand All @@ -108,7 +108,7 @@
].each do |o|
it "should return false for #{o.inspect}" do
expect(Chef::Log).to receive(:warn).once.with(/is deprecated in favor of/)
expect(@EncryptedMash.exists?(o)).to be_false
expect(@EncryptedMash.exists?(o)).to be_falsey
end
end

Expand Down
8 changes: 4 additions & 4 deletions spec/unit/encrypted_attribute/encrypted_mash/version0.rb
Expand Up @@ -211,29 +211,29 @@
keys = [ @key1.public_key ]
body = @EncryptedMashVersion0.new
body.encrypt('value1', keys)
expect(body.needs_update?(keys)).to be_false
expect(body.needs_update?(keys)).to be_falsey
end

it 'should return true if there are new keys' do
keys = [ @key1.public_key ]
body = @EncryptedMashVersion0.new
body.encrypt('value1', keys)
keys.push(@key2.public_key)
expect(body.needs_update?(keys)).to be_true
expect(body.needs_update?(keys)).to be_truthy
end

it 'should return true if some keys are removed' do
keys = [ @key1.public_key, @key2.public_key ]
body = @EncryptedMashVersion0.new
body.encrypt('value1', keys)
expect(body.needs_update?(keys[0])).to be_true
expect(body.needs_update?(keys[0])).to be_truthy
end

it 'should return false if the keys are the same, but in different order or format' do
keys = [ @key1.public_key, @key2.public_key ]
body = @EncryptedMashVersion0.new
body.encrypt('value1', keys)
expect(body.needs_update?([ keys[1], keys[0].to_pem ])).to be_false
expect(body.needs_update?([ keys[1], keys[0].to_pem ])).to be_falsey
end

end # context #needs_update?
Expand Down
8 changes: 4 additions & 4 deletions spec/unit/encrypted_attribute/encrypted_mash/version1.rb
Expand Up @@ -246,29 +246,29 @@ class EncryptedMashVersionBadCipher < Chef::EncryptedAttribute::EncryptedMash::V
keys = [ @key1.public_key ]
body = @EncryptedMashVersion1.new
body.encrypt('value1', keys )
expect(body.needs_update?(keys)).to be_false
expect(body.needs_update?(keys)).to be_falsey
end

it 'should return true if there are new keys' do
keys = [ @key1.public_key ]
body = @EncryptedMashVersion1.new
body.encrypt('value1', keys)
keys.push(@key2.public_key)
expect(body.needs_update?(keys)).to be_true
expect(body.needs_update?(keys)).to be_truthy
end

it 'should return true if some keys are removed' do
keys = [ @key1.public_key, @key2.public_key ]
body = @EncryptedMashVersion1.new
body.encrypt('value1', keys)
expect(body.needs_update?(keys[0])).to be_true
expect(body.needs_update?(keys[0])).to be_truthy
end

it 'should return false if the keys are the same, but in different order or format' do
keys = [ @key1.public_key, @key2.public_key ]
body = @EncryptedMashVersion1.new
body.encrypt('value1', keys)
expect(body.needs_update?([ keys[1], keys[0].to_pem ])).to be_false
expect(body.needs_update?([ keys[1], keys[0].to_pem ])).to be_falsey
end

end # context #needs_update?
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/encrypted_attribute/remote_users.rb
Expand Up @@ -84,8 +84,8 @@
pkey_pem = @RemoteUsers.get_public_keys([ 'user0' ])[0]
expect(pkey_pem).to be_a(String)
pkey = OpenSSL::PKey::RSA.new(pkey_pem)
expect(pkey.public?).to be_true
expect(pkey.private?).to be_false
expect(pkey.public?).to be_truthy
expect(pkey.private?).to be_falsey
end

{
Expand Down

0 comments on commit b719438

Please sign in to comment.