cosmos 3.2.1 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (364) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +195 -0
  3. data/README.md +3 -3
  4. data/data/crc.txt +52 -52
  5. data/lib/cosmos.rb +1 -1
  6. data/lib/cosmos/core_ext/time.rb +11 -9
  7. data/lib/cosmos/gui/choosers/telemetry_chooser.rb +0 -2
  8. data/lib/cosmos/gui/dialogs/about_dialog.rb +2 -2
  9. data/lib/cosmos/gui/dialogs/exception_dialog.rb +2 -2
  10. data/lib/cosmos/gui/dialogs/progress_dialog.rb +11 -5
  11. data/lib/cosmos/gui/dialogs/splash.rb +32 -10
  12. data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +1 -1
  13. data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +2 -2
  14. data/lib/cosmos/gui/qt.rb +22 -22
  15. data/lib/cosmos/io/json_drb.rb +4 -4
  16. data/lib/cosmos/io/json_rpc.rb +21 -21
  17. data/lib/cosmos/packet_logs/packet_log_writer.rb +18 -20
  18. data/lib/cosmos/packets/commands.rb +8 -6
  19. data/lib/cosmos/packets/limits.rb +3 -2
  20. data/lib/cosmos/packets/packet.rb +14 -11
  21. data/lib/cosmos/packets/parsers/limits_parser.rb +1 -1
  22. data/lib/cosmos/packets/parsers/macro_parser.rb +4 -4
  23. data/lib/cosmos/packets/parsers/state_parser.rb +1 -1
  24. data/lib/cosmos/packets/structure.rb +2 -2
  25. data/lib/cosmos/packets/telemetry.rb +5 -4
  26. data/lib/cosmos/script/script.rb +6 -6
  27. data/lib/cosmos/streams/tcpip_socket_stream.rb +2 -1
  28. data/lib/cosmos/streams/template_stream_protocol.rb +1 -1
  29. data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +1 -1
  30. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +5 -8
  31. data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +4 -3
  32. data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +9 -3
  33. data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +15 -11
  34. data/lib/cosmos/tools/data_viewer/data_viewer.rb +1 -1
  35. data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +2 -2
  36. data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +2 -2
  37. data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +0 -2
  38. data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +1 -1
  39. data/lib/cosmos/tools/replay/replay.rb +2 -2
  40. data/lib/cosmos/tools/script_runner/script_audit.rb +1 -1
  41. data/lib/cosmos/tools/script_runner/script_runner.rb +1 -1
  42. data/lib/cosmos/tools/script_runner/script_runner_frame.rb +3 -7
  43. data/lib/cosmos/tools/table_manager/table_config.rb +1 -1
  44. data/lib/cosmos/tools/test_runner/results_writer.rb +1 -1
  45. data/lib/cosmos/tools/test_runner/test_runner.rb +2 -2
  46. data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +2 -1
  47. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +1 -1
  48. data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +1 -0
  49. data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +1 -0
  50. data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +1 -0
  51. data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +3 -3
  52. data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +1 -3
  53. data/lib/cosmos/top_level.rb +2 -6
  54. data/lib/cosmos/utilities/ruby_lex_utils.rb +1 -1
  55. data/lib/cosmos/version.rb +5 -5
  56. data/lib/cosmos/win32/win32_main.rb +11 -7
  57. data/spec/ccsds/ccsds_packet_spec.rb +28 -28
  58. data/spec/ccsds/ccsds_parser_spec.rb +27 -27
  59. data/spec/config/config_parser_spec.rb +88 -88
  60. data/spec/conversions/conversion_spec.rb +3 -3
  61. data/spec/conversions/generic_conversion_spec.rb +9 -9
  62. data/spec/conversions/new_packet_log_conversion_spec.rb +4 -4
  63. data/spec/conversions/polynomial_conversion_spec.rb +7 -7
  64. data/spec/conversions/processor_conversion_spec.rb +9 -9
  65. data/spec/conversions/received_count_conversion_spec.rb +7 -7
  66. data/spec/conversions/received_time_formatted_conversion_spec.rb +9 -9
  67. data/spec/conversions/received_time_seconds_conversion_spec.rb +9 -9
  68. data/spec/conversions/segmented_polynomial_conversion_spec.rb +11 -11
  69. data/spec/conversions/unix_time_formatted_conversion_spec.rb +13 -13
  70. data/spec/conversions/unix_time_seconds_conversion_spec.rb +13 -13
  71. data/spec/core_ext/array_spec.rb +76 -76
  72. data/spec/core_ext/class_spec.rb +3 -3
  73. data/spec/core_ext/cosmos_io_spec.rb +16 -16
  74. data/spec/core_ext/exception_spec.rb +19 -19
  75. data/spec/core_ext/file_spec.rb +16 -16
  76. data/spec/core_ext/hash_spec.rb +3 -3
  77. data/spec/core_ext/io_spec.rb +2 -2
  78. data/spec/core_ext/kernel_spec.rb +2 -2
  79. data/spec/core_ext/math_spec.rb +43 -43
  80. data/spec/core_ext/matrix_spec.rb +22 -22
  81. data/spec/core_ext/objectspace_spec.rb +6 -6
  82. data/spec/core_ext/range_spec.rb +2 -2
  83. data/spec/core_ext/socket_spec.rb +4 -4
  84. data/spec/core_ext/string_spec.rb +67 -67
  85. data/spec/core_ext/stringio_spec.rb +2 -2
  86. data/spec/core_ext/time_spec.rb +82 -82
  87. data/spec/gui/line_graph/line_clip_spec.rb +34 -34
  88. data/spec/interfaces/interface_spec.rb +46 -46
  89. data/spec/interfaces/linc_interface_spec.rb +26 -26
  90. data/spec/interfaces/serial_interface_spec.rb +16 -16
  91. data/spec/interfaces/simulated_target_interface_spec.rb +21 -21
  92. data/spec/interfaces/stream_interface_spec.rb +22 -22
  93. data/spec/interfaces/tcpip_client_interface_spec.rb +14 -14
  94. data/spec/interfaces/tcpip_server_interface_spec.rb +41 -41
  95. data/spec/interfaces/udp_interface_spec.rb +46 -46
  96. data/spec/io/buffered_file_spec.rb +50 -50
  97. data/spec/io/io_multiplexer_spec.rb +9 -9
  98. data/spec/io/json_drb_object_spec.rb +7 -7
  99. data/spec/io/json_drb_spec.rb +55 -55
  100. data/spec/io/json_rpc_spec.rb +68 -68
  101. data/spec/io/raw_logger_pair_spec.rb +28 -28
  102. data/spec/io/raw_logger_spec.rb +22 -22
  103. data/spec/io/serial_driver_spec.rb +3 -3
  104. data/spec/io/stderr_spec.rb +2 -2
  105. data/spec/io/stdout_spec.rb +2 -2
  106. data/spec/io/tcpip_server_spec.rb +62 -62
  107. data/spec/io/udp_sockets_spec.rb +19 -19
  108. data/spec/io/win32_serial_driver_spec.rb +10 -10
  109. data/spec/packet_logs/meta_packet_log_writer_spec.rb +32 -32
  110. data/spec/packet_logs/packet_log_reader_spec.rb +138 -138
  111. data/spec/packet_logs/packet_log_writer_pair_spec.rb +3 -3
  112. data/spec/packet_logs/packet_log_writer_spec.rb +26 -26
  113. data/spec/packets/binary_accessor_spec.rb +672 -672
  114. data/spec/packets/commands_spec.rb +123 -123
  115. data/spec/packets/limits_response_spec.rb +1 -1
  116. data/spec/packets/limits_spec.rb +69 -69
  117. data/spec/packets/packet_config_spec.rb +93 -93
  118. data/spec/packets/packet_item_limits_spec.rb +46 -46
  119. data/spec/packets/packet_item_spec.rb +108 -108
  120. data/spec/packets/packet_spec.rb +364 -348
  121. data/spec/packets/parsers/format_string_parser_spec.rb +13 -13
  122. data/spec/packets/parsers/limits_parser_spec.rb +8 -8
  123. data/spec/packets/parsers/limits_response_parser_spec.rb +9 -9
  124. data/spec/packets/parsers/macro_parser_spec.rb +34 -6
  125. data/spec/packets/parsers/packet_parser_spec.rb +6 -6
  126. data/spec/packets/parsers/processor_parser_spec.rb +7 -7
  127. data/spec/packets/parsers/state_parser_spec.rb +23 -23
  128. data/spec/packets/structure_item_spec.rb +62 -62
  129. data/spec/packets/structure_spec.rb +183 -183
  130. data/spec/packets/telemetry_spec.rb +174 -174
  131. data/spec/processors/new_packet_log_processor_spec.rb +4 -4
  132. data/spec/processors/processor_spec.rb +9 -9
  133. data/spec/processors/statistics_processor_spec.rb +21 -21
  134. data/spec/processors/watermark_processor_spec.rb +12 -12
  135. data/spec/script/script_spec.rb +158 -158
  136. data/spec/spec_helper.rb +44 -13
  137. data/spec/streams/burst_stream_protocol_spec.rb +8 -8
  138. data/spec/streams/fixed_stream_protocol_spec.rb +26 -26
  139. data/spec/streams/length_stream_protocol_spec.rb +27 -27
  140. data/spec/streams/preidentified_stream_protocol_spec.rb +25 -25
  141. data/spec/streams/serial_stream_spec.rb +19 -19
  142. data/spec/streams/stream_protocol_spec.rb +52 -52
  143. data/spec/streams/stream_spec.rb +1 -1
  144. data/spec/streams/tcpip_client_stream_spec.rb +7 -7
  145. data/spec/streams/tcpip_socket_stream_spec.rb +84 -49
  146. data/spec/streams/template_stream_protocol_spec.rb +17 -17
  147. data/spec/streams/terminated_stream_protocol_spec.rb +19 -19
  148. data/spec/system/system_spec.rb +95 -95
  149. data/spec/system/target_spec.rb +32 -32
  150. data/spec/tools/cmd_tlm_server/api_spec.rb +386 -386
  151. data/spec/tools/cmd_tlm_server/background_task_spec.rb +3 -3
  152. data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +8 -8
  153. data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +57 -57
  154. data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +85 -85
  155. data/spec/tools/cmd_tlm_server/commanding_spec.rb +11 -11
  156. data/spec/tools/cmd_tlm_server/connections_spec.rb +23 -23
  157. data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +57 -57
  158. data/spec/tools/cmd_tlm_server/interfaces_spec.rb +32 -32
  159. data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +17 -17
  160. data/spec/tools/cmd_tlm_server/router_thread_spec.rb +15 -15
  161. data/spec/tools/cmd_tlm_server/routers_spec.rb +36 -36
  162. data/spec/top_level/top_level_spec.rb +60 -60
  163. data/spec/utilities/crc_spec.rb +6 -6
  164. data/spec/utilities/csv_spec.rb +13 -13
  165. data/spec/utilities/logger_spec.rb +20 -20
  166. data/spec/utilities/message_log_spec.rb +13 -13
  167. data/spec/utilities/quaternion_spec.rb +30 -30
  168. data/spec/utilities/ruby_lex_utils_spec.rb +14 -14
  169. data/test/benchmarks/binary_accessor_benchmark.rb +14 -0
  170. data/test/benchmarks/gsub_benchmark.rb +114 -0
  171. data/test/performance/PACKETS.bat +1 -0
  172. data/test/performance/Rakefile +77 -0
  173. data/test/performance/THREADS.bat +1 -0
  174. data/test/performance/config/data/attitude.bin +0 -0
  175. data/test/performance/config/data/crc.txt +206 -0
  176. data/test/performance/config/data/diamond.STL +58 -0
  177. data/test/performance/config/data/groundoff.gif +0 -0
  178. data/test/performance/config/data/groundon.gif +0 -0
  179. data/test/performance/config/data/hselectoff.gif +0 -0
  180. data/test/performance/config/data/hselecton.gif +0 -0
  181. data/test/performance/config/data/hswitchoff.gif +0 -0
  182. data/test/performance/config/data/hswitchon.gif +0 -0
  183. data/test/performance/config/data/meta_init.txt +4 -0
  184. data/test/performance/config/data/position.bin +0 -0
  185. data/test/performance/config/data/poweroff.gif +0 -0
  186. data/test/performance/config/data/poweron.gif +0 -0
  187. data/test/performance/config/data/satellite.gif +0 -0
  188. data/test/performance/config/data/tada.wav +0 -0
  189. data/test/performance/config/data/vswitchoff.gif +0 -0
  190. data/test/performance/config/data/vswitchon.gif +0 -0
  191. data/test/performance/config/system/system_packets.txt +39 -0
  192. data/test/performance/config/system/system_threads.txt +59 -0
  193. data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -0
  194. data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -0
  195. data/test/performance/config/targets/COSMOS/cmd_tlm_server.txt +6 -0
  196. data/test/performance/config/targets/COSMOS/screens/limits_change.txt +20 -0
  197. data/test/performance/config/targets/COSMOS/screens/version.txt +19 -0
  198. data/test/performance/config/targets/COSMOS/target.txt +11 -0
  199. data/test/performance/config/targets/EXAMPLE/cmd_tlm/example_cmds.txt +17 -0
  200. data/test/performance/config/targets/EXAMPLE/cmd_tlm/example_tlm.txt +18 -0
  201. data/test/performance/config/targets/EXAMPLE/cmd_tlm_server.txt +6 -0
  202. data/test/performance/config/targets/EXAMPLE/lib/example_interface.rb +22 -0
  203. data/test/performance/config/targets/EXAMPLE/target.txt +7 -0
  204. data/test/performance/config/targets/SYSTEM/screens/status.txt +12 -0
  205. data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_packets.txt +34 -0
  206. data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_threads.txt +68 -0
  207. data/test/performance/config/tools/data_viewer/data_viewer.txt +11 -0
  208. data/test/performance/config/tools/handbook_creator/default_toc.xsl +59 -0
  209. data/test/performance/config/tools/handbook_creator/handbook_creator.txt +66 -0
  210. data/test/performance/config/tools/handbook_creator/templates/command_packets.html.erb +86 -0
  211. data/test/performance/config/tools/handbook_creator/templates/command_toc.html.erb +38 -0
  212. data/test/performance/config/tools/handbook_creator/templates/footer.html.erb +9 -0
  213. data/test/performance/config/tools/handbook_creator/templates/header.html.erb +25 -0
  214. data/test/performance/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -0
  215. data/test/performance/config/tools/handbook_creator/templates/nav.html.erb +27 -0
  216. data/test/performance/config/tools/handbook_creator/templates/overview.html.erb +1 -0
  217. data/test/performance/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -0
  218. data/test/performance/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -0
  219. data/test/performance/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -0
  220. data/test/performance/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -0
  221. data/test/performance/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -0
  222. data/test/performance/config/tools/handbook_creator/templates/title.html.erb +1 -0
  223. data/test/performance/config/tools/launcher/launcher_packets.txt +29 -0
  224. data/test/performance/config/tools/launcher/launcher_threads.txt +70 -0
  225. data/test/performance/config/tools/limits_monitor/README.txt +1 -0
  226. data/test/performance/config/tools/opengl_builder/README.txt +1 -0
  227. data/test/performance/config/tools/script_runner/script_runner.txt +3 -0
  228. data/test/performance/config/tools/table_manager/ConfigTables_def.txt +8 -0
  229. data/test/performance/config/tools/table_manager/ExampleTableDefinition.txt +24 -0
  230. data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +25 -0
  231. data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +25 -0
  232. data/test/performance/config/tools/table_manager/PPSSelectionTable_def.txt +8 -0
  233. data/test/performance/config/tools/table_manager/TLMMonitoringTable_def.txt +248 -0
  234. data/test/performance/config/tools/test_runner/test_runner.txt +17 -0
  235. data/test/performance/config/tools/tlm_extractor/tlm_extractor.txt +13 -0
  236. data/test/performance/config/tools/tlm_extractor/tlm_extractor2.txt +2 -0
  237. data/test/performance/config/tools/tlm_extractor/tlm_extractor3.txt +2 -0
  238. data/test/performance/config/tools/tlm_extractor/tlm_extractor4.txt +2 -0
  239. data/test/performance/config/tools/tlm_grapher/README.txt +1 -0
  240. data/test/performance/config/tools/tlm_viewer/tlm_viewer.txt +41 -0
  241. data/test/performance/lib/example_background_task.rb +57 -0
  242. data/test/performance/lib/example_target.rb +120 -0
  243. data/test/performance/lib/scpi_target.rb +74 -0
  244. data/test/performance/lib/user_version.rb +3 -0
  245. data/test/performance/outputs/handbooks/README.txt +1 -0
  246. data/test/performance/outputs/logs/README.txt +1 -0
  247. data/test/performance/outputs/saved_config/README.txt +1 -0
  248. data/test/performance/outputs/tables/README.txt +1 -0
  249. data/test/performance/outputs/tmp/README.txt +1 -0
  250. data/test/performance/procedures/checks.rb +11 -0
  251. data/test/performance/procedures/clear_util.rb +7 -0
  252. data/test/performance/procedures/collect.rb +18 -0
  253. data/test/performance/procedures/collect_util.rb +14 -0
  254. data/test/performance/procedures/cosmos_api_test.rb +293 -0
  255. data/test/performance/procedures/disconnect.rb +29 -0
  256. data/test/performance/procedures/example_test.rb +182 -0
  257. data/test/performance/procedures/plot_test.rb +8 -0
  258. data/test/performance/procedures/procedure.rb +3 -0
  259. data/test/performance/procedures/run_example_test.rb +3 -0
  260. data/test/performance/procedures/test.rb +51 -0
  261. data/test/performance/tools/CmdExtractor +14 -0
  262. data/test/performance/tools/CmdExtractor.bat +59 -0
  263. data/test/performance/tools/CmdSender +14 -0
  264. data/test/performance/tools/CmdSender.bat +59 -0
  265. data/test/performance/tools/CmdTlmServer +16 -0
  266. data/test/performance/tools/CmdTlmServer.bat +59 -0
  267. data/test/performance/tools/CmdTlmServerMemProf +20 -0
  268. data/test/performance/tools/CmdTlmServerMemProf.bat +59 -0
  269. data/test/performance/tools/DataViewer +14 -0
  270. data/test/performance/tools/DataViewer.bat +59 -0
  271. data/test/performance/tools/ExampleTarget +14 -0
  272. data/test/performance/tools/ExampleTarget.bat +59 -0
  273. data/test/performance/tools/HandbookCreator +14 -0
  274. data/test/performance/tools/HandbookCreator.bat +61 -0
  275. data/test/performance/tools/Launcher +14 -0
  276. data/test/performance/tools/Launcher.bat +59 -0
  277. data/test/performance/tools/LimitsMonitor +14 -0
  278. data/test/performance/tools/LimitsMonitor.bat +59 -0
  279. data/test/performance/tools/OpenGLBuilder +14 -0
  280. data/test/performance/tools/OpenGLBuilder.bat +59 -0
  281. data/test/performance/tools/PacketViewer +14 -0
  282. data/test/performance/tools/PacketViewer.bat +59 -0
  283. data/test/performance/tools/Replay +14 -0
  284. data/test/performance/tools/Replay.bat +59 -0
  285. data/test/performance/tools/ScpiTarget +14 -0
  286. data/test/performance/tools/ScpiTarget.bat +59 -0
  287. data/test/performance/tools/ScriptRunner +14 -0
  288. data/test/performance/tools/ScriptRunner.bat +59 -0
  289. data/test/performance/tools/TableManager +14 -0
  290. data/test/performance/tools/TableManager.bat +59 -0
  291. data/test/performance/tools/TestRunner +14 -0
  292. data/test/performance/tools/TestRunner.bat +59 -0
  293. data/test/performance/tools/TlmExtractor +14 -0
  294. data/test/performance/tools/TlmExtractor.bat +59 -0
  295. data/test/performance/tools/TlmGrapher +14 -0
  296. data/test/performance/tools/TlmGrapher.bat +59 -0
  297. data/test/performance/tools/TlmViewer +14 -0
  298. data/test/performance/tools/TlmViewer.bat +59 -0
  299. data/test/performance/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -0
  300. data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -0
  301. data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -0
  302. data/test/performance/tools/mac/CmdExtractor.app/Contents/Resources/appIcon.icns +0 -0
  303. data/test/performance/tools/mac/CmdSender.app/Contents/Info.plist +38 -0
  304. data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -0
  305. data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -0
  306. data/test/performance/tools/mac/CmdSender.app/Contents/Resources/appIcon.icns +0 -0
  307. data/test/performance/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -0
  308. data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -0
  309. data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -0
  310. data/test/performance/tools/mac/CmdTlmServer.app/Contents/Resources/appIcon.icns +0 -0
  311. data/test/performance/tools/mac/DataViewer.app/Contents/Info.plist +38 -0
  312. data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -0
  313. data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -0
  314. data/test/performance/tools/mac/DataViewer.app/Contents/Resources/appIcon.icns +0 -0
  315. data/test/performance/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -0
  316. data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -0
  317. data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -0
  318. data/test/performance/tools/mac/HandbookCreator.app/Contents/Resources/appIcon.icns +0 -0
  319. data/test/performance/tools/mac/Launcher.app/Contents/Info.plist +38 -0
  320. data/test/performance/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -0
  321. data/test/performance/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -0
  322. data/test/performance/tools/mac/Launcher.app/Contents/Resources/appIcon.icns +0 -0
  323. data/test/performance/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -0
  324. data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -0
  325. data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -0
  326. data/test/performance/tools/mac/LimitsMonitor.app/Contents/Resources/appIcon.icns +0 -0
  327. data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -0
  328. data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -0
  329. data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -0
  330. data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Resources/appIcon.icns +0 -0
  331. data/test/performance/tools/mac/PacketViewer.app/Contents/Info.plist +38 -0
  332. data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -0
  333. data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -0
  334. data/test/performance/tools/mac/PacketViewer.app/Contents/Resources/appIcon.icns +0 -0
  335. data/test/performance/tools/mac/Replay.app/Contents/Info.plist +38 -0
  336. data/test/performance/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -0
  337. data/test/performance/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -0
  338. data/test/performance/tools/mac/Replay.app/Contents/Resources/appIcon.icns +0 -0
  339. data/test/performance/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -0
  340. data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -0
  341. data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -0
  342. data/test/performance/tools/mac/ScriptRunner.app/Contents/Resources/appIcon.icns +0 -0
  343. data/test/performance/tools/mac/TableManager.app/Contents/Info.plist +38 -0
  344. data/test/performance/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -0
  345. data/test/performance/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -0
  346. data/test/performance/tools/mac/TableManager.app/Contents/Resources/appIcon.icns +0 -0
  347. data/test/performance/tools/mac/TestRunner.app/Contents/Info.plist +38 -0
  348. data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -0
  349. data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -0
  350. data/test/performance/tools/mac/TestRunner.app/Contents/Resources/appIcon.icns +0 -0
  351. data/test/performance/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -0
  352. data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -0
  353. data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -0
  354. data/test/performance/tools/mac/TlmExtractor.app/Contents/Resources/appIcon.icns +0 -0
  355. data/test/performance/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -0
  356. data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -0
  357. data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -0
  358. data/test/performance/tools/mac/TlmGrapher.app/Contents/Resources/appIcon.icns +0 -0
  359. data/test/performance/tools/mac/TlmViewer.app/Contents/Info.plist +38 -0
  360. data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -0
  361. data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -0
  362. data/test/performance/tools/mac/TlmViewer.app/Contents/Resources/appIcon.icns +0 -0
  363. data/test/performance/userpath.txt +1 -0
  364. metadata +197 -2
