Class: Assert::CLIRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/assert/cli.rb

Constant Summary collapse

TEST_FILE_SUFFIXES =
['_tests.rb', '_test.rb']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CLIRunner

Returns a new instance of CLIRunner.



53
54
55
56
57
58
59
60
# File 'lib/assert/cli.rb', line 53

def initialize(*args)
  options, test_paths = [
    args.last.kind_of?(::Hash) ? args.pop : {},
    args
  ]

  @test_files = file_paths(test_paths).select{ |f| test_file?(f) }
end

Instance Attribute Details

#test_filesObject (readonly)

Returns the value of attribute test_files.



51
52
53
# File 'lib/assert/cli.rb', line 51

def test_files
  @test_files
end

Instance Method Details

#runObject



62
63
64
65
# File 'lib/assert/cli.rb', line 62

def run
  @test_files.each{ |file| require file }
  require 'assert' if @test_files.empty?  # show empty test output
end