#!/usr/bin/env ruby # frozen_string_literal: true require 'thor' $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 command = "rspec #{test_file_path} --format documentation --require generic_test/setup --color --format RspecJunitFormatter --out logs/page_#{desc}.xml" system command end end Exe.start(ARGV)