@@ -19,13 +19,13 @@ module Cosmos
19
19
  end
20
20
 
21
21
  describe "add_stream" do
22
- it "should add a single stream" do
22
+ it "adds a single stream" do
23
23
  @io.add_stream(STDOUT)
24
24
  expect($stdout).to receive(:puts).with("TEST")
25
25
  @io.puts "TEST"
26
26
  end
27
27
 
28
- it "should add multiple streams" do
28
+ it "adds multiple streams" do
29
29
  @io.add_stream(STDOUT)
30
30
  @io.add_stream(STDERR)
31
31
  expect($stdout).to receive(:puts).with("TEST")
@@ -35,7 +35,7 @@ module Cosmos
35
35
  end
36
36
 
37
37
  describe "remove_stream" do
38
- it "should remove the stream from output" do
38
+ it "removes the stream from output" do
39
39
  @io.add_stream(STDOUT)
40
40
  @io.add_stream(STDERR)
41
41
  @io.remove_stream(STDOUT)
@@ -46,7 +46,7 @@ module Cosmos
46
46
  end
47
47
 
48
48
  describe "print, printf, putc, puts, flush" do
49
- it "should defer to the stream" do
49
+ it "defers to the stream" do
50
50
  @io.add_stream(STDOUT)
51
51
  expect($stdout).to receive(:print).with("TEST")
