File: assert.rb

package info (click to toggle)
libtmail-ruby 0.10.0-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 624 kB
  • ctags: 1,236
  • sloc: ruby: 5,939; ansic: 1,302; yacc: 337; makefile: 188
file content (39 lines) | stat: -rw-r--r-- 742 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#
# file assertions
#

module RUNIT

  module Assert

    def assert_same_file( from, to )
      setup_assert
      unless File.read(from) == File.read(to) then
        raise_assertion_error "file #{from} != #{to}"
      end
    end

    def assert_file_exist( file )
      setup_assert
      unless File.exist? file then
        raise_assertion_error "file not exist: #{file}"
      end
    end

    def assert_file_not_exist( file )
      setup_assert
      if File.exist? file then
        raise_assertion_error "file not exist: #{file}"
      end
    end

    def assert_is_directory( file )
      setup_assert
      unless File.directory? file then
        raise_assertion_error "is not directory: #{file}"
      end
    end

  end

end