Class: PublicanCreatorsTest

Inherits:
Object
  • Object
show all
Defined in:
lib/publican_creators/testlib.rb

Overview

Class for methods in testing environment

Class Method Summary collapse

Class Method Details

.check_content(file, pattern) ⇒ String

Method for checking file content

Parameters:

  • file (String)

    can be any file

  • pattern (String)

    is the searchpattern

Returns:

  • (String)

    result



25
26
27
28
29
30
31
# File 'lib/publican_creators/testlib.rb', line 25

def self.check_content(file, pattern)
  f = File.new(file)
  text = f.read
  result = 'false' # Default false
  result = 'true' if text =~ /"#{pattern}"/ # if found true
  return result
end

.cleanupObject

Method for cleanup the test results



34
35
36
# File 'lib/publican_creators/testlib.rb', line 34

def self.cleanup
  system('rm -rf The_holy_Bible*')
end