summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-ruby/mongoid')
-rw-r--r--dev-ruby/mongoid/ChangeLog6
-rw-r--r--dev-ruby/mongoid/mongoid-2.4.1.ebuild37
2 files changed, 39 insertions, 4 deletions
diff --git a/dev-ruby/mongoid/ChangeLog b/dev-ruby/mongoid/ChangeLog
index 93dc6ee85f92..8bd352ce86aa 100644
--- a/dev-ruby/mongoid/ChangeLog
+++ b/dev-ruby/mongoid/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for dev-ruby/mongoid
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-ruby/mongoid/ChangeLog,v 1.2 2012/01/17 14:41:02 ago Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-ruby/mongoid/ChangeLog,v 1.3 2012/01/19 22:08:15 flameeyes Exp $
+
+ 19 Jan 2012; Diego E. Pettenò <flameeyes@gentoo.org> mongoid-2.4.1.ebuild:
+ Add support for testing with a custom mongd instance, but keep it disabled for
+ now.
17 Jan 2012; Agostino Sarubbo <ago@gentoo.org> mongoid-2.4.1.ebuild:
Fix DESCRIPTION and HOMEPAGE, thanks to James Rowe, wrt bug #399175
diff --git a/dev-ruby/mongoid/mongoid-2.4.1.ebuild b/dev-ruby/mongoid/mongoid-2.4.1.ebuild
index e69b5279c116..467069d2f6fd 100644
--- a/dev-ruby/mongoid/mongoid-2.4.1.ebuild
+++ b/dev-ruby/mongoid/mongoid-2.4.1.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-ruby/mongoid/mongoid-2.4.1.ebuild,v 1.2 2012/01/17 14:41:02 ago Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-ruby/mongoid/mongoid-2.4.1.ebuild,v 1.3 2012/01/19 22:08:15 flameeyes Exp $
EAPI=4
USE_RUBY="ruby18"
@@ -27,8 +27,8 @@ SLOT="0"
KEYWORDS="~amd64"
IUSE="test"
-# Testing requires a running system mongodb instance — and that's bad;
-# instead restrict them for now; we'll get to it.
+# there is support to create a custom mongodb instance now but there are
+# still issues to be fixed.
RESTRICT="test"
ruby_add_rdepend "
@@ -46,10 +46,41 @@ ruby_add_bdepend "
dev-util/watchr
)"
+DEPEND+=" test? ( dev-db/mongodb )"
+
all_ruby_prepare() {
# remove references to bundler, as the gemfile does not add anything
# we need to care about.
sed -i -e '/[bB]undler/d' Rakefile || die
# remove the Gemfile as well or it'll try to load it during testing
rm Gemfile || die
+
+ # the specsuite requires to connect to a mongodb instance; since we
+ # _really_ don't want to connect to the system-configured mongodb
+ # instance we replace the localhost address with another loopback
+ # address (127.0.0.0/8 is all local), which we'll use later.
+ find spec -type f -exec \
+ sed -i \
+ -e 's:localhost:127.255.255.254:g' \
+ -e '/Mongo::Connection/s:\.new\.:.new("127.255.255.254").:g' \
+ {} + || die
+
+ # and fix a few references that should have been from `localhost`
+ sed -i -e '139,$ s:127\.255\.255\.254:localhost:g' \
+ spec/functional/mongoid/config/database_spec.rb || die
+}
+
+each_ruby_test() {
+ mkdir "${T}/mongodb_$(basename $RUBY)"
+ mongod --port 27017 --dbpath "${T}/mongodb_$(basename $RUBY)" \
+ --noprealloc --noauth --nohttpinterface --nounixsocket --nojournal \
+ --bind_ip 127.255.255.254 &
+ mongod_pid=$!
+
+ sleep 2
+
+ ${RUBY} -S rake spec || failed=1
+ kill "${mongod_pid}"
+
+ [ -n ${failed} ] && die "tests failed"
}