spec/cipher/file_spec.rb in heirloom-0.8.3 vs spec/cipher/file_spec.rb in heirloom-0.9.0

- old
+ new

@@ -4,11 +4,12 @@ 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 = stub 'tempfile', :path => '/path_to_encrypted_archive', + :close! => true 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 @@ -18,11 +19,12 @@ 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) + FileUtils.should_receive(:mv). + with('/path_to_encrypted_archive', '/file') @file.encrypt_file(:file => '/file', - :secret => 'mysecret'). - should == '/path_to_encrypted_archive' + :secret => 'mysecret').should be_true end end