Commit 9ef1d60f authored by Jakub Jirutka's avatar Jakub Jirutka

community/ruby-mustache: fix tests

parent b42a6830
......@@ -3,16 +3,17 @@
pkgname=ruby-mustache
_gemname=mustache
pkgver=1.1.1
pkgrel=2
pkgrel=3
pkgdesc="Logic-less Ruby templates"
url="https://mustache.github.io/"
arch="noarch"
license="MIT"
depends="ruby"
options="!check" # TODO: check seems to fail on all arches except x86_64
checkdepends="ruby-minitest ruby-rake ruby-rdoc"
source="$pkgname-$pkgver.tar.gz::https://github.com/mustache/mustache/archive/v$pkgver.tar.gz
skip-simplecov.patch"
fix-test-race-condition.patch
skip-simplecov.patch
"
builddir="$srcdir/$_gemname-$pkgver"
build() {
......@@ -42,4 +43,5 @@ package() {
}
sha512sums="3bfe85698ffc95828cb2c6d7ee77049a7dab3a60313289cb0b19e9210d17e4de043df913784c5322a0d9d2073ee6be66f973df9b290e939a0eab153727c31fab ruby-mustache-1.1.1.tar.gz
bb122077fa486acd9b737dcf961baeae53b766a48bc635ac48b11e675923885c8110b0095a2600f1655adb034938b04c979c1f5a5d7064d040c207f47eb4d2cc fix-test-race-condition.patch
1d457e4f059aabb76f2b84fbebb513a3872715b83508528f06c8de5ea98262a4e266c154fa8cf3f5cae0a9fff6e0b82e0c2278f7979ac27a60b202b825b41e5e skip-simplecov.patch"
From 407c6a5db6c1f1cfb40bd6113f07f067d07885a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Mon, 27 Apr 2020 11:16:17 +0200
Subject: [PATCH] Fix test race condition.
The test suite randomly fails with errors such as:
~~~
1) Failure:
AutoloadingTest#test_autoload_lowercase [/builddir/build/BUILD/mustache-1.1.1/usr/share/gems/gems/mustache-1.1.1/test/autoloading_test.rb:17]:
Expected: Comments
Actual: nil
~~~
This happens when `test_namespaced*` test cases are executed earlier
than the remaining test cases, because they are defining
`view_namespace` but not cleaning up afterwards.
---
test/autoloading_test.rb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/test/autoloading_test.rb b/test/autoloading_test.rb
index 0a7ad762..77eb3557 100644
--- a/test/autoloading_test.rb
+++ b/test/autoloading_test.rb
@@ -7,6 +7,10 @@ def setup
Mustache.view_path = File.dirname(__FILE__) + '/fixtures'
end
+ def teardown
+ Mustache.remove_instance_variable(:@view_namespace) if Mustache.instance_variable_defined?(:@view_namespace)
+ end
+
def test_autoload
klass = Mustache.view_class(:Comments)
assert_equal Comments, klass
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment