Class: TargetPractice

Inherits:
Object
  • Object
show all
Defined in:
lib/target_practice.rb,
lib/target_practice/version.rb

Constant Summary collapse

VERSION =
'0.0.5'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sym) {|_self| ... } ⇒ TargetPractice

Returns a new instance of TargetPractice.

Yields:

  • (_self)

Yield Parameters:



16
17
18
19
20
21
22
23
# File 'lib/target_practice.rb', line 16

def initialize(sym)
  @pattern = ""
  @test_class = nil

  yield self

  run_tests
end

Instance Attribute Details

#patternObject

Returns the value of attribute pattern.



14
15
16
# File 'lib/target_practice.rb', line 14

def pattern
  @pattern
end

#test_classObject

Returns the value of attribute test_class.



14
15
16
# File 'lib/target_practice.rb', line 14

def test_class
  @test_class
end

Instance Method Details

#run_testsObject



25
26
27
28
29
30
# File 'lib/target_practice.rb', line 25

def run_tests
  files = FileList[@pattern].to_a
  test = @test_class.new(:tests_against_files)
  test.files = files.map!{ |file| JSON.parse(File.open(file, 'r').read) }
  MiniTest::Unit.new.run
end