#!/usr/bin/env fancy require: "fancy_spec" require: "option_parser" test_dir = "tests" OptionParser new: @{ remove_after_parsed: true banner: "FSpec - FancySpec runner\nOptions:" with: "-d [path]" doc: "Set the tests directory" do: |dir| { test_dir = dir } } . parse: ARGV test_files = ARGV rest if: (test_files empty?) then: { test_files = Directory list: "#{test_dir}/**/*.fy" if: (test_files empty?) then: { if: (Directory exists?: test_dir) then: { "No test files found. Add them to the tests/ directory." println } else: { "Test directory '#{test_dir}' not found. Create it!" println } System exit: 1 } } test_helper = "#{test_dir}/test_helper.fy" if: (test_files includes?: test_helper) then: { test_files remove: test_helper } if: (File exists?: test_helper) then: { try { require: test_helper } catch StandardError => e { *stderr* println: "Error loading #{test_helper}: #{e}" } } start = Time now test_files sort each: |f| { try { require: f } catch StandardError => e { *stderr* println: "Error loading #{f}: #{e}" } } Console newline FancySpec SpecTest print_failures: start no_failures: { System exit: 0 } else: { System exit: 1 }