test/test_gem.rb in nanoc-3.6.8 vs test/test_gem.rb in nanoc-3.6.9

- old
+ new

@@ -6,34 +6,28 @@ super FileUtils.cd(@orig_wd) end def test_build - require 'systemu' - # Require clean environment Dir['nanoc-*.gem'].each { |f| FileUtils.rm(f) } # Build files_before = Set.new Dir['**/*'] - stdout = '' - stderr = '' - status = systemu( - [ 'gem', 'build', 'nanoc.gemspec' ], - 'stdin' => '', - 'stdout' => stdout, - 'stderr' => stderr) - assert status.success? + stdout = StringIO.new + stderr = StringIO.new + piper = Nanoc::Extra::Piper.new(:stdout => stdout, :stderr => stderr) + piper.run(%w( gem build nanoc.gemspec ), nil) files_after = Set.new Dir['**/*'] # Check new files diff = files_after - files_before assert_equal 1, diff.size assert_match(/^nanoc-.*\.gem$/, diff.to_a[0]) # Check output - assert_match(/Successfully built RubyGem\s+Name: nanoc\s+Version: .*\s+File: nanoc-.*\.gem\s+/, stdout) - assert_equal '', stderr + assert_match(/Successfully built RubyGem\s+Name: nanoc\s+Version: .*\s+File: nanoc-.*\.gem\s+/, stdout.string) + assert_equal '', stderr.string ensure Dir['nanoc-*.gem'].each { |f| FileUtils.rm(f) } end end