Sha256: ce365eb6ec9afd1bc3ac750528f555db7cba0e1a632190fc20060425b24e14ba
Contents?: true
Size: 1.17 KB
Versions: 6
Compression:
Stored size: 1.17 KB
Contents
# this file is automatically required when you run `assert` # put any test helpers here # add the root dir to the load path ROOT_PATH = File.expand_path("../..", __FILE__) $LOAD_PATH.unshift(ROOT_PATH) # require pry for debugging (`binding.pry`) require 'pry' require 'test/support/factory' # 1.8.7 backfills # Array#sample if !(a = Array.new).respond_to?(:sample) && a.respond_to?(:choice) class Array alias_method :sample, :choice end end class Assert::Test module TestHelpers def self.included(receiver) receiver.class_eval do setup do @test_run_results = [] @run_callback = proc{ |result| @test_run_results << result } end end private def test_run_callback @run_callback end def test_run_results(type = nil) return @test_run_results if type.nil? @test_run_results.select{ |r| r.type == type } end def test_run_result_count(type = nil) test_run_results(type).count end def test_run_result_messages @test_run_results.map(&:message) end def last_test_run_result @test_run_results.last end end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
assert-2.16.5 | test/helper.rb |
assert-2.16.4 | test/helper.rb |
assert-2.16.3 | test/helper.rb |
assert-2.16.2 | test/helper.rb |
assert-2.16.1 | test/helper.rb |
assert-2.16.0 | test/helper.rb |