52
52
  @io.print "TEST"
@@ -62,19 +62,19 @@ module Cosmos
62
62
  end
63
63
 
64
64
  describe "write write_nonblock" do
65
- it "should defer to the stream" do
65
+ it "defers to the stream" do
66
66
  @io.add_stream(STDOUT)
67
67
  expect($stdout).to receive(:write).with("TEST")
68
68
  len = @io.write "TEST"
69
- len.should eql 4
69
+ expect(len).to eql 4
70
70
  expect($stdout).to receive(:write_nonblock).with("TEST")
71
71
  len = @io.write_nonblock "TEST"
72
- len.should eql 4
72
+ expect(len).to eql 4
73
73
  end
74
74
  end
75
75
 
76
76
  describe "remove_default_io" do
77
- it "should remove STDOUT and STDERR from the streams" do
77
+ it "removes STDOUT and STDERR from the streams" do
78
78
  f = File.open("unittest.txt",'w')
79
79
  @io.add_stream(STDOUT)
80
80
  @io.add_stream(STDERR)
@@ -84,7 +84,7 @@ module Cosmos
84
84
  f.close
85
85
  expect($stdout).not_to receive(:puts).with("TEST")
86
86
  expect($stderr).not_to receive(:puts).with("TEST")
87
- File.read("unittest.txt").should eql "TEST\n"
87
+ expect(File.read("unittest.txt")).to eql "TEST\n"
88
88
  File.delete("unittest.txt")
