require 'spec_helper' require 'flydata/command/encrypt' module Flydata module Command describe Encrypt do subject { described_class.new } let(:flydata) { double('flydata') } let(:data_port) { double('data_port') } let(:key) { 'abcd' } let(:dp) { {'key' => key} } let(:password) { 'P@ssword' } let(:encrypted_password) { '@#$@#' } before do expect(subject).to receive(:flydata).and_return(flydata) expect(flydata).to receive(:data_port).and_return(data_port) expect(data_port).to receive(:get).and_return(dp) expect(subject).to receive(:ask).and_return(password) end it "loads without an error" do expect(Flydata::Util::Encryptor).to receive(:encrypt).with(password, key).and_return(encrypted_password) subject.run end end end end