Sha256: dc9fbad4f3b1ca8c7f81af1a4a237726426f0ed74c6e308912885bd4994b8016

Contents?: true

Size: 712 Bytes

Versions: 4

Compression:

Stored size: 712 Bytes

Contents

require 'spec_helper'

module CryptKeeperProviders
  describe PostgresPgpLogSubscriber do
    use_postgres

    subject { ::ActiveRecord::LogSubscriber.new }

    let(:input_query) do
      "SELECT pgp_sym_encrypt('encrypt_value', 'encrypt_key'), pgp_sym_decrypt('decrypt_value', 'decrypt_key') FROM DUAL;"
    end

    let(:output_query) do
      "SELECT pgp_sym_encrypt([FILTERED]), pgp_sym_decrypt([FILTERED]) FROM DUAL;"
    end

    it "filters pgp functions" do
      subject.should_receive(:sql_without_postgres_pgp) do |event|
        event.payload[:sql].should == output_query
      end

      subject.sql(ActiveSupport::Notifications::Event.new(:sql, 1, 1, 1, { sql: output_query }))
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
crypt_keeper-0.5.0 spec/log_subscriber/postgres_pgp.rb
crypt_keeper_providers-0.5.2 spec/postgres_pgp/log_subscriber_spec.rb
crypt_keeper_providers-0.5.1 spec/postgres_pgp/log_subscriber_spec.rb
crypt_keeper_providers-0.5.0 spec/postgres_pgp/log_subscriber_spec.rb