89
89
  end
90
90
  end
@@ -15,13 +15,13 @@ module Cosmos
15
15
 
16
16
  describe JsonDRbObject do
17
17
  describe "initialize" do
18
- it "should rescue bad hosts" do
18
+ it "rescues bad hosts" do
19
19
  expect { JsonDRbObject.new("blah", 7777) }.to raise_error("Invalid hostname: blah")
20
20
  end
21
21
  end
22
22
 
23
23
  describe "method_missing" do
24
- it "should call the method on the remote object" do
24
+ it "calls the method on the remote object" do
25
25
  class JsonDRbObjectServer
26
26
  def my_method(param)
27
27
  param * 2
@@ -31,13 +31,13 @@ module Cosmos
31
31
  json = JsonDRb.new
32
32
  json.start_service('127.0.0.1', 7777, JsonDRbObjectServer.new)
33
33
  obj = JsonDRbObject.new("localhost", 7777)
34
- obj.my_method(10).should eql 20
34
+ expect(obj.my_method(10)).to eql 20
35
35
  obj.disconnect
36
36
  json.stop_service
37
37
  sleep(0.1)
38
38
  end
39
39
 
40
- it "should raise an exception if the remote connection can't be made" do
40
+ it "raises an exception if the remote connection can't be made" do
41
41
  json = JsonDRb.new
