PublicanCreatorsTest.check_content()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 2
c 3
b 0
f 0
dl 0
loc 7
rs 9.4285
1
# Testing Module for PublicanCreators
2
# PublicanCreatorsChange
3
# @author Sascha Manns
4
# @abstract Class for all file changes
5
#
6
# Copyright (C) 2015-2017  Sascha Manns <[email protected]>
7
# License: MIT
8
9
# Dependencies
10
require 'fileutils'
11
12
# Class for methods in testing environment
13
class PublicanCreatorsTest
14
  # Method for checking file content
15
  # @param [String] file can be any file
16
  # @param [String] pattern is the searchpattern
17
  # @return [String] result
18
  def self.check_content(file, pattern)
19
    f = File.new(file)
20
    text = f.read
21
    result = 'false' # Default false
22
    result = 'true' if text =~ /"#{pattern}"/ # if found true
23
    return result
24
  end
25
26
  # Method for cleanup the test results
27
  def self.cleanup
28
    system('rm -rf The_holy_Bible*')
29
  end
30
end
31