Sha256: 1c69bf0c40ffb992d38cb18e1a1069810ec5f364be8c0bf5611c97a9c415ba6b

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 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}"
    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.0 exe/generic_test