Sha256: bf41757a8ddaa948fc5052c92aab86173bbe9cfcb568948cbaced7e75bf5dacd

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

require "rubygems"

# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
  ENV['BUNDLE_GEMFILE'] = gemfile
  require 'bundler'
  Bundler.setup
rescue Bundler::GemNotFound => e
  STDERR.puts e.message
  STDERR.puts "Try running `bundle install`."
  exit!
end if File.exist?(gemfile)

$:.unshift(File.expand_path('../../lib', __FILE__))

require 'spec'
require 'nokogiri'

require 'ruby-plsql-spec'

DATABASE_NAME = ENV['DATABASE_NAME'] || 'orcl'
DATABASE_HOST = ENV['DATABASE_HOST'] || 'localhost'
DATABASE_PORT = ENV['DATABASE_PORT'] || 1521
DATABASE_USER = ENV['DATABASE_USER'] || 'hr'
DATABASE_PASSWORD = ENV['DATABASE_PASSWORD'] || 'hr'

CONNECTION_PARAMS = {
  :username => DATABASE_USER,
  :password => DATABASE_PASSWORD,
  :database => DATABASE_NAME
}
CONNECTION_PARAMS[:host] = DATABASE_HOST if defined?(DATABASE_HOST)
CONNECTION_PARAMS[:port] = DATABASE_PORT if defined?(DATABASE_PORT)

Spec::Runner.configure do |config|
  # taken from thor specs
  def capture(stream)
    begin
      stream = stream.to_s
      eval "$#{stream} = StringIO.new"
      yield
      result = eval("$#{stream}").string
    ensure 
      eval("$#{stream} = #{stream.upcase}")
    end

    result
  end
  alias :silence :capture

  def source_root
    File.join(File.dirname(__FILE__), 'fixtures')
  end

  def destination_root
    File.join(File.dirname(__FILE__), 'sandbox')
  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-plsql-spec-0.1.0 spec/spec_helper.rb