Sha256: 5f2fa10b5c22b209c109a1302bb1588c1ad39ca3fce8d11fe0a44fc7d2bbb0a7

Contents?: true

Size: 815 Bytes

Versions: 1

Compression:

Stored size: 815 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(&: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

1 entries across 1 versions & 1 rubygems

Version Path
docparser-0.2.3 test/lib/docparser/blackbox_test.rb