testing/ruby-ttytest: new aport

Required to run fzy's acceptance tests
This commit is contained in:
Eivind Uggedal 2019-05-10 14:38:43 +00:00 committed by Natanael Copa
parent efbb2ad329
commit 34946f61ea
4 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,43 @@
# Maintainer: Eivind Uggedal <eu@eju.no>
pkgname=ruby-ttytest
_gemname=ttytest
pkgver=0.5.0
pkgrel=0
pkgdesc="Acceptance test framework for interactive console applications"
url="https://github.com/jhawthorn/ttytest"
arch="noarch"
license="MIT"
depends="ruby tmux"
checkdepends="ruby-minitest ruby-rake ruby-bundler"
source="$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz
skip-yard.patch
fix-flaky-test.patch
gemspec.patch"
builddir="$srcdir/$_gemname-$pkgver"
build() {
gem build $_gemname.gemspec
}
check() {
rake test
}
package() {
local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"
gem install --local \
--install-dir "$gemdir" \
--ignore-dependencies \
--no-document \
--verbose \
$_gemname
# Cleanup:
cd "$gemdir"
rm -r cache build_info doc
}
sha512sums="30b9f41c8da691178dc9cee66e6fe75c57b3536408d75a6667c1436772103a296e0ec01b2d819592241601e2deae8ebb098a52267fe0e740a35bc039af626fe7 ruby-ttytest-0.5.0.tar.gz
9986cc16c5c30a11cdb92f8d93159bb06dbbc125e1e839d3438b60baabb15b062326116e7e42b9f289a671d91d3f67b90b4f149e0fd86c56b59365b0b36ac4e6 skip-yard.patch
6f1e61c958b754fa2d292c486a366122402a20769156d6a251be47f5cc830ac62d88b70e6dd9984d467dbd87ab103625cec1b7e1f369fc60f7263de887250d60 fix-flaky-test.patch
23dbf425ba8733c6ee91a3809ffab97ec934d1c8c9269105b04bb8b1c3e942cfef417a9ce303e4d5d607d01cb52c83098d0a6c5ddd79aa83274406bbd188704a gemspec.patch"

View File

@ -0,0 +1,12 @@
--- ttytest-0.5.0/test/ttytest/terminal_test.rb
+++ ttytest-0.5.0_p/test/ttytest/terminal_test.rb
@@ -4,6 +4,9 @@
class TerminalTest < Minitest::Test
def test_shell_hello_world
@tty = TTYtest.new_terminal(%{PS1='$ ' /bin/sh})
+ # Give tmux some time to settle
+ # (see https://github.com/jhawthorn/ttytest/issues/2):
+ sleep(0.5)
@tty.assert_row(0, '$')
@tty.send_keys('echo "Hello, world"')
@tty.assert_row(0, '$ echo "Hello, world"')

View File

@ -0,0 +1,13 @@
--- ttytest-0.5.0/ttytest.gemspec
+++ ttytest-0.5.0_p/ttytest.gemspec
@@ -14,9 +14,7 @@
spec.homepage = "https://github.com/jhawthorn/ttytest"
spec.license = "MIT"
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
- f.match(%r{^(test|spec|features)/})
- end
+ spec.files = Dir["lib/**/*"]
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

View File

@ -0,0 +1,26 @@
--- ttytest-0.5.0/Rakefile
+++ ttytest-0.5.0_p/Rakefile
@@ -1,15 +1,10 @@
require "bundler/gem_tasks"
require "rake/testtask"
-require "yard"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList['test/**/*_test.rb']
-end
-
-YARD::Rake::YardocTask.new do |t|
- t.files = ['lib/**/*.rb']
end
task :console do
--- ttytest-0.5.0/ttytest.gemspec
+++ ttytest-0.5.0_p/ttytest.gemspec
@@ -26,5 +26,4 @@
spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "minitest", "~> 5.0"
- spec.add_development_dependency "yard"
end