Sha256: a29ab76992871d5fc9203233a884c37ab07f3b9c2365dffb1fe3db7ae5d742b2

Contents?: true

Size: 799 Bytes

Versions: 3

Compression:

Stored size: 799 Bytes

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'bcdatabase'
require 'rubygems'
require 'fileutils'

def temporary_yaml(name, hash)
  filename = "/#{ENV['BCDATABASE_PATH']}/#{name}.yaml"
  open(filename, "w") { |f| YAML.dump(hash, f) }
  filename
end

def enable_fake_cipherment
  # replace real encryption methods with something predictable
  Bcdatabase.module_eval do
    class << self
      alias :encrypt_original :encrypt
      alias :decrypt_original :decrypt
      def encrypt(s); s.reverse; end
      def decrypt(s); s.reverse; end
    end
  end
end

def disable_fake_cipherment
  Bcdatabase.module_eval do
    class << self
      alias :encrypt :encrypt_original
      alias :decrypt :decrypt_original
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bcdatabase-1.0.2 spec/spec_helper.rb
bcdatabase-1.0.1 spec/spec_helper.rb
bcdatabase-1.0.0 spec/spec_helper.rb