Sha256: b402313123ab3b71699ed4dcde16c911c17dddabe9dfb703c89a92c57c593e10

Contents?: true

Size: 799 Bytes

Versions: 2

Compression:

Stored size: 799 Bytes

Contents

require 'spec_helper'

module CryptKeeperProviders
  describe MysqlAes do
    use_mysql

    let(:plain_text) { 'test' }
    let(:cipher_text) { "nbKOoWn8kvAw9k/C2Mex6Q==\n" }

    subject { MysqlAes.new key: 'candy' }

    its(:key) { should == 'candy' }

    describe "#initialize" do
      it "should raise an exception with a missing key" do
        expect { MysqlAes.new }.to raise_error(ArgumentError, "Missing :key")
      end
    end

    describe "#encrypt" do
      it "should encrypt the string" do
        subject.encrypt(plain_text).should_not == plain_text
        subject.encrypt(plain_text).should_not be_empty
      end
    end

    describe "#decrypt" do
      it "should decrypt the string" do
        subject.decrypt(cipher_text).should == plain_text
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crypt_keeper_providers-0.5.0 spec/mysql_aes_spec.rb
crypt_keeper_providers-0.4.0 spec/mysql_aes_spec.rb