Sha256: 7a9929ff0386ff4c167955470c45871d1fc933269a20da1a1edd59d897d6fa97
Contents?: true
Size: 827 Bytes
Versions: 3
Compression:
Stored size: 827 Bytes
Contents
require_relative '../../test_helper' require 'open3' require 'shellwords' def cmd_to_sys(command) Open3.popen3(command) do |stdin, stdout, stderr| [stdout.read, stderr.read] end end describe DocParser do it 'should run the example without problems' do curwd = Dir.getwd Dir.mktmpdir do |dir| Dir.chdir(dir) example_file = Shellwords.escape(File.join($ROOT_DIR, 'example.rb')) out, err = cmd_to_sys '/usr/bin/env ruby ' + example_file err.must_be_empty rows = out.scan(/(\d+) rows/).flatten rows.length.must_equal 5 row_lengths = rows.group_by { |elem| elem.to_i } row_lengths.length.must_equal 1 # HaD: 40 pages of 7 articles row_lengths.keys.first.must_equal(7 * 40) out.must_match(/Done processing/) end Dir.chdir(curwd) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
docparser-0.2.2 | test/lib/docparser/blackbox_test.rb |
docparser-0.2.0 | test/lib/docparser/blackbox_test.rb |
docparser-0.1.6 | test/lib/docparser/blackbox_test.rb |