Sha256: d19a3ed10c0d2fde31aac510870ae9dcdd33dd8b0d854767955b073f90d4e18c
Contents?: true
Size: 1.6 KB
Versions: 1
Compression:
Stored size: 1.6 KB
Contents
#!/usr/bin/env ruby require "net/http" require "minitest/autorun" require "minitest/unit" require "minitap" require "trollop" require "httparty" OPTS = Trollop.options do opt :server, "EM server URL", :type => String end STATS = Hash.new(0) STATS[:logger_error] = 0 STATS[:logger_warning] = 0 STATS[:logger_critical] = 0 STATS[:logger_fatal] = 0 STATS[:assert_count] = 0 STATS[:success] = 0 STATS[:failure] = 0 class Tester < MiniTest::Unit::TestCase def test_em_get begin url = OPTS[:server] assert_equal "1", HTTParty.get(url).to_s, "Request should return 1" rescue assert false, "request to #{url} failed" end end def test_em_update begin url = OPTS[:server] + "/update" assert_equal "updated!", HTTParty.get(url).to_s, "Update should succeed" rescue assert false, "request to #{url} failed" end end end module MiniTest::Assertions alias :old_assert :assert def assert(test, msg = nil) STATS[:assert_count] += 1 begin old_assert(test, msg) STATS[:success] += 1 rescue MiniTest::Assertion STATS[:failure] += 1 raise end end end MiniTest::Unit.runner = MiniTest::TapY.new # Output STATS to STDERR for easy debugging MiniTest::Unit.after_tests do STDERR.puts "Success: #{STATS[:success]}" STDERR.puts "Failure: #{STATS[:failure]}" STDERR.puts "Assert Count: #{STATS[:assert_count]}" STDERR.puts "Logger warning: #{STATS[:logger_warning]}" STDERR.puts "Logger error: #{STATS[:logger_error]}" STDERR.puts "Logger critical: #{STATS[:logger_critical]}" STDERR.puts "Logger fatal: #{STATS[:logger_fatal]}" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
glowworm-0.3.0 | bin/em_server_tester |