Sha256: 9a3c8eb03778835482872bdefbfa429bf10f3bcc6544a05b361d45e95d071d35

Contents?: true

Size: 1.66 KB

Versions: 1

Compression:

Stored size: 1.66 KB

Contents

require 'bundler/setup' ; Bundler.require(:default, :development, :test)
require 'rspec/autorun'
require 'yaml'

puts "Running specs in version #{RUBY_VERSION} on #{RUBY_PLATFORM} #{RUBY_DESCRIPTION}"

if ENV['CONFIGLIERE_COV']
  require 'simplecov'
  SimpleCov.start
end

RSpec.configure do |config|
  config.treat_symbols_as_metadata_keys_with_true_values = true

  def load_sketchy_lib(lib)
    begin
      require lib
      yield if block_given?
      return true
    rescue LoadError, StandardError => err
      warn "#{RUBY_DESCRIPTION} doesn't seem to like #{lib}: got error"
      warn "  #{err.class} #{err}"
      warn "Skipping specs on '#{caller(2).first}'"
      return false
    end
  end

  def capture_help_message
    stderr_output = ''
    subject.should_receive(:warn){|str| stderr_output << str }
    begin
      yield
      fail('should exit via system exit')
    rescue SystemExit
      true # pass
    end
    stderr_output
  end

  def check_openssl
    load_sketchy_lib('openssl') do
      cipher = OpenSSL::Cipher::Cipher.new('aes-128-cbc')
      cipher.encrypt
      cipher.key = Digest::SHA256.digest("HI JRUBY")
      cipher.iv  = iv = cipher.random_iv
      ciphertext = cipher.update("O HAI TO YOU!")
      ciphertext << cipher.final
      # p [__LINE__, '128-bit encryption is OK', ciphertext]
      # cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc')
      # cipher.encrypt
      # cipher.key = Digest::SHA256.digest("HI JRUBY")
      # cipher.iv  = iv = cipher.random_iv
      # ciphertext = cipher.update("O HAI TO YOU!")
      # ciphertext << cipher.final
      # p [__LINE__, '256-bit encryption is OK', ciphertext]
    end
  end

end

require 'configliere'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
configliere-0.4.22 spec/spec_helper.rb