Class: TestScriptLines

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/innate/test/testscriptlines.rb

Instance Method Summary collapse

Instance Method Details

#test_contentsObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/innate/test/testscriptlines.rb', line 19

def test_contents
  locked = 0
  begin
    Timeout::timeout(30) do
      SCRIPT_LINES__.each do |name, file|
        begin
          lines = File.open(name) {|f| f.readlines }.to_cursor
          file.each do |line|
            assert_equal lines.read1next, line
          end
        rescue Errno::EACCES
          locked += 1
        end
      end
      assert locked <= 3, 'too many locked files...??'
    end
  rescue Timeout::Error
  end
end

#test_definedObject



7
8
9
# File 'lib/innate/test/testscriptlines.rb', line 7

def test_defined
  assert defined?(SCRIPT_LINES__)
end

#test_typesObject



11
12
13
14
15
16
17
# File 'lib/innate/test/testscriptlines.rb', line 11

def test_types
  assert SCRIPT_LINES__.length > 0
  SCRIPT_LINES__.each do |name, file|
    assert File.exists?(name)
    assert_kind_of FileLines, file
  end
end