Sha256: 5b38c2f2f144d86fa0904467444be87da36a23319199ab3dbc82ab1303748776

Contents?: true

Size: 1011 Bytes

Versions: 1

Compression:

Stored size: 1011 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'thor'
require 'English'
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')

# Executable for Generic Test
class Exe < Thor
  desc 'page page_url', 'Test web page'
  def page(page_url)
    ENV['PAGE_URL'] = page_url
    test_file_path = File.join(File.dirname(__FILE__), '..', 'spec', 'generic_test_spec.rb')
    raise "no file at #{test_file_path}" unless File.exist? test_file_path

    desc = ENV['PAGE_URL'].split('://').last.tr('/', '_')
    junit_format = "-f RspecJunitFormatter --out logs/page_#{desc}.xml"
    ENV['REPORT_PATH'] = "reports/#{desc}"
    html_format = '--format html --out report.html'
    command = "rspec #{test_file_path} --format documentation --color #{junit_format} #{html_format}"
    raise $CHILD_STATUS.to_s unless system command
  end

  desc 'version', 'Version of generic_test'
  def version
    require 'generic_test'
    puts "GenericTest version #{GenericTest::VERSION}"
  end
end

Exe.start(ARGV)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
generic_test-0.2.1 exe/generic_test