#!/bin/bash

set -e

source "$HOME/.rvm/scripts/rvm"

if [[ "$LIBSSL" == "1.0" ]]; then
  rvm use --install $RB --autolibs=read-only --disable-binary
elif [[ "$LIBSSL" == "1.1" ]]; then
  rvm use --install $RB --binary --fuzzy
fi

[[ "`ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'`" =~ "OpenSSL $LIBSSL" ]] || { echo "Wrong libssl version"; exit 1; }
