Top Level Namespace

Defined Under Namespace

Classes: Mesa, MesaTestCase, MesaTestSubmitter

Constant Summary collapse

MesaDirError =
Class.new(StandardError)
TestCaseDirError =
Class.new(StandardError)
InvalidDataType =
Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#generate_seeds_rb(mesa_dir, outfile) ⇒ Object

create seed data for test cases for MesaTestHub of a given mesa version



1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
# File 'lib/mesa_test.rb', line 1062

def generate_seeds_rb(mesa_dir, outfile)
  m = Mesa.new(mesa_dir: mesa_dir)
  m.load_test_source_data
  File.open(outfile, 'w') do |f|
    f.puts 'test_cases = TestCase.create!('
    f.puts '  ['
    m.test_names.each do |test_case_name|
      f.puts '    {'
      f.puts "      name: '#{test_case_name}',"
      f.puts "      version_added: #{m.version_number},"
      # no comma on last one
      if test_case_name == m.test_names[-1]
        f.puts('    }')
      else
        f.puts('    },')
      end
    end
    f.puts '  ]'
    f.puts ')'
  end
end

#visit_and_check(new_dir, exception, message) ⇒ Object

cd into a new directory, execute a block whose return value is either true or false. Either way, cd back to original directory. Raise an exception if the block failed (returned false or nil)

Raises:

  • (exception)


1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
# File 'lib/mesa_test.rb', line 1033

def visit_and_check(new_dir, exception, message)
  cwd = Dir.getwd
  shell.say "Leaving  #{cwd}", :blue
  puts ''
  shell.say "Entering #{new_dir}.", :blue
  Dir.chdir(new_dir)
  success = yield if block_given?
  shell.say "Leaving  #{new_dir}", :blue
  puts ''
  shell.say "Entering #{cwd}.", :blue
  Dir.chdir(cwd)
  return if success
  raise exception, message
end

#visit_dir(new_dir) ⇒ Object

cd into a new directory, execute a block, then cd back into original directory



1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
# File 'lib/mesa_test.rb', line 1050

def visit_dir(new_dir)
  cwd = Dir.getwd
  shell.say "Leaving  #{cwd}\n", :blue
  shell.say "Entering #{new_dir}.", :blue
  Dir.chdir(new_dir)
  yield if block_given?
  shell.say "Leaving  #{new_dir}\n", :blue
  shell.say "Entering #{cwd}.", :blue
  Dir.chdir(cwd)
end