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
-
#generate_seeds_rb(mesa_dir, outfile) ⇒ Object
create seed data for test cases for MesaTestHub of a given mesa version.
-
#visit_and_check(new_dir, exception, message) ⇒ Object
cd into a new directory, execute a block whose return value is either true or false.
-
#visit_dir(new_dir) ⇒ Object
cd into a new directory, execute a block, then cd back into original directory.
Instance Method Details
#generate_seeds_rb(mesa_dir, outfile) ⇒ Object
create seed data for test cases for MesaTestHub of a given mesa version
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 |
# File 'lib/mesa_test.rb', line 1026 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)
997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 |
# File 'lib/mesa_test.rb', line 997 def visit_and_check(new_dir, exception, ) 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 unless success raise exception, end |
#visit_dir(new_dir) ⇒ Object
cd into a new directory, execute a block, then cd back into original directory
1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 |
# File 'lib/mesa_test.rb', line 1014 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 |