42
42
  json.start_service('127.0.0.1', 7777, self)
43
43
  allow_any_instance_of(Socket).to receive(:connect_nonblock) { raise "Error" }
@@ -48,7 +48,7 @@ module Cosmos
48
48
  sleep(0.1)
49
49
  end
50
50
 
51
- it "should retry the request and then raise an exception" do
51
+ it "retries the request and then raise an exception" do
52
52
  class JsonDRbObjectServer
53
53
  def my_method(param)
54
54
  param * 2
@@ -65,7 +65,7 @@ module Cosmos
65
65
  sleep(0.1)
66
66
  end
67
67
 
68
- it "should raise an exception if the remote method returns an error" do
68
+ it "raises an exception if the remote method returns an error" do
69
69
  json = JsonDRb.new
70
70
  json.start_service('127.0.0.1', 7777, self)
71
71
  obj = JsonDRbObject.new("localhost", 7777)
@@ -76,7 +76,7 @@ module Cosmos
76
76
  sleep(0.1)
77
77
  end
78
78
 
79
- it "should handle the remote not returning a response" do
79
+ it "handles the remote not returning a response" do
80
80
  class JsonDRbObjectServer
81
81
  def my_method(param)
82
82
  param * 2
@@ -20,60 +20,60 @@ module Cosmos
20
20
  end
21
21
 
22
22
  describe "initialize" do
23
- it "should set request_count and num_clients to 0" do
24
- @json.request_count.should eql 0
25
- @json.num_clients.should eql 0
23
+ it "sets request_count and num_clients to 0" do
24
+ expect(@json.request_count).to eql 0
25
+ expect(@json.num_clients).to eql 0
26
26
  end
27
27
  end
28
28
 
29
29
  describe "acl" do
30
- it "should set the access control list" do
30
+ it "sets the access control list" do
31
31
  acl = ACL.new(['allow','127.0.0.1'], ACL::ALLOW_DENY)
32
32
  @json.acl = acl
33
- @json.acl.should eql acl
33
+ expect(@json.acl).to eql acl
34
34
  end
35
35
  end
36
36
 
37
37
  describe "method_whitelist" do
38
- it "should set the method whitelist" do
38
+ it "sets the method whitelist" do
39
39
  @json.method_whitelist = ['cmd']
40
- @json.method_whitelist.should eql ['cmd']
40
+ expect(@json.method_whitelist).to eql ['cmd']
41
41
  end
42
42
  end
43
43
 
44
44
  describe "add_request_time, average_request_time" do
45
- it "should add time to the list and return the average" do
45
+ it "adds time to the list and return the average" do
46
46
  @json.add_request_time(1.0)
47
47
  @json.add_request_time(2.0)
48
48
  @json.add_request_time(3.0)
49
- @json.average_request_time.should eql 2.0
49
+ expect(@json.average_request_time).to eql 2.0
50
50
  end
51
51
  end
52
52
 
53
53
  describe "start_service" do
54
- it "should do nothing when passed no parameters" do
55
- @json.thread.should be_nil
54
+ it "does nothing when passed no parameters" do
55
+ expect(@json.thread).to be_nil
56
56
  @json.start_service()
57
- @json.thread.should be_nil
57
+ expect(@json.thread).to be_nil
58
58
  end
59
59
 
60
- it "should raise an error when passed incomplete parameters" do
61
- @json.thread.should be_nil
60
+ it "raises an error when passed incomplete parameters" do
61
+ expect(@json.thread).to be_nil
62
62
  expect { @json.start_service('127.0.0.1') }.to raise_error
63
63
  expect { @json.start_service('127.0.0.1', 7777) }.to raise_error
64
- @json.thread.should be_nil
64
+ expect(@json.thread).to be_nil
65
65
  end
66
66
 
67
- it "should raise an error when passed a bad host" do
67
+ it "raises an error when passed a bad host" do
68
68
  capture_io do |stdout|
69
- @json.thread.should be_nil
69
+ expect(@json.thread).to be_nil
70
70
  system_exit_count = $system_exit_count
71
71
  @json.start_service('blah', 7777, self)
72
72
  thread = @json.thread
73
- $system_exit_count.should eql(system_exit_count + 1)
73
+ expect($system_exit_count).to eql(system_exit_count + 1)
74
74
  sleep 0.1
75
75
 
76
- stdout.string.should match /listen thread/
76
+ expect(stdout.string).to match /listen thread/
77
77
  @json.stop_service
78
78
  sleep(0.1)
79
79
  end
@@ -83,16 +83,16 @@ module Cosmos
83
83
  end
84
84
  end
85
85
 
86
- it "should create a single listen thread" do
87
- @json.thread.should be_nil
86
+ it "creates a single listen thread" do
87
+ expect(@json.thread).to be_nil
88
88
  @json.start_service('127.0.0.1', 7777, self)
89
- @json.thread.alive?.should be_truthy
89
+ expect(@json.thread.alive?).to be_truthy
90
90
  expect { @json.start_service('127.0.0.1', 7777, self) }.to raise_error(/Error binding to port/)
91
91
  @json.stop_service
92
92
  sleep(0.1)
93
93
  end
94
94
 
95
- it "should rescue listen thread exceptions" do
95
+ it "rescues listen thread exceptions" do
96
96
  capture_io do |stdout|
97
97
  allow_any_instance_of(TCPServer).to receive(:accept_nonblock) { raise "BLAH" }
98
98
  @json.start_service('127.0.0.1', 7777, self)
@@ -101,7 +101,7 @@ module Cosmos
101
101
  @json.stop_service
102
102
  sleep(0.1)
103
103
 
104
- stdout.string.should match /JsonDRb listen thread unexpectedly died/
104
+ expect(stdout.string).to match /JsonDRb listen thread unexpectedly died/
105
105
  end
106
106
 
107
107
  Dir[File.join(Cosmos::USERPATH,"*_exception.txt")].each do |file|
