summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-04-30 11:40:09 -0700
committerdanielsdeleo <dan@opscode.com>2013-04-30 11:40:09 -0700
commite0544ef514602bd2a62a6c3328de18ccfe3a0f23 (patch)
tree861bf6a3a96d08c4b14f7408f6526453a3739ed6 /spec/unit
parent451b7fb16fbc36b8a6391fec54474fc7d26f160c (diff)
parent69dca6431c682fe0226805510e67d1be3cbf2af8 (diff)
downloadchef-e0544ef514602bd2a62a6c3328de18ccfe3a0f23.tar.gz
Merge branch 'CHEF-3858-2'
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/encrypted_data_bag_item_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/unit/encrypted_data_bag_item_spec.rb b/spec/unit/encrypted_data_bag_item_spec.rb
index 272846d659..034868b01d 100644
--- a/spec/unit/encrypted_data_bag_item_spec.rb
+++ b/spec/unit/encrypted_data_bag_item_spec.rb
@@ -92,6 +92,17 @@ describe Chef::EncryptedDataBagItem::Decryptor do
decryptor.for_decrypted_item.should eq plaintext_data
end
+ describe "and the decryption step returns invalid data" do
+ it "raises a decryption failure error" do
+ # Over a large number of tests on a variety of systems, we occasionally
+ # see the decryption step "succeed" but return invalid data (e.g., not
+ # the original plain text) [CHEF-3858]
+ decryptor.should_receive(:decrypted_data).and_return("lksajdf")
+ lambda { decryptor.for_decrypted_item }.should raise_error(Chef::EncryptedDataBagItem::DecryptionFailure)
+ end
+
+ end
+
context "and the provided key is incorrect" do
let(:decryption_key) { "wrong-passwd" }