Sha256: cb666dc856daa09dc7b5721c3cb4c72bbb22d3ca2b872fef8f6adc33df3936c7

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

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
  def self.exit_on_failure?
    true
  end

  desc 'page page_url', 'Test web page'
  method_options all_subpages: false
  method_options spellcheck: true
  def page(page_url)
    ENV['PAGE_URL'] = page_url
    ENV['ALL_SUBPAGES'] ||= options.all_subpages?.to_s
    ENV['SPELLCHECK_ON'] = options.spellcheck?.to_s
    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 logs/report.html'
    command = "rspec #{test_file_path} --format documentation --color #{junit_format} #{html_format}"
    exit(1) unless system command
    #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.3.1 exe/generic_test