diff options
Diffstat (limited to 'eclass/ruby-ng.eclass')
-rw-r--r-- | eclass/ruby-ng.eclass | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass index 5af4683..a06fcd4 100644 --- a/eclass/ruby-ng.eclass +++ b/eclass/ruby-ng.eclass @@ -19,6 +19,7 @@ # * ruby19 - Ruby (MRI) 1.9.x # * ruby20 - Ruby (MRI) 2.0.x # * ruby21 - Ruby (MRI) 2.1.x +# * ruby22 - Ruby (MRI) 2.2.x # * ree18 - Ruby Enterprise Edition 1.8.x # * jruby - JRuby # * rbx - Rubinius @@ -608,11 +609,24 @@ ruby_get_implementation() { esac } -# @FUNCTION: ruby-ng_rspec +# @FUNCTION: ruby-ng_rspec <arguments> # @DESCRIPTION: # This is simply a wrapper around the rspec command (executed by $RUBY}) # which also respects TEST_VERBOSE and NOCOLOR environment variables. +# Optionally takes arguments to pass on to the rspec invocation. The +# environment variable RSPEC_VERSION can be used to control the specific +# rspec version that must be executed. It defaults to 2 for historical +# compatibility. ruby-ng_rspec() { + local version=${RSPEC_VERSION-2} + local files="$@" + + # Explicitly pass the expected spec directory since the versioned + # rspec wrappers don't handle this automatically. + if [ ${#@} -eq 0 ]; then + files="spec" + fi + if [[ ${DEPEND} != *"dev-ruby/rspec"* ]]; then ewarn "Missing dev-ruby/rspec in \${DEPEND}" fi @@ -636,7 +650,7 @@ ruby-ng_rspec() { ;; esac - ${RUBY} -S rspec ${rspec_params} "$@" || die "rspec failed" + ${RUBY} -S rspec-${version} ${rspec_params} ${files} || die "rspec failed" } # @FUNCTION: ruby-ng_cucumber |