@@ -109,12 +109,12 @@ module Cosmos
109
109
  end
110
110
  end
111
111
 
112
- it "should ignore connections via the ACL" do
112
+ it "ignores connections via the ACL" do
113
113
  @json.acl = ACL.new(['deny','127.0.0.1'], ACL::ALLOW_DENY)
114
114
  @json.start_service('127.0.0.1', 7777, self)
115
115
  socket = TCPSocket.open('127.0.0.1',7777)
116
116
  sleep 0.1
117
- socket.eof?.should be_truthy
117
+ expect(socket.eof?).to be_truthy
118
118
  socket.close
119
119
  @json.stop_service
120
120
  sleep(0.1)
@@ -122,7 +122,7 @@ module Cosmos
122
122
  end
123
123
 
124
124
  describe "receive_message" do
125
- it "should return nil if 4 bytes of data aren't available" do
125
+ it "returns nil if 4 bytes of data aren't available" do
126
126
  @json.start_service('127.0.0.1', 7777, self)
127
127
  socket = TCPSocket.open('127.0.0.1',7777)
128
128
  # Stub recv_nonblock so it returns nothing
@@ -130,14 +130,14 @@ module Cosmos
130
130
  sleep 0.1
131
131
  JsonDRb.send_data(socket, "\x00")
132
132
  response_data = JsonDRb.receive_message(socket, '')
133
- response_data.should be_nil
133
+ expect(response_data).to be_nil
134
134
  socket.close
135
135
  sleep 0.1
136
136
  @json.stop_service
137
137
  sleep(0.1)
138
138
  end
139
139
 
140
- it "should process success requests" do
140
+ it "processes success requests" do
141
141
  class MyServer1
142
142
  def my_method(param)
143
143
  end
@@ -150,14 +150,14 @@ module Cosmos
150
150
  JsonDRb.send_data(socket, request)
151
151
  response_data = JsonDRb.receive_message(socket, '')
152
152
  response = JsonRpcResponse.from_json(response_data)
153
- response.should be_a(JsonRpcSuccessResponse)
153
+ expect(response).to be_a(JsonRpcSuccessResponse)
154
154
  socket.close
155
155
  sleep 0.1
156
156
  @json.stop_service
157
157
  sleep(0.1)
158
158
  end
159
159
 
160
- it "should process bad methods" do
160
+ it "processes bad methods" do
161
161
  class MyServer2
162
162
  end
163
163
 
@@ -168,16 +168,16 @@ module Cosmos
168
168
  JsonDRb.send_data(socket, request)
169
169
  response_data = JsonDRb.receive_message(socket, '')
170
170
  response = JsonRpcResponse.from_json(response_data)
171
- response.should be_a(JsonRpcErrorResponse)
172
- response.error.code.should eql -32601
173
- response.error.message.should eql "Method not found"
171
+ expect(response).to be_a(JsonRpcErrorResponse)
172
+ expect(response.error.code).to eql -32601
173
+ expect(response.error.message).to eql "Method not found"
174
174
  socket.close
175
175
  sleep 0.1
176
176
  @json.stop_service
177
177
  sleep(0.1)
178
178
  end
179
179
 
180
- it "should process bad parameters" do
180
+ it "processes bad parameters" do
181
181
  class MyServer3
182
182
  def my_method(param1, param2)
183
183
  end
@@ -190,16 +190,16 @@ module Cosmos
190
190
  JsonDRb.send_data(socket, request)
191
191
  response_data = JsonDRb.receive_message(socket, '')
192
192
  response = JsonRpcResponse.from_json(response_data)
193
- response.should be_a(JsonRpcErrorResponse)
194
- response.error.code.should eql -32602
195
- response.error.message.should eql "Invalid params"
193
+ expect(response).to be_a(JsonRpcErrorResponse)
194
+ expect(response.error.code).to eql -32602
195
+ expect(response.error.message).to eql "Invalid params"
196
196
  socket.close
197
197
  sleep 0.1
198
198
  @json.stop_service
199
199
  sleep(0.1)
200
200
  end
201
201
 
202
- it "should handle method exceptions" do
202
+ it "handles method exceptions" do
203
203
  class MyServer4
204
204
  def my_method(param)
205
205
  raise "Method Error"
@@ -213,16 +213,16 @@ module Cosmos
213
213
  JsonDRb.send_data(socket, request)
214
214
  response_data = JsonDRb.receive_message(socket, '')
215
215
  response = JsonRpcResponse.from_json(response_data)
216
- response.should be_a(JsonRpcErrorResponse)
217
- response.error.code.should eql -1
218
- response.error.message.should eql "Method Error"
216
+ expect(response).to be_a(JsonRpcErrorResponse)
217
+ expect(response.error.code).to eql -1
218
+ expect(response.error.message).to eql "Method Error"
219
219
  socket.close
220
220
  sleep 0.1
221
221
  @json.stop_service
222
222
  sleep(0.1)
223
223
  end
224
224
 
225
- it "should not allow dangerous methods" do
225
+ it "does not allow dangerous methods" do
226
226
  @json.start_service('127.0.0.1', 7777, self)
227
227
  socket = TCPSocket.open('127.0.0.1',7777)
228
228
  sleep 0.1
@@ -230,16 +230,16 @@ module Cosmos
230
230
  JsonDRb.send_data(socket, request)
231
231
  response_data = JsonDRb.receive_message(socket, '')
232
232
  response = JsonRpcResponse.from_json(response_data)
233
- response.should be_a(JsonRpcErrorResponse)
234
- response.error.code.should eql -1
235
- response.error.message.should eql "Cannot call unauthorized methods"
233
+ expect(response).to be_a(JsonRpcErrorResponse)
234
+ expect(response.error.code).to eql -1
235
+ expect(response.error.message).to eql "Cannot call unauthorized methods"
236
236
  socket.close
237
237
  sleep 0.1
238
238
  @json.stop_service
239
239
  sleep(0.1)
240
240
  end
241
241
 
242
- it "should handle an invalid JsonDRB request" do
242
+ it "handles an invalid JsonDRB request" do
243
243
  @json.start_service('127.0.0.1', 7777, self)
244
244
  socket = TCPSocket.open('127.0.0.1',7777)
245
245
  sleep 0.1
@@ -249,9 +249,9 @@ module Cosmos
249
249
  JsonDRb.send_data(socket, request)
250
250
  response_data = JsonDRb.receive_message(socket, '')
251
251
  response = JsonRpcResponse.from_json(response_data)
252
- response.should be_a(JsonRpcErrorResponse)
253
- response.error.code.should eql -32600
254
- response.error.message.should eql "Invalid Request"
252
+ expect(response).to be_a(JsonRpcErrorResponse)
253
+ expect(response.error.code).to eql -32600
254
+ expect(response.error.message).to eql "Invalid Request"
255
255
  socket.close
