Sha256: 1b014bc410ed8da36d8fd73c91de30e5d79246b0516fc81bb24b90dd6a2a58d0

Contents?: true

Size: 881 Bytes

Versions: 14

Compression:

Stored size: 881 Bytes

Contents

require 'minitest/autorun'
require 'securerandom'
require_relative '../lib/orats/foreman'

module Orats
  module Test
    include Foreman

    BINARY_PATH = File.absolute_path('../../bin/orats',__FILE__)
    TEST_PATH = '/tmp/orats/test'
    ORATS_FLAGS = '--pg-password pleasedonthackme --skip-foreman-start'

    def orats(command, options = {})
      cmd, app_name = command.split(' ')
      prepend_command = ''

      command = "#{cmd} #{TEST_PATH}/#{app_name}" if command.include?(' ')

      if options.has_key?(:answer)
        options[:answer] == 'y' || options[:answer] == 'yes' ? insert_answer = 'yes' : insert_answer = 'echo'

        prepend_command = "#{insert_answer} | "
      end

      system "#{prepend_command} #{BINARY_PATH} #{command} #{options[:flags]}"
    end

    private

      def generate_app_name
        "a_#{SecureRandom.hex(8)}"
      end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
orats-0.6.2 test/test_helper.rb
orats-0.6.1 test/test_helper.rb
orats-0.6.0 test/test_helper.rb
orats-0.5.1 test/test_helper.rb
orats-0.5.0 test/test_helper.rb
orats-0.4.10 test/test_helper.rb
orats-0.4.9 test/test_helper.rb
orats-0.4.8 test/test_helper.rb
orats-0.4.7 test/test_helper.rb
orats-0.4.6 test/test_helper.rb
orats-0.4.5 test/test_helper.rb
orats-0.4.1 test/test_helper.rb
orats-0.4.0 test/test_helper.rb
orats-0.3.2 test/test_helper.rb