test/bin/storazzo.rb in storazzo-0.5.7 vs test/bin/storazzo.rb in storazzo-0.6.1

- old
+ new

@@ -1,28 +1,25 @@ +# frozen_string_literal: true +require 'English' +require 'minitest/autorun' +require 'storazzo' - - -require "minitest/autorun" -require "storazzo" - class BinaryStorazzoTest < Minitest::Test - - def test_binary_returns_error_with_random_argv - ret = `bin/storazzo aaa` - #puts ret - #puts "return code is '#{$?.exitstatus}'" - should_match_string = 'Unknown action1: aaa. Available actions:' # 'ERROR: Unknown action1: aaa. Available actions: ["auto", "help", "show"]' - assert_equal( - $?.exitstatus, - 13, - "Wrong argument should return 13" - ) - matches_expected_error = ret.match(should_match_string) - #puts "matches_expected_error: ''#{matches_expected_error}''" - assert( - not( matches_expected_error.nil?), - "Binary should return a string which should contain this string: '#{should_match_string}'" - ) - end - -end \ No newline at end of file + def test_binary_returns_error_with_random_argv + ret = `bin/storazzo aaa` + # puts ret + # puts "return code is '#{$?.exitstatus}'" + should_match_string = 'Unknown action1: aaa. Available actions:' # 'ERROR: Unknown action1: aaa. Available actions: ["auto", "help", "show"]' + assert_equal( + $CHILD_STATUS.exitstatus, + 13, + 'Wrong argument should return 13' + ) + matches_expected_error = ret.match(should_match_string) + # puts "matches_expected_error: ''#{matches_expected_error}''" + assert( + !matches_expected_error.nil?, + "Binary should return a string which should contain this string: '#{should_match_string}'" + ) + end +end