256
256
  sleep 0.1
257
257
  @json.stop_service
@@ -260,7 +260,7 @@ module Cosmos
260
260
  end
261
261
 
262
262
  describe "send_data" do
263
- it "should retry if the socket blocks" do
263
+ it "retries if the socket blocks" do
264
264
  @json.start_service('127.0.0.1', 7777, self)
265
265
  socket = TCPSocket.open('127.0.0.1',7777)
266
266
  # Stub write_nonblock so it blocks
@@ -281,7 +281,7 @@ module Cosmos
281
281
  sleep(0.1)
282
282
  end
283
283
 
284
- it "should eventually timeout if the socket blocks" do
284
+ it "eventuallies timeout if the socket blocks" do
285
285
  @json.start_service('127.0.0.1', 7777, self)
286
286
  socket = TCPSocket.open('127.0.0.1',7777)
287
287
  # Stub write_nonblock so it blocks
@@ -298,11 +298,11 @@ module Cosmos
298
298
  end
299
299
 
300
300
  describe "debug, debug?" do
301
- it "should set the debug level" do
301
+ it "sets the debug level" do
302
302
  JsonDRb.debug = true
303
- JsonDRb.debug?.should be_truthy
303
+ expect(JsonDRb.debug?).to be_truthy
304
304
  JsonDRb.debug = false
305
- JsonDRb.debug?.should be_falsey
305
+ expect(JsonDRb.debug?).to be_falsey
306
306
  end
307
307
  end
308
308
 
@@ -26,26 +26,26 @@ describe Object do
26
26
  end
27
27
  end
28
28
 
29
- it "should implement as_json" do
30
- Test1.new.as_json.should eql [:@test]
31
- Test2.new.as_json.should eql Hash.new("test"=>0)
29
+ it "implements as_json" do
30
+ expect(Test1.new.as_json).to eql [:@test]
31
+ expect(Test2.new.as_json).to eql Hash.new("test"=>0)
32
32
  end
33
33
  end
34
34
 
35
35
  describe Struct do
36
- it "should implement as_json" do
36
+ it "implements as_json" do
37
37
  s = Struct.new(:test1, :test2)
38
38
  instance = s.new(1,2)
39
39
  hash = {"test1"=>1,"test2"=>2}
40
- instance.as_json.should eql hash
40
+ expect(instance.as_json).to eql hash
41
41
  end
42
42
  end
43
43
 
44
44
  describe String do
45
- it "should implement as_json" do
46
- "test".as_json.should eql "test"
45
+ it "implements as_json" do
46
+ expect("test".as_json).to eql "test"
47
47
  hash = {"json_class"=>"String","raw"=>[16]}
48
- "\x10".as_json.should eql hash
48
+ expect("\x10".as_json).to eql hash
49
49
  end
50
50
  end
51
51
 
@@ -58,42 +58,42 @@ describe Enumerable do
58
58
  end
59
59
  end
60
60
 
61
- it "should implement as_json" do
62
- Test.new.as_json.should eql [1,2]
61
+ it "implements as_json" do
62
+ expect(Test.new.as_json).to eql [1,2]
63
63
  end
64
64
  end
65
65
 
66
66
  describe Array do
67
- it "should implement as_json" do
68
- [1,2,3].as_json.should eql [1,2,3]
67
+ it "implements as_json" do
68
+ expect([1,2,3].as_json).to eql [1,2,3]
69
69
  end
70
70
  end
71
71
 
72
72
  describe Hash do
73
- it "should implement as_json" do
73
+ it "implements as_json" do
74
74
  hash = {"true"=>1,"false"=>0}
75
- hash.as_json.should eql hash
75
+ expect(hash.as_json).to eql hash
76
76
  end
77
77
  end
78
78
 
79
79
  describe Time do
80
- it "should implement as_json" do
80
+ it "implements as_json" do
81
81
  time = Time.new(2020,01,31,12,20,10)
82
- time.as_json.should match "2020-01-31 12:20:10"
82
+ expect(time.as_json).to match "2020-01-31 12:20:10"
83
83
  end
84
84
  end
85
85
 
86
86
  describe Date do
87
- it "should implement as_json" do
87
+ it "implements as_json" do
88
88
  date = Date.new(2020,01,31)
89
- date.as_json.should eql "2020-01-31"
89
+ expect(date.as_json).to eql "2020-01-31"
90
90
  end
91
91
  end
92
92
 
93
93
  describe DateTime do
94
- it "should implement as_json" do
94
+ it "implements as_json" do
95
95
  dt = DateTime.new(2020,01,31,12,20,10)
96
- dt.as_json.should match "2020-01-31T12:20:10"
96
+ expect(dt.as_json).to match "2020-01-31T12:20:10"
97
97
  end
98
98
  end
99
99
 
@@ -105,26 +105,26 @@ describe Exception do
105
105
  end
106
106
  end
107
107
 
108
- it "should implement as_json" do
108
+ it "implements as_json" do
109
109
  json = TestError.new("Error").as_json
110
- json["class"].should eql "TestError"
111
- json["message"].should eql "Error"
110
+ expect(json["class"]).to eql "TestError"
111
+ expect(json["message"]).to eql "Error"
112
112
  hash = {"@test"=>"test"}
113
- json["instance_variables"].should eql hash
113
+ expect(json["instance_variables"]).to eql hash
114
114
  end
115
115
 
116
- it "should call as_json from to_json" do
117
- TestError.new("Error").to_json.should be_a String
116
+ it "calls as_json from to_json" do
117
+ expect(TestError.new("Error").to_json).to be_a String
118
118
  end
119
119
 
120
- it "should create an object from a hash" do
120
+ it "creates an object from a hash" do
121
121
  json = TestError.new("Error").as_json
122
122
  error = Exception.from_hash(json)
123
- error.should be_a TestError
124
- error.message.should eql "Error"
123
+ expect(error).to be_a TestError
124
+ expect(error.message).to eql "Error"
125
125
  end
126
126
 
127
- it "should rescue creating an object" do
127
+ it "rescues creating an object" do
128
128
  json = TestError.new("Error").as_json
129
129
  json["class"] = "ClassWhichDoesNotExist"
130
130
  json["message"] = "Error"
@@ -137,48 +137,48 @@ module Cosmos
137
137
 
138
138
  describe JsonRpcRequest do
139
139
  describe "method" do
140
- it "should return the method" do
141
- JsonRpcRequest.new("puts","test",10).method.should eql "puts"
140
+ it "returns the method" do
141
+ expect(JsonRpcRequest.new("puts","test",10).method).to eql "puts"
142
142
  end
143
143
  end
144
144
 
145
145
  describe "params" do
