Sha256: 9da0ea0ae85969f27f345c207d394bf963cea505426b43ef56ddd2668290ddb4
Contents?: true
Size: 993 Bytes
Versions: 17
Compression:
Stored size: 993 Bytes
Contents
require 'spec_helper' describe Heirloom do before do @logger_mock = mock 'logger', :info => true @logger_mock.stub :info => true @config_mock = mock 'config' @config_mock.stub :logger => @logger_mock @tempfile_stub = stub 'tempfile', :path => '/path_to_encrypted_archive' Tempfile.stub :new => @tempfile_stub @aes_mock = mock 'aes' @aes_mock.stub :random_iv => 'firstsixteenchar' OpenSSL::Cipher::AES256.should_receive(:new). with(:CBC).and_return @aes_mock @file = Heirloom::Cipher::File.new :config => @config_mock end it "should encrypt the given file" do @aes_mock.should_receive(:encrypt) @aes_mock.should_receive(:iv=).with 'firstsixteenchar' @aes_mock.should_receive(:key=).with Digest::SHA256.hexdigest 'mysecret' ::File.should_receive(:open) @file.encrypt_file(:file => '/file', :secret => 'mysecret'). should == '/path_to_encrypted_archive' end end
Version data entries
17 entries across 17 versions & 1 rubygems