Class: PriorityTest::Core::AllTests

Inherits:
Object
  • Object
show all
Defined in:
lib/priority_test/core/all_tests.rb

Instance Method Summary collapse

Constructor Details

#initialize(tests = []) ⇒ AllTests

Returns a new instance of AllTests.



4
5
6
# File 'lib/priority_test/core/all_tests.rb', line 4

def initialize(tests=[])
  @test_hash = Hash[tests.collect { |t| [t.identifier, t] }]
end

Instance Method Details

#add_test(test_params) ⇒ Object



8
9
10
11
# File 'lib/priority_test/core/all_tests.rb', line 8

def add_test(test_params)
  test = Test.create(test_params)
  @test_hash[test.identifier] = test
end

#add_test_result(identifier, test_result_params) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/priority_test/core/all_tests.rb', line 17

def add_test_result(identifier, test_result_params)
  test = get_test(identifier)
  if test
    test.add_result(test_result_params)
    test.update_statistics
  end
end

#get_test(identifier) ⇒ Object



13
14
15
# File 'lib/priority_test/core/all_tests.rb', line 13

def get_test(identifier)
  @test_hash[identifier]
end

#sizeObject



25
26
27
# File 'lib/priority_test/core/all_tests.rb', line 25

def size
  @test_hash.size
end