Class: Dbexpect

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

Instance Method Summary collapse

Constructor Details

#initialize(output = STDOUT) ⇒ Dbexpect

Returns a new instance of Dbexpect.



27
28
29
# File 'lib/dbexpect/dbexpect.rb', line 27

def initialize(output = STDOUT)
  @output = ConsoleFormatter.new(output)
end

Instance Method Details

#great_expectations(script, databases) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/dbexpect/dbexpect.rb', line 37

def great_expectations(script, databases)
  eval_script(script)

  check_table_expectations(databases)

  if validates_expectations?
    @output.notify_passed
    return 0
  else
    @output.notify_failed(failed_expectations)
    return 1
  end
end

#run_test(script, databases, command_runner) ⇒ Object



31
32
33
34
35
# File 'lib/dbexpect/dbexpect.rb', line 31

def run_test(script,databases,command_runner)
  setup_test(script,databases)
  run_etl(script,command_runner)
  great_expectations(script,databases)
end

#setup_test(script, databases) ⇒ Object



51
52
53
54
55
56
57
# File 'lib/dbexpect/dbexpect.rb', line 51

def setup_test(script,databases)
  eval_script(script)
  @tables.each do |table|
    table.set_up_for_test(databases)
  end
  return 0
end