146
- it "should return the parameters" do
147
- JsonRpcRequest.new("puts",nil,10).params.should eql []
148
- JsonRpcRequest.new("puts","test",10).params.should eql "test"
149
- JsonRpcRequest.new("puts",["test",1],10).params.should eql ["test",1]
146
+ it "returns the parameters" do
147
+ expect(JsonRpcRequest.new("puts",nil,10).params).to eql []
148
+ expect(JsonRpcRequest.new("puts","test",10).params).to eql "test"
149
+ expect(JsonRpcRequest.new("puts",["test",1],10).params).to eql ["test",1]
150
150
  end
151
151
  end
152
152
 
153
153
  describe "id" do
154
- it "should return the request id" do
155
- JsonRpcRequest.new("puts",nil,10).id.should eql 10
154
+ it "returns the request id" do
155
+ expect(JsonRpcRequest.new("puts",nil,10).id).to eql 10
156
156
  end
157
157
  end
158
158
 
159
159
  describe "as_json" do
160
- it "should return the json hash" do
160
+ it "returns the json hash" do
161
161
  json = JsonRpcRequest.new("puts","test",10).as_json
162
- json["jsonrpc"].should eql "2.0"
163
- json["method"].should eql "puts"
164
- json["params"].should eql "test"
165
- json["id"].should eql 10
162
+ expect(json["jsonrpc"]).to eql "2.0"
163
+ expect(json["method"]).to eql "puts"
164
+ expect(json["params"]).to eql "test"
165
+ expect(json["id"]).to eql 10
166
166
  end
167
167
  end
168
168
 
169
169
  describe "to_json" do
170
- it "should return the json string" do
171
- json = JsonRpcRequest.new("puts","test",10).to_json.should be_a String
170
+ it "returns the json string" do
171
+ json = expect(JsonRpcRequest.new("puts","test",10).to_json).to be_a String
172
172
  end
173
173
  end
174
174
 
175
175
  describe "from_json" do
176
- it "should create a request from the json string" do
176
+ it "creates a request from the json string" do
177
177
  request = JsonRpcRequest.new("puts","test",10)
178
- request.should == JsonRpcRequest.from_json(request.to_json)
178
+ expect(request).to eq(JsonRpcRequest.from_json(request.to_json))
179
179
  end
180
180
 
181
- it "should rescue a bad json string" do
181
+ it "rescues a bad json string" do
182
182
  json = JsonRpcRequest.new("puts","test",10).to_json
183
183
  json.gsub!("jsonrpc","version")
184
184
  json.gsub!("2.0","1.1")
@@ -188,71 +188,71 @@ module Cosmos
188
188
  end
189
189
 
190
190
  describe "from_hash" do
191
- it "should create a request from the hash" do
191
+ it "creates a request from the hash" do
192
192
  request = JsonRpcRequest.new("puts","test",10)
193
- request.should == JsonRpcRequest.from_hash(request.as_json)
193
+ expect(request).to eq(JsonRpcRequest.from_hash(request.as_json))
194
194
  end
195
195
  end
196
196
  end
197
197
 
198
198
  describe JsonRpcResponse do
199
199
  describe "as_json" do
200
- it "should return the json hash" do
200
+ it "returns the json hash" do
201
201
  json = JsonRpcResponse.new(10).as_json
202
- json["jsonrpc"].should eql "2.0"
203
- json["id"].should eql 10
202
+ expect(json["jsonrpc"]).to eql "2.0"
203
+ expect(json["id"]).to eql 10
204
204
  end
205
205
  end
206
206
 
207
207
  describe "to_json" do
208
- it "should return the json string" do
209
- json = JsonRpcResponse.new(10).to_json.should be_a String
208
+ it "returns the json string" do
209
+ json = expect(JsonRpcResponse.new(10).to_json).to be_a String
210
210
  end
211
211
  end
212
212
 
213
213
  describe "from_json" do
214
- it "should create a success response from the json string" do
214
+ it "creates a success response from the json string" do
215
215
  json = JsonRpcResponse.new(10).as_json
216
216
  json['result'] = "true"
217
217
  response = JsonRpcResponse.from_json(json.to_json)
218
- response.should be_a JsonRpcSuccessResponse
219
- response.result.should eql "true"
218
+ expect(response).to be_a JsonRpcSuccessResponse
219
+ expect(response.result).to eql "true"
220
220
  end
221
221
 
222
- it "should create a error response from the json string" do
222
+ it "creates a error response from the json string" do
223
223
  json = JsonRpcResponse.new(10).as_json
224
224
  json['error'] = {"code"=>-1, "message"=>"error", "data"=>{"message"=>"problem"}}
225
225
  response = JsonRpcResponse.from_json(json.to_json)
226
- response.should be_a JsonRpcErrorResponse
227
- response.error.code.should eql -1
228
- response.error.message.should eql "error"
229
- response.error.data['message'].should eql "problem"
226
+ expect(response).to be_a JsonRpcErrorResponse
227
+ expect(response.error.code).to eql -1
228
+ expect(response.error.message).to eql "error"
229
+ expect(response.error.data['message']).to eql "problem"
230
230
  end
231
231
 
232
- it "should report an error if there is no 'result' or 'error' key" do
232
+ it "reports an error if there is no 'result' or 'error' key" do
233
233
  json = JsonRpcResponse.new(10).as_json
234
234
  expect { JsonRpcResponse.from_json(json.to_json) }.to raise_error("Invalid JSON-RPC 2.0 Response")
235
235
  end
236
236
 
237
- it "should report an error if the version isn't 2.0" do
237
+ it "reports an error if the version isn't 2.0" do
238
238
  json = JsonRpcResponse.new(10).as_json
239
239
  json['jsonrpc'] = "1.1"
240
240
  json['result'] = "true"
241
241
  expect { JsonRpcResponse.from_json(json.to_json) }.to raise_error("Invalid JSON-RPC 2.0 Response")
242
242
  end
243
243
 
244
- it "should report an error if there is both a 'result' and 'error' key" do
244
+ it "reports an error if there is both a 'result' and 'error' key" do
245
245
  json = JsonRpcResponse.new(10).as_json
246
246
  json['result'] = "true"
247
247
  json['error'] = {"code"=>-1, "message"=>"error"}
248
248
  expect { JsonRpcResponse.from_json(json.to_json) }.to raise_error("Invalid JSON-RPC 2.0 Response")
249
249
  end
250
250
 
251
- it "should report an error if it is not json" do
251
+ it "reports an error if it is not json" do
252
252
  expect { JsonRpcResponse.from_json(Object.new) }.to raise_error("Invalid JSON-RPC 2.0 Response")
253
253
  end
254
254
 
255
- it "should report an error if the error hash is bad" do
255
+ it "reports an error if the error hash is bad" do
256
256
  json = JsonRpcResponse.new(10).as_json
257
257
  json['error'] = {"code"=>-1}
258
258
  expect { JsonRpcResponse.from_json(json.to_json) }.to raise_error("Invalid JSON-RPC 2.0 Error")