Sha256: b3c45572ae9d1a72d78d07ec545f7baff1e7911824641cb668e74169150811af

Contents?: true

Size: 824 Bytes

Versions: 10

Compression:

Stored size: 824 Bytes

Contents

require 'minitest/autorun'
require 'securerandom'

module Orats
  # test helpers
  module Test
    TEST_PATH      = ENV['TEST_PATH'] || '/tmp'
    TEMPLATES_PATH = File.absolute_path('../../lib/orats/templates', __FILE__)
    BINARY_PATH    = File.absolute_path('../../bin/orats', __FILE__)

    def orats(command, options = {})
      cmd, app_name = command.split(' ')
      command       = "#{cmd} #{TEST_PATH}/#{app_name}" unless app_name.nil?

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

    def assert_path(file_or_dir)
      assert File.exist?(file_or_dir),
             "Expected path '#{file_or_dir}' to exist"
    end

    private

    def absolute_test_path
      File.join(TEST_PATH, @target_path)
    end

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
orats-5.2.3 test/test_helper.rb
orats-5.2.2 test/test_helper.rb
orats-5.2.1 test/test_helper.rb
orats-5.2.0 test/test_helper.rb
orats-5.1.2 test/test_helper.rb
orats-5.1.1 test/test_helper.rb
orats-5.0.3 test/test_helper.rb
orats-5.0.2 test/test_helper.rb
orats-5.0.1 test/test_helper.rb
orats-5.0.0 test/